Updated the files.
This commit is contained in:
parent
1553e6b971
commit
753967d4f5
23418 changed files with 3784666 additions and 0 deletions
18
my-app/node_modules/@sigstore/bundle/dist/build.d.ts
generated
vendored
Executable file
18
my-app/node_modules/@sigstore/bundle/dist/build.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,18 @@
|
|||
/// <reference types="node" />
|
||||
import type { BundleWithDsseEnvelope, BundleWithMessageSignature } from './bundle';
|
||||
type VerificationMaterialOptions = {
|
||||
certificate?: Buffer;
|
||||
keyHint?: string;
|
||||
};
|
||||
type MessageSignatureBundleOptions = {
|
||||
digest: Buffer;
|
||||
signature: Buffer;
|
||||
} & VerificationMaterialOptions;
|
||||
type DSSEBundleOptions = {
|
||||
artifact: Buffer;
|
||||
artifactType: string;
|
||||
signature: Buffer;
|
||||
} & VerificationMaterialOptions;
|
||||
export declare function toMessageSignatureBundle(options: MessageSignatureBundleOptions): BundleWithMessageSignature;
|
||||
export declare function toDSSEBundle(options: DSSEBundleOptions): BundleWithDsseEnvelope;
|
||||
export {};
|
89
my-app/node_modules/@sigstore/bundle/dist/build.js
generated
vendored
Executable file
89
my-app/node_modules/@sigstore/bundle/dist/build.js
generated
vendored
Executable file
|
@ -0,0 +1,89 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.toDSSEBundle = exports.toMessageSignatureBundle = void 0;
|
||||
/*
|
||||
Copyright 2023 The Sigstore Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
const protobuf_specs_1 = require("@sigstore/protobuf-specs");
|
||||
const bundle_1 = require("./bundle");
|
||||
// Message signature bundle - $case: 'messageSignature'
|
||||
function toMessageSignatureBundle(options) {
|
||||
return {
|
||||
mediaType: bundle_1.BUNDLE_V02_MEDIA_TYPE,
|
||||
content: {
|
||||
$case: 'messageSignature',
|
||||
messageSignature: {
|
||||
messageDigest: {
|
||||
algorithm: protobuf_specs_1.HashAlgorithm.SHA2_256,
|
||||
digest: options.digest,
|
||||
},
|
||||
signature: options.signature,
|
||||
},
|
||||
},
|
||||
verificationMaterial: toVerificationMaterial(options),
|
||||
};
|
||||
}
|
||||
exports.toMessageSignatureBundle = toMessageSignatureBundle;
|
||||
// DSSE envelope bundle - $case: 'dsseEnvelope'
|
||||
function toDSSEBundle(options) {
|
||||
return {
|
||||
mediaType: bundle_1.BUNDLE_V02_MEDIA_TYPE,
|
||||
content: {
|
||||
$case: 'dsseEnvelope',
|
||||
dsseEnvelope: toEnvelope(options),
|
||||
},
|
||||
verificationMaterial: toVerificationMaterial(options),
|
||||
};
|
||||
}
|
||||
exports.toDSSEBundle = toDSSEBundle;
|
||||
function toEnvelope(options) {
|
||||
return {
|
||||
payloadType: options.artifactType,
|
||||
payload: options.artifact,
|
||||
signatures: [toSignature(options)],
|
||||
};
|
||||
}
|
||||
function toSignature(options) {
|
||||
return {
|
||||
keyid: options.keyHint || '',
|
||||
sig: options.signature,
|
||||
};
|
||||
}
|
||||
// Verification material
|
||||
function toVerificationMaterial(options) {
|
||||
return {
|
||||
content: toKeyContent(options),
|
||||
tlogEntries: [],
|
||||
timestampVerificationData: { rfc3161Timestamps: [] },
|
||||
};
|
||||
}
|
||||
function toKeyContent(options) {
|
||||
if (options.certificate) {
|
||||
return {
|
||||
$case: 'x509CertificateChain',
|
||||
x509CertificateChain: {
|
||||
certificates: [{ rawBytes: options.certificate }],
|
||||
},
|
||||
};
|
||||
}
|
||||
else {
|
||||
return {
|
||||
$case: 'publicKey',
|
||||
publicKey: {
|
||||
hint: options.keyHint || '',
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
65
my-app/node_modules/@sigstore/bundle/dist/bundle.d.ts
generated
vendored
Executable file
65
my-app/node_modules/@sigstore/bundle/dist/bundle.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,65 @@
|
|||
import type { Bundle as ProtoBundle, InclusionProof as ProtoInclusionProof, MessageSignature as ProtoMessageSignature, TransparencyLogEntry as ProtoTransparencyLogEntry, VerificationMaterial as ProtoVerificationMaterial } from '@sigstore/protobuf-specs';
|
||||
import type { WithRequired } from './utility';
|
||||
export declare const BUNDLE_V01_MEDIA_TYPE = "application/vnd.dev.sigstore.bundle+json;version=0.1";
|
||||
export declare const BUNDLE_V02_MEDIA_TYPE = "application/vnd.dev.sigstore.bundle+json;version=0.2";
|
||||
type DsseEnvelopeContent = Extract<ProtoBundle['content'], {
|
||||
$case: 'dsseEnvelope';
|
||||
}>;
|
||||
type MessageSignatureContent = Extract<ProtoBundle['content'], {
|
||||
$case: 'messageSignature';
|
||||
}>;
|
||||
export type MessageSignature = WithRequired<ProtoMessageSignature, 'messageDigest'>;
|
||||
export type VerificationMaterial = WithRequired<ProtoVerificationMaterial, 'content'>;
|
||||
export type TransparencyLogEntry = WithRequired<ProtoTransparencyLogEntry, 'logId' | 'kindVersion'>;
|
||||
export type InclusionProof = WithRequired<ProtoInclusionProof, 'checkpoint'>;
|
||||
export type TLogEntryWithInclusionPromise = WithRequired<TransparencyLogEntry, 'inclusionPromise'>;
|
||||
export type TLogEntryWithInclusionProof = TransparencyLogEntry & {
|
||||
inclusionProof: InclusionProof;
|
||||
};
|
||||
export type Bundle = ProtoBundle & {
|
||||
verificationMaterial: VerificationMaterial & {
|
||||
tlogEntries: TransparencyLogEntry[];
|
||||
};
|
||||
content: (MessageSignatureContent & {
|
||||
messageSignature: MessageSignature;
|
||||
}) | DsseEnvelopeContent;
|
||||
};
|
||||
export type BundleV01 = Bundle & {
|
||||
verificationMaterial: Bundle['verificationMaterial'] & {
|
||||
tlogEntries: TLogEntryWithInclusionPromise[];
|
||||
};
|
||||
};
|
||||
export type BundleLatest = Bundle & {
|
||||
verificationMaterial: Bundle['verificationMaterial'] & {
|
||||
tlogEntries: TLogEntryWithInclusionProof[];
|
||||
};
|
||||
};
|
||||
export type BundleWithCertificateChain = Bundle & {
|
||||
verificationMaterial: Bundle['verificationMaterial'] & {
|
||||
content: Extract<VerificationMaterial['content'], {
|
||||
$case: 'x509CertificateChain';
|
||||
}>;
|
||||
};
|
||||
};
|
||||
export type BundleWithPublicKey = Bundle & {
|
||||
verificationMaterial: Bundle['verificationMaterial'] & {
|
||||
content: Extract<VerificationMaterial['content'], {
|
||||
$case: 'publicKey';
|
||||
}>;
|
||||
};
|
||||
};
|
||||
export type BundleWithMessageSignature = Bundle & {
|
||||
content: Extract<Bundle['content'], {
|
||||
$case: 'messageSignature';
|
||||
}>;
|
||||
};
|
||||
export type BundleWithDsseEnvelope = Bundle & {
|
||||
content: Extract<Bundle['content'], {
|
||||
$case: 'dsseEnvelope';
|
||||
}>;
|
||||
};
|
||||
export declare function isBundleWithCertificateChain(b: Bundle): b is BundleWithCertificateChain;
|
||||
export declare function isBundleWithPublicKey(b: Bundle): b is BundleWithPublicKey;
|
||||
export declare function isBundleWithMessageSignature(b: Bundle): b is BundleWithMessageSignature;
|
||||
export declare function isBundleWithDsseEnvelope(b: Bundle): b is BundleWithDsseEnvelope;
|
||||
export {};
|
22
my-app/node_modules/@sigstore/bundle/dist/bundle.js
generated
vendored
Executable file
22
my-app/node_modules/@sigstore/bundle/dist/bundle.js
generated
vendored
Executable file
|
@ -0,0 +1,22 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isBundleWithDsseEnvelope = exports.isBundleWithMessageSignature = exports.isBundleWithPublicKey = exports.isBundleWithCertificateChain = exports.BUNDLE_V02_MEDIA_TYPE = exports.BUNDLE_V01_MEDIA_TYPE = void 0;
|
||||
exports.BUNDLE_V01_MEDIA_TYPE = 'application/vnd.dev.sigstore.bundle+json;version=0.1';
|
||||
exports.BUNDLE_V02_MEDIA_TYPE = 'application/vnd.dev.sigstore.bundle+json;version=0.2';
|
||||
// Type guards for bundle variants.
|
||||
function isBundleWithCertificateChain(b) {
|
||||
return b.verificationMaterial.content.$case === 'x509CertificateChain';
|
||||
}
|
||||
exports.isBundleWithCertificateChain = isBundleWithCertificateChain;
|
||||
function isBundleWithPublicKey(b) {
|
||||
return b.verificationMaterial.content.$case === 'publicKey';
|
||||
}
|
||||
exports.isBundleWithPublicKey = isBundleWithPublicKey;
|
||||
function isBundleWithMessageSignature(b) {
|
||||
return b.content.$case === 'messageSignature';
|
||||
}
|
||||
exports.isBundleWithMessageSignature = isBundleWithMessageSignature;
|
||||
function isBundleWithDsseEnvelope(b) {
|
||||
return b.content.$case === 'dsseEnvelope';
|
||||
}
|
||||
exports.isBundleWithDsseEnvelope = isBundleWithDsseEnvelope;
|
4
my-app/node_modules/@sigstore/bundle/dist/error.d.ts
generated
vendored
Executable file
4
my-app/node_modules/@sigstore/bundle/dist/error.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,4 @@
|
|||
export declare class ValidationError extends Error {
|
||||
fields: string[];
|
||||
constructor(message: string, fields: string[]);
|
||||
}
|
25
my-app/node_modules/@sigstore/bundle/dist/error.js
generated
vendored
Executable file
25
my-app/node_modules/@sigstore/bundle/dist/error.js
generated
vendored
Executable file
|
@ -0,0 +1,25 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ValidationError = void 0;
|
||||
/*
|
||||
Copyright 2023 The Sigstore Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
class ValidationError extends Error {
|
||||
constructor(message, fields) {
|
||||
super(message);
|
||||
this.fields = fields;
|
||||
}
|
||||
}
|
||||
exports.ValidationError = ValidationError;
|
8
my-app/node_modules/@sigstore/bundle/dist/index.d.ts
generated
vendored
Executable file
8
my-app/node_modules/@sigstore/bundle/dist/index.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,8 @@
|
|||
export { toDSSEBundle, toMessageSignatureBundle } from './build';
|
||||
export { BUNDLE_V01_MEDIA_TYPE, BUNDLE_V02_MEDIA_TYPE, isBundleWithCertificateChain, isBundleWithDsseEnvelope, isBundleWithMessageSignature, isBundleWithPublicKey, } from './bundle';
|
||||
export { ValidationError } from './error';
|
||||
export { bundleFromJSON, bundleToJSON, envelopeFromJSON, envelopeToJSON, } from './serialized';
|
||||
export { assertBundle, assertBundleLatest, assertBundleV01, isBundleV01, } from './validate';
|
||||
export type { Envelope, PublicKeyIdentifier, RFC3161SignedTimestamp, Signature, TimestampVerificationData, X509Certificate, X509CertificateChain, } from '@sigstore/protobuf-specs';
|
||||
export type { Bundle, BundleLatest, BundleV01, BundleWithCertificateChain, BundleWithDsseEnvelope, BundleWithMessageSignature, BundleWithPublicKey, InclusionProof, MessageSignature, TLogEntryWithInclusionPromise, TLogEntryWithInclusionProof, TransparencyLogEntry, VerificationMaterial, } from './bundle';
|
||||
export type { SerializedBundle, SerializedEnvelope } from './serialized';
|
40
my-app/node_modules/@sigstore/bundle/dist/index.js
generated
vendored
Executable file
40
my-app/node_modules/@sigstore/bundle/dist/index.js
generated
vendored
Executable file
|
@ -0,0 +1,40 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isBundleV01 = exports.assertBundleV01 = exports.assertBundleLatest = exports.assertBundle = exports.envelopeToJSON = exports.envelopeFromJSON = exports.bundleToJSON = exports.bundleFromJSON = exports.ValidationError = exports.isBundleWithPublicKey = exports.isBundleWithMessageSignature = exports.isBundleWithDsseEnvelope = exports.isBundleWithCertificateChain = exports.BUNDLE_V02_MEDIA_TYPE = exports.BUNDLE_V01_MEDIA_TYPE = exports.toMessageSignatureBundle = exports.toDSSEBundle = void 0;
|
||||
/*
|
||||
Copyright 2023 The Sigstore Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
var build_1 = require("./build");
|
||||
Object.defineProperty(exports, "toDSSEBundle", { enumerable: true, get: function () { return build_1.toDSSEBundle; } });
|
||||
Object.defineProperty(exports, "toMessageSignatureBundle", { enumerable: true, get: function () { return build_1.toMessageSignatureBundle; } });
|
||||
var bundle_1 = require("./bundle");
|
||||
Object.defineProperty(exports, "BUNDLE_V01_MEDIA_TYPE", { enumerable: true, get: function () { return bundle_1.BUNDLE_V01_MEDIA_TYPE; } });
|
||||
Object.defineProperty(exports, "BUNDLE_V02_MEDIA_TYPE", { enumerable: true, get: function () { return bundle_1.BUNDLE_V02_MEDIA_TYPE; } });
|
||||
Object.defineProperty(exports, "isBundleWithCertificateChain", { enumerable: true, get: function () { return bundle_1.isBundleWithCertificateChain; } });
|
||||
Object.defineProperty(exports, "isBundleWithDsseEnvelope", { enumerable: true, get: function () { return bundle_1.isBundleWithDsseEnvelope; } });
|
||||
Object.defineProperty(exports, "isBundleWithMessageSignature", { enumerable: true, get: function () { return bundle_1.isBundleWithMessageSignature; } });
|
||||
Object.defineProperty(exports, "isBundleWithPublicKey", { enumerable: true, get: function () { return bundle_1.isBundleWithPublicKey; } });
|
||||
var error_1 = require("./error");
|
||||
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return error_1.ValidationError; } });
|
||||
var serialized_1 = require("./serialized");
|
||||
Object.defineProperty(exports, "bundleFromJSON", { enumerable: true, get: function () { return serialized_1.bundleFromJSON; } });
|
||||
Object.defineProperty(exports, "bundleToJSON", { enumerable: true, get: function () { return serialized_1.bundleToJSON; } });
|
||||
Object.defineProperty(exports, "envelopeFromJSON", { enumerable: true, get: function () { return serialized_1.envelopeFromJSON; } });
|
||||
Object.defineProperty(exports, "envelopeToJSON", { enumerable: true, get: function () { return serialized_1.envelopeToJSON; } });
|
||||
var validate_1 = require("./validate");
|
||||
Object.defineProperty(exports, "assertBundle", { enumerable: true, get: function () { return validate_1.assertBundle; } });
|
||||
Object.defineProperty(exports, "assertBundleLatest", { enumerable: true, get: function () { return validate_1.assertBundleLatest; } });
|
||||
Object.defineProperty(exports, "assertBundleV01", { enumerable: true, get: function () { return validate_1.assertBundleV01; } });
|
||||
Object.defineProperty(exports, "isBundleV01", { enumerable: true, get: function () { return validate_1.isBundleV01; } });
|
71
my-app/node_modules/@sigstore/bundle/dist/serialized.d.ts
generated
vendored
Executable file
71
my-app/node_modules/@sigstore/bundle/dist/serialized.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,71 @@
|
|||
import { Envelope } from '@sigstore/protobuf-specs';
|
||||
import { Bundle } from './bundle';
|
||||
import type { OneOf } from './utility';
|
||||
export declare const bundleFromJSON: (obj: unknown) => Bundle;
|
||||
export declare const bundleToJSON: (bundle: Bundle) => SerializedBundle;
|
||||
export declare const envelopeFromJSON: (obj: unknown) => Envelope;
|
||||
export declare const envelopeToJSON: (envelope: Envelope) => SerializedEnvelope;
|
||||
type SerializedTLogEntry = {
|
||||
logIndex: string;
|
||||
logId: {
|
||||
keyId: string;
|
||||
};
|
||||
kindVersion: {
|
||||
kind: string;
|
||||
version: string;
|
||||
} | undefined;
|
||||
integratedTime: string;
|
||||
inclusionPromise: {
|
||||
signedEntryTimestamp: string;
|
||||
} | undefined;
|
||||
inclusionProof: {
|
||||
logIndex: string;
|
||||
rootHash: string;
|
||||
treeSize: string;
|
||||
hashes: string[];
|
||||
checkpoint: {
|
||||
envelope: string;
|
||||
};
|
||||
} | undefined;
|
||||
canonicalizedBody: string;
|
||||
};
|
||||
type SerializedTimestampVerificationData = {
|
||||
rfc3161Timestamps: {
|
||||
signedTimestamp: string;
|
||||
}[];
|
||||
};
|
||||
type SerializedMessageSignature = {
|
||||
messageDigest: {
|
||||
algorithm: string;
|
||||
digest: string;
|
||||
} | undefined;
|
||||
signature: string;
|
||||
};
|
||||
export type SerializedEnvelope = {
|
||||
payload: string;
|
||||
payloadType: string;
|
||||
signatures: {
|
||||
sig: string;
|
||||
keyid: string;
|
||||
}[];
|
||||
};
|
||||
export type SerializedBundle = {
|
||||
mediaType: string;
|
||||
verificationMaterial: (OneOf<{
|
||||
x509CertificateChain: {
|
||||
certificates: {
|
||||
rawBytes: string;
|
||||
}[];
|
||||
};
|
||||
publicKey: {
|
||||
hint: string;
|
||||
};
|
||||
}> | undefined) & {
|
||||
tlogEntries: SerializedTLogEntry[];
|
||||
timestampVerificationData: SerializedTimestampVerificationData | undefined;
|
||||
};
|
||||
} & OneOf<{
|
||||
dsseEnvelope: SerializedEnvelope;
|
||||
messageSignature: SerializedMessageSignature;
|
||||
}>;
|
||||
export {};
|
45
my-app/node_modules/@sigstore/bundle/dist/serialized.js
generated
vendored
Executable file
45
my-app/node_modules/@sigstore/bundle/dist/serialized.js
generated
vendored
Executable file
|
@ -0,0 +1,45 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.envelopeToJSON = exports.envelopeFromJSON = exports.bundleToJSON = exports.bundleFromJSON = void 0;
|
||||
/*
|
||||
Copyright 2023 The Sigstore Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
const protobuf_specs_1 = require("@sigstore/protobuf-specs");
|
||||
const bundle_1 = require("./bundle");
|
||||
const validate_1 = require("./validate");
|
||||
const bundleFromJSON = (obj) => {
|
||||
const bundle = protobuf_specs_1.Bundle.fromJSON(obj);
|
||||
(0, validate_1.assertBundle)(bundle);
|
||||
if (bundle.mediaType === bundle_1.BUNDLE_V01_MEDIA_TYPE) {
|
||||
(0, validate_1.assertBundleV01)(bundle);
|
||||
}
|
||||
else {
|
||||
(0, validate_1.assertBundleLatest)(bundle);
|
||||
}
|
||||
return bundle;
|
||||
};
|
||||
exports.bundleFromJSON = bundleFromJSON;
|
||||
const bundleToJSON = (bundle) => {
|
||||
return protobuf_specs_1.Bundle.toJSON(bundle);
|
||||
};
|
||||
exports.bundleToJSON = bundleToJSON;
|
||||
const envelopeFromJSON = (obj) => {
|
||||
return protobuf_specs_1.Envelope.fromJSON(obj);
|
||||
};
|
||||
exports.envelopeFromJSON = envelopeFromJSON;
|
||||
const envelopeToJSON = (envelope) => {
|
||||
return protobuf_specs_1.Envelope.toJSON(envelope);
|
||||
};
|
||||
exports.envelopeToJSON = envelopeToJSON;
|
14
my-app/node_modules/@sigstore/bundle/dist/utility.d.ts
generated
vendored
Executable file
14
my-app/node_modules/@sigstore/bundle/dist/utility.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,14 @@
|
|||
type ValueOf<Obj> = Obj[keyof Obj];
|
||||
type OneOnly<Obj, K extends keyof Obj> = {
|
||||
[key in Exclude<keyof Obj, K>]: undefined;
|
||||
} & {
|
||||
[key in K]: Obj[K];
|
||||
};
|
||||
type OneOfByKey<Obj> = {
|
||||
[key in keyof Obj]: OneOnly<Obj, key>;
|
||||
};
|
||||
export type OneOf<T> = ValueOf<OneOfByKey<T>>;
|
||||
export type WithRequired<T, K extends keyof T> = T & {
|
||||
[P in K]-?: NonNullable<T[P]>;
|
||||
};
|
||||
export {};
|
2
my-app/node_modules/@sigstore/bundle/dist/utility.js
generated
vendored
Executable file
2
my-app/node_modules/@sigstore/bundle/dist/utility.js
generated
vendored
Executable file
|
@ -0,0 +1,2 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
6
my-app/node_modules/@sigstore/bundle/dist/validate.d.ts
generated
vendored
Executable file
6
my-app/node_modules/@sigstore/bundle/dist/validate.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
import type { Bundle as ProtoBundle } from '@sigstore/protobuf-specs';
|
||||
import type { Bundle, BundleLatest, BundleV01 } from './bundle';
|
||||
export declare function assertBundle(b: ProtoBundle): asserts b is Bundle;
|
||||
export declare function assertBundleV01(b: Bundle): asserts b is BundleV01;
|
||||
export declare function isBundleV01(b: Bundle): b is BundleV01;
|
||||
export declare function assertBundleLatest(b: ProtoBundle): asserts b is BundleLatest;
|
160
my-app/node_modules/@sigstore/bundle/dist/validate.js
generated
vendored
Executable file
160
my-app/node_modules/@sigstore/bundle/dist/validate.js
generated
vendored
Executable file
|
@ -0,0 +1,160 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.assertBundleLatest = exports.isBundleV01 = exports.assertBundleV01 = exports.assertBundle = void 0;
|
||||
/*
|
||||
Copyright 2023 The Sigstore Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
const bundle_1 = require("./bundle");
|
||||
const error_1 = require("./error");
|
||||
// Performs basic validation of a Sigstore bundle to ensure that all required
|
||||
// fields are populated. This is not a complete validation of the bundle, but
|
||||
// rather a check that the bundle is in a valid state to be processed by the
|
||||
// rest of the code.
|
||||
function assertBundle(b) {
|
||||
const invalidValues = [];
|
||||
// Media type validation
|
||||
if (b.mediaType === undefined ||
|
||||
!b.mediaType.startsWith('application/vnd.dev.sigstore.bundle+json;version=')) {
|
||||
invalidValues.push('mediaType');
|
||||
}
|
||||
// Content-related validation
|
||||
if (b.content === undefined) {
|
||||
invalidValues.push('content');
|
||||
}
|
||||
else {
|
||||
switch (b.content.$case) {
|
||||
case 'messageSignature':
|
||||
if (b.content.messageSignature.messageDigest === undefined) {
|
||||
invalidValues.push('content.messageSignature.messageDigest');
|
||||
}
|
||||
else {
|
||||
if (b.content.messageSignature.messageDigest.digest.length === 0) {
|
||||
invalidValues.push('content.messageSignature.messageDigest.digest');
|
||||
}
|
||||
}
|
||||
if (b.content.messageSignature.signature.length === 0) {
|
||||
invalidValues.push('content.messageSignature.signature');
|
||||
}
|
||||
break;
|
||||
case 'dsseEnvelope':
|
||||
if (b.content.dsseEnvelope.payload.length === 0) {
|
||||
invalidValues.push('content.dsseEnvelope.payload');
|
||||
}
|
||||
if (b.content.dsseEnvelope.signatures.length !== 1) {
|
||||
invalidValues.push('content.dsseEnvelope.signatures');
|
||||
}
|
||||
else {
|
||||
if (b.content.dsseEnvelope.signatures[0].sig.length === 0) {
|
||||
invalidValues.push('content.dsseEnvelope.signatures[0].sig');
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Verification material-related validation
|
||||
if (b.verificationMaterial === undefined) {
|
||||
invalidValues.push('verificationMaterial');
|
||||
}
|
||||
else {
|
||||
if (b.verificationMaterial.content === undefined) {
|
||||
invalidValues.push('verificationMaterial.content');
|
||||
}
|
||||
else {
|
||||
switch (b.verificationMaterial.content.$case) {
|
||||
case 'x509CertificateChain':
|
||||
if (b.verificationMaterial.content.x509CertificateChain.certificates
|
||||
.length === 0) {
|
||||
invalidValues.push('verificationMaterial.content.x509CertificateChain.certificates');
|
||||
}
|
||||
b.verificationMaterial.content.x509CertificateChain.certificates.forEach((cert, i) => {
|
||||
if (cert.rawBytes.length === 0) {
|
||||
invalidValues.push(`verificationMaterial.content.x509CertificateChain.certificates[${i}].rawBytes`);
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (b.verificationMaterial.tlogEntries === undefined) {
|
||||
invalidValues.push('verificationMaterial.tlogEntries');
|
||||
}
|
||||
else {
|
||||
if (b.verificationMaterial.tlogEntries.length > 0) {
|
||||
b.verificationMaterial.tlogEntries.forEach((entry, i) => {
|
||||
if (entry.logId === undefined) {
|
||||
invalidValues.push(`verificationMaterial.tlogEntries[${i}].logId`);
|
||||
}
|
||||
if (entry.kindVersion === undefined) {
|
||||
invalidValues.push(`verificationMaterial.tlogEntries[${i}].kindVersion`);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
if (invalidValues.length > 0) {
|
||||
throw new error_1.ValidationError('invalid bundle', invalidValues);
|
||||
}
|
||||
}
|
||||
exports.assertBundle = assertBundle;
|
||||
// Asserts that the given bundle conforms to the v0.1 bundle format.
|
||||
function assertBundleV01(b) {
|
||||
const invalidValues = [];
|
||||
if (b.mediaType && b.mediaType !== bundle_1.BUNDLE_V01_MEDIA_TYPE) {
|
||||
invalidValues.push('mediaType');
|
||||
}
|
||||
if (b.verificationMaterial &&
|
||||
b.verificationMaterial.tlogEntries?.length > 0) {
|
||||
b.verificationMaterial.tlogEntries.forEach((entry, i) => {
|
||||
if (entry.inclusionPromise === undefined) {
|
||||
invalidValues.push(`verificationMaterial.tlogEntries[${i}].inclusionPromise`);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (invalidValues.length > 0) {
|
||||
throw new error_1.ValidationError('invalid v0.1 bundle', invalidValues);
|
||||
}
|
||||
}
|
||||
exports.assertBundleV01 = assertBundleV01;
|
||||
// Type guard to determine if Bundle is a v0.1 bundle.
|
||||
function isBundleV01(b) {
|
||||
try {
|
||||
assertBundleV01(b);
|
||||
return true;
|
||||
}
|
||||
catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
exports.isBundleV01 = isBundleV01;
|
||||
// Asserts that the given bundle conforms to the newest (0.2) bundle format.
|
||||
function assertBundleLatest(b) {
|
||||
const invalidValues = [];
|
||||
if (b.verificationMaterial &&
|
||||
b.verificationMaterial.tlogEntries?.length > 0) {
|
||||
b.verificationMaterial.tlogEntries.forEach((entry, i) => {
|
||||
if (entry.inclusionProof === undefined) {
|
||||
invalidValues.push(`verificationMaterial.tlogEntries[${i}].inclusionProof`);
|
||||
}
|
||||
else {
|
||||
if (entry.inclusionProof.checkpoint === undefined) {
|
||||
invalidValues.push(`verificationMaterial.tlogEntries[${i}].inclusionProof.checkpoint`);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if (invalidValues.length > 0) {
|
||||
throw new error_1.ValidationError('invalid v0.2 bundle', invalidValues);
|
||||
}
|
||||
}
|
||||
exports.assertBundleLatest = assertBundleLatest;
|
Loading…
Add table
Add a link
Reference in a new issue