This commit is contained in:
2026-08-14 16:03:47 +01:00
parent fd53e3f4fb
commit dfdc3b2840
2463 changed files with 186456 additions and 111315 deletions
+10 -1
View File
@@ -25,7 +25,16 @@ limitations under the License.
const crypto_1 = __importDefault(require("crypto"));
function createPublicKey(key, type = 'spki') {
if (typeof key === 'string') {
return crypto_1.default.createPublicKey(key);
if (key.startsWith('-----')) {
return crypto_1.default.createPublicKey(key);
}
else {
return crypto_1.default.createPublicKey({
key: Buffer.from(key, 'base64'),
format: 'der',
type: type,
});
}
}
else {
return crypto_1.default.createPublicKey({ key, format: 'der', type: type });
+7 -8
View File
@@ -19,12 +19,11 @@ limitations under the License.
const PAE_PREFIX = 'DSSEv1';
// DSSE Pre-Authentication Encoding
function preAuthEncoding(payloadType, payload) {
const prefix = [
PAE_PREFIX,
payloadType.length,
payloadType,
payload.length,
'',
].join(' ');
return Buffer.concat([Buffer.from(prefix, 'ascii'), payload]);
const typeBytes = Buffer.from(payloadType, 'utf-8');
return Buffer.concat([
Buffer.from(`${PAE_PREFIX} ${typeBytes.length} `, 'ascii'),
typeBytes,
Buffer.from(` ${payload.length} `, 'ascii'),
payload,
]);
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@sigstore/core",
"version": "3.1.0",
"version": "3.2.1",
"description": "Base library for Sigstore",
"main": "dist/index.js",
"types": "dist/index.d.ts",
+2 -2
View File
@@ -1,8 +1,8 @@
"use strict";
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.5
// protoc v6.30.2
// protoc-gen-ts_proto v2.11.5
// protoc v7.34.1
// source: envelope.proto
Object.defineProperty(exports, "__esModule", { value: true });
exports.Signature = exports.Envelope = void 0;
+2 -2
View File
@@ -11,7 +11,7 @@ export interface CloudEvent {
[key: string]: CloudEvent_CloudEventAttributeValue;
};
/** -- CloudEvent Data (Bytes, Text, or Proto) */
data?: {
data: {
$case: "binaryData";
binaryData: Buffer;
} | {
@@ -27,7 +27,7 @@ export interface CloudEvent_AttributesEntry {
value: CloudEvent_CloudEventAttributeValue | undefined;
}
export interface CloudEvent_CloudEventAttributeValue {
attr?: {
attr: {
$case: "ceBoolean";
ceBoolean: boolean;
} | {
+4 -4
View File
@@ -1,8 +1,8 @@
"use strict";
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.5
// protoc v6.30.2
// protoc-gen-ts_proto v2.11.5
// protoc v7.34.1
// source: events.proto
Object.defineProperty(exports, "__esModule", { value: true });
exports.CloudEventBatch = exports.CloudEvent_CloudEventAttributeValue = exports.CloudEvent_AttributesEntry = exports.CloudEvent = void 0;
@@ -17,7 +17,7 @@ exports.CloudEvent = {
specVersion: isSet(object.specVersion) ? globalThis.String(object.specVersion) : "",
type: isSet(object.type) ? globalThis.String(object.type) : "",
attributes: isObject(object.attributes)
? Object.entries(object.attributes).reduce((acc, [key, value]) => {
? globalThis.Object.entries(object.attributes).reduce((acc, [key, value]) => {
acc[key] = exports.CloudEvent_CloudEventAttributeValue.fromJSON(value);
return acc;
}, {})
@@ -46,7 +46,7 @@ exports.CloudEvent = {
obj.type = message.type;
}
if (message.attributes) {
const entries = Object.entries(message.attributes);
const entries = globalThis.Object.entries(message.attributes);
if (entries.length > 0) {
obj.attributes = {};
entries.forEach(([k, v]) => {
@@ -1,8 +1,8 @@
"use strict";
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.5
// protoc v6.30.2
// protoc-gen-ts_proto v2.11.5
// protoc v7.34.1
// source: google/api/field_behavior.proto
Object.defineProperty(exports, "__esModule", { value: true });
exports.FieldBehavior = void 0;
@@ -1,8 +1,8 @@
"use strict";
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.5
// protoc v6.30.2
// protoc-gen-ts_proto v2.11.5
// protoc v7.34.1
// source: google/protobuf/any.proto
Object.defineProperty(exports, "__esModule", { value: true });
exports.Any = void 0;
@@ -22,6 +22,8 @@ export declare enum Edition {
*/
EDITION_2023 = 1000,
EDITION_2024 = 1001,
/** EDITION_UNSTABLE - A placeholder edition for developing and testing unscheduled features. */
EDITION_UNSTABLE = 9999,
/**
* EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be
* used or relied on outside of tests.
@@ -40,6 +42,20 @@ export declare enum Edition {
}
export declare function editionFromJSON(object: any): Edition;
export declare function editionToJSON(object: Edition): string;
/**
* Describes the 'visibility' of a symbol with respect to the proto import
* system. Symbols can only be imported when the visibility rules do not prevent
* it (ex: local symbols cannot be imported). Visibility modifiers can only set
* on `message` and `enum` as they are the only types available to be referenced
* from other files.
*/
export declare enum SymbolVisibility {
VISIBILITY_UNSET = 0,
VISIBILITY_LOCAL = 1,
VISIBILITY_EXPORT = 2
}
export declare function symbolVisibilityFromJSON(object: any): SymbolVisibility;
export declare function symbolVisibilityToJSON(object: SymbolVisibility): string;
/**
* The protocol compiler can output a FileDescriptorSet containing the .proto
* files it parses.
@@ -62,6 +78,11 @@ export interface FileDescriptorProto {
* For Google-internal migration only. Do not use.
*/
weakDependency: number[];
/**
* Names of files imported by this file purely for the purpose of providing
* option extensions. These are excluded from the dependency list above.
*/
optionDependency: string[];
/** All top-level definitions in this file. */
messageType: DescriptorProto[];
enumType: EnumDescriptorProto[];
@@ -109,6 +130,8 @@ export interface DescriptorProto {
* A given name may only be reserved once.
*/
reservedName: string[];
/** Support for `export` and `local` keywords on enums. */
visibility?: SymbolVisibility | undefined;
}
export interface DescriptorProto_ExtensionRange {
/** Inclusive. */
@@ -327,6 +350,8 @@ export interface EnumDescriptorProto {
* be reserved once.
*/
reservedName: string[];
/** Support for `export` and `local` keywords on enums. */
visibility?: SymbolVisibility | undefined;
}
/**
* Range of reserved numeric values. Reserved values may not be used by
@@ -667,7 +692,12 @@ export interface FieldOptions {
* is a formalization for deprecating fields.
*/
deprecated?: boolean | undefined;
/** For Google-internal migration only. Do not use. */
/**
* DEPRECATED. DO NOT USE!
* For Google-internal migration only. Do not use.
*
* @deprecated
*/
weak?: boolean | undefined;
/**
* Indicate that the field value should not be printed out when using debug
@@ -770,6 +800,11 @@ export interface FieldOptions_FeatureSupport {
* not be able to override it.
*/
editionRemoved?: Edition | undefined;
/**
* The removal error text if this feature is used after the edition it was
* removed in.
*/
removalError?: string | undefined;
}
export interface OneofOptions {
/**
@@ -941,6 +976,7 @@ export interface FeatureSet {
messageEncoding?: FeatureSet_MessageEncoding | undefined;
jsonFormat?: FeatureSet_JsonFormat | undefined;
enforceNamingStyle?: FeatureSet_EnforceNamingStyle | undefined;
defaultSymbolVisibility?: FeatureSet_VisibilityFeature_DefaultSymbolVisibility | undefined;
}
export declare enum FeatureSet_FieldPresence {
FIELD_PRESENCE_UNKNOWN = 0,
@@ -992,6 +1028,25 @@ export declare enum FeatureSet_EnforceNamingStyle {
}
export declare function featureSet_EnforceNamingStyleFromJSON(object: any): FeatureSet_EnforceNamingStyle;
export declare function featureSet_EnforceNamingStyleToJSON(object: FeatureSet_EnforceNamingStyle): string;
export interface FeatureSet_VisibilityFeature {
}
export declare enum FeatureSet_VisibilityFeature_DefaultSymbolVisibility {
DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = 0,
/** EXPORT_ALL - Default pre-EDITION_2024, all UNSET visibility are export. */
EXPORT_ALL = 1,
/** EXPORT_TOP_LEVEL - All top-level symbols default to export, nested default to local. */
EXPORT_TOP_LEVEL = 2,
/** LOCAL_ALL - All symbols default to local. */
LOCAL_ALL = 3,
/**
* STRICT - All symbols local by default. Nested types cannot be exported.
* With special case caveat for message { enum {} reserved 1 to max; }
* This is the recommended setting for new protos.
*/
STRICT = 4
}
export declare function featureSet_VisibilityFeature_DefaultSymbolVisibilityFromJSON(object: any): FeatureSet_VisibilityFeature_DefaultSymbolVisibility;
export declare function featureSet_VisibilityFeature_DefaultSymbolVisibilityToJSON(object: FeatureSet_VisibilityFeature_DefaultSymbolVisibility): string;
/**
* A compiled specification for the defaults of a set of features. These
* messages are generated from FeatureSet extensions and can be used to seed
@@ -1238,6 +1293,7 @@ export declare const MethodOptions: MessageFns<MethodOptions>;
export declare const UninterpretedOption: MessageFns<UninterpretedOption>;
export declare const UninterpretedOption_NamePart: MessageFns<UninterpretedOption_NamePart>;
export declare const FeatureSet: MessageFns<FeatureSet>;
export declare const FeatureSet_VisibilityFeature: MessageFns<FeatureSet_VisibilityFeature>;
export declare const FeatureSetDefaults: MessageFns<FeatureSetDefaults>;
export declare const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns<FeatureSetDefaults_FeatureSetEditionDefault>;
export declare const SourceCodeInfo: MessageFns<SourceCodeInfo>;
@@ -1,14 +1,16 @@
"use strict";
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.5
// protoc v6.30.2
// protoc-gen-ts_proto v2.11.5
// protoc v7.34.1
// source: google/protobuf/descriptor.proto
Object.defineProperty(exports, "__esModule", { value: true });
exports.GeneratedCodeInfo = exports.SourceCodeInfo_Location = exports.SourceCodeInfo = exports.FeatureSetDefaults_FeatureSetEditionDefault = exports.FeatureSetDefaults = exports.FeatureSet = exports.UninterpretedOption_NamePart = exports.UninterpretedOption = exports.MethodOptions = exports.ServiceOptions = exports.EnumValueOptions = exports.EnumOptions = exports.OneofOptions = exports.FieldOptions_FeatureSupport = exports.FieldOptions_EditionDefault = exports.FieldOptions = exports.MessageOptions = exports.FileOptions = exports.MethodDescriptorProto = exports.ServiceDescriptorProto = exports.EnumValueDescriptorProto = exports.EnumDescriptorProto_EnumReservedRange = exports.EnumDescriptorProto = exports.OneofDescriptorProto = exports.FieldDescriptorProto = exports.ExtensionRangeOptions_Declaration = exports.ExtensionRangeOptions = exports.DescriptorProto_ReservedRange = exports.DescriptorProto_ExtensionRange = exports.DescriptorProto = exports.FileDescriptorProto = exports.FileDescriptorSet = exports.GeneratedCodeInfo_Annotation_Semantic = exports.FeatureSet_EnforceNamingStyle = exports.FeatureSet_JsonFormat = exports.FeatureSet_MessageEncoding = exports.FeatureSet_Utf8Validation = exports.FeatureSet_RepeatedFieldEncoding = exports.FeatureSet_EnumType = exports.FeatureSet_FieldPresence = exports.MethodOptions_IdempotencyLevel = exports.FieldOptions_OptionTargetType = exports.FieldOptions_OptionRetention = exports.FieldOptions_JSType = exports.FieldOptions_CType = exports.FileOptions_OptimizeMode = exports.FieldDescriptorProto_Label = exports.FieldDescriptorProto_Type = exports.ExtensionRangeOptions_VerificationState = exports.Edition = void 0;
exports.GeneratedCodeInfo_Annotation = void 0;
exports.FeatureSetDefaults_FeatureSetEditionDefault = exports.FeatureSetDefaults = exports.FeatureSet_VisibilityFeature = exports.FeatureSet = exports.UninterpretedOption_NamePart = exports.UninterpretedOption = exports.MethodOptions = exports.ServiceOptions = exports.EnumValueOptions = exports.EnumOptions = exports.OneofOptions = exports.FieldOptions_FeatureSupport = exports.FieldOptions_EditionDefault = exports.FieldOptions = exports.MessageOptions = exports.FileOptions = exports.MethodDescriptorProto = exports.ServiceDescriptorProto = exports.EnumValueDescriptorProto = exports.EnumDescriptorProto_EnumReservedRange = exports.EnumDescriptorProto = exports.OneofDescriptorProto = exports.FieldDescriptorProto = exports.ExtensionRangeOptions_Declaration = exports.ExtensionRangeOptions = exports.DescriptorProto_ReservedRange = exports.DescriptorProto_ExtensionRange = exports.DescriptorProto = exports.FileDescriptorProto = exports.FileDescriptorSet = exports.GeneratedCodeInfo_Annotation_Semantic = exports.FeatureSet_VisibilityFeature_DefaultSymbolVisibility = exports.FeatureSet_EnforceNamingStyle = exports.FeatureSet_JsonFormat = exports.FeatureSet_MessageEncoding = exports.FeatureSet_Utf8Validation = exports.FeatureSet_RepeatedFieldEncoding = exports.FeatureSet_EnumType = exports.FeatureSet_FieldPresence = exports.MethodOptions_IdempotencyLevel = exports.FieldOptions_OptionTargetType = exports.FieldOptions_OptionRetention = exports.FieldOptions_JSType = exports.FieldOptions_CType = exports.FileOptions_OptimizeMode = exports.FieldDescriptorProto_Label = exports.FieldDescriptorProto_Type = exports.ExtensionRangeOptions_VerificationState = exports.SymbolVisibility = exports.Edition = void 0;
exports.GeneratedCodeInfo_Annotation = exports.GeneratedCodeInfo = exports.SourceCodeInfo_Location = exports.SourceCodeInfo = void 0;
exports.editionFromJSON = editionFromJSON;
exports.editionToJSON = editionToJSON;
exports.symbolVisibilityFromJSON = symbolVisibilityFromJSON;
exports.symbolVisibilityToJSON = symbolVisibilityToJSON;
exports.extensionRangeOptions_VerificationStateFromJSON = extensionRangeOptions_VerificationStateFromJSON;
exports.extensionRangeOptions_VerificationStateToJSON = extensionRangeOptions_VerificationStateToJSON;
exports.fieldDescriptorProto_TypeFromJSON = fieldDescriptorProto_TypeFromJSON;
@@ -41,6 +43,8 @@ exports.featureSet_JsonFormatFromJSON = featureSet_JsonFormatFromJSON;
exports.featureSet_JsonFormatToJSON = featureSet_JsonFormatToJSON;
exports.featureSet_EnforceNamingStyleFromJSON = featureSet_EnforceNamingStyleFromJSON;
exports.featureSet_EnforceNamingStyleToJSON = featureSet_EnforceNamingStyleToJSON;
exports.featureSet_VisibilityFeature_DefaultSymbolVisibilityFromJSON = featureSet_VisibilityFeature_DefaultSymbolVisibilityFromJSON;
exports.featureSet_VisibilityFeature_DefaultSymbolVisibilityToJSON = featureSet_VisibilityFeature_DefaultSymbolVisibilityToJSON;
exports.generatedCodeInfo_Annotation_SemanticFromJSON = generatedCodeInfo_Annotation_SemanticFromJSON;
exports.generatedCodeInfo_Annotation_SemanticToJSON = generatedCodeInfo_Annotation_SemanticToJSON;
/* eslint-disable */
@@ -69,6 +73,8 @@ var Edition;
*/
Edition[Edition["EDITION_2023"] = 1000] = "EDITION_2023";
Edition[Edition["EDITION_2024"] = 1001] = "EDITION_2024";
/** EDITION_UNSTABLE - A placeholder edition for developing and testing unscheduled features. */
Edition[Edition["EDITION_UNSTABLE"] = 9999] = "EDITION_UNSTABLE";
/**
* EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be
* used or relied on outside of tests.
@@ -105,6 +111,9 @@ function editionFromJSON(object) {
case 1001:
case "EDITION_2024":
return Edition.EDITION_2024;
case 9999:
case "EDITION_UNSTABLE":
return Edition.EDITION_UNSTABLE;
case 1:
case "EDITION_1_TEST_ONLY":
return Edition.EDITION_1_TEST_ONLY;
@@ -141,6 +150,8 @@ function editionToJSON(object) {
return "EDITION_2023";
case Edition.EDITION_2024:
return "EDITION_2024";
case Edition.EDITION_UNSTABLE:
return "EDITION_UNSTABLE";
case Edition.EDITION_1_TEST_ONLY:
return "EDITION_1_TEST_ONLY";
case Edition.EDITION_2_TEST_ONLY:
@@ -157,6 +168,46 @@ function editionToJSON(object) {
throw new globalThis.Error("Unrecognized enum value " + object + " for enum Edition");
}
}
/**
* Describes the 'visibility' of a symbol with respect to the proto import
* system. Symbols can only be imported when the visibility rules do not prevent
* it (ex: local symbols cannot be imported). Visibility modifiers can only set
* on `message` and `enum` as they are the only types available to be referenced
* from other files.
*/
var SymbolVisibility;
(function (SymbolVisibility) {
SymbolVisibility[SymbolVisibility["VISIBILITY_UNSET"] = 0] = "VISIBILITY_UNSET";
SymbolVisibility[SymbolVisibility["VISIBILITY_LOCAL"] = 1] = "VISIBILITY_LOCAL";
SymbolVisibility[SymbolVisibility["VISIBILITY_EXPORT"] = 2] = "VISIBILITY_EXPORT";
})(SymbolVisibility || (exports.SymbolVisibility = SymbolVisibility = {}));
function symbolVisibilityFromJSON(object) {
switch (object) {
case 0:
case "VISIBILITY_UNSET":
return SymbolVisibility.VISIBILITY_UNSET;
case 1:
case "VISIBILITY_LOCAL":
return SymbolVisibility.VISIBILITY_LOCAL;
case 2:
case "VISIBILITY_EXPORT":
return SymbolVisibility.VISIBILITY_EXPORT;
default:
throw new globalThis.Error("Unrecognized enum value " + object + " for enum SymbolVisibility");
}
}
function symbolVisibilityToJSON(object) {
switch (object) {
case SymbolVisibility.VISIBILITY_UNSET:
return "VISIBILITY_UNSET";
case SymbolVisibility.VISIBILITY_LOCAL:
return "VISIBILITY_LOCAL";
case SymbolVisibility.VISIBILITY_EXPORT:
return "VISIBILITY_EXPORT";
default:
throw new globalThis.Error("Unrecognized enum value " + object + " for enum SymbolVisibility");
}
}
/** The verification state of the extension range. */
var ExtensionRangeOptions_VerificationState;
(function (ExtensionRangeOptions_VerificationState) {
@@ -877,6 +928,59 @@ function featureSet_EnforceNamingStyleToJSON(object) {
throw new globalThis.Error("Unrecognized enum value " + object + " for enum FeatureSet_EnforceNamingStyle");
}
}
var FeatureSet_VisibilityFeature_DefaultSymbolVisibility;
(function (FeatureSet_VisibilityFeature_DefaultSymbolVisibility) {
FeatureSet_VisibilityFeature_DefaultSymbolVisibility[FeatureSet_VisibilityFeature_DefaultSymbolVisibility["DEFAULT_SYMBOL_VISIBILITY_UNKNOWN"] = 0] = "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN";
/** EXPORT_ALL - Default pre-EDITION_2024, all UNSET visibility are export. */
FeatureSet_VisibilityFeature_DefaultSymbolVisibility[FeatureSet_VisibilityFeature_DefaultSymbolVisibility["EXPORT_ALL"] = 1] = "EXPORT_ALL";
/** EXPORT_TOP_LEVEL - All top-level symbols default to export, nested default to local. */
FeatureSet_VisibilityFeature_DefaultSymbolVisibility[FeatureSet_VisibilityFeature_DefaultSymbolVisibility["EXPORT_TOP_LEVEL"] = 2] = "EXPORT_TOP_LEVEL";
/** LOCAL_ALL - All symbols default to local. */
FeatureSet_VisibilityFeature_DefaultSymbolVisibility[FeatureSet_VisibilityFeature_DefaultSymbolVisibility["LOCAL_ALL"] = 3] = "LOCAL_ALL";
/**
* STRICT - All symbols local by default. Nested types cannot be exported.
* With special case caveat for message { enum {} reserved 1 to max; }
* This is the recommended setting for new protos.
*/
FeatureSet_VisibilityFeature_DefaultSymbolVisibility[FeatureSet_VisibilityFeature_DefaultSymbolVisibility["STRICT"] = 4] = "STRICT";
})(FeatureSet_VisibilityFeature_DefaultSymbolVisibility || (exports.FeatureSet_VisibilityFeature_DefaultSymbolVisibility = FeatureSet_VisibilityFeature_DefaultSymbolVisibility = {}));
function featureSet_VisibilityFeature_DefaultSymbolVisibilityFromJSON(object) {
switch (object) {
case 0:
case "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN":
return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.DEFAULT_SYMBOL_VISIBILITY_UNKNOWN;
case 1:
case "EXPORT_ALL":
return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.EXPORT_ALL;
case 2:
case "EXPORT_TOP_LEVEL":
return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.EXPORT_TOP_LEVEL;
case 3:
case "LOCAL_ALL":
return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.LOCAL_ALL;
case 4:
case "STRICT":
return FeatureSet_VisibilityFeature_DefaultSymbolVisibility.STRICT;
default:
throw new globalThis.Error("Unrecognized enum value " + object + " for enum FeatureSet_VisibilityFeature_DefaultSymbolVisibility");
}
}
function featureSet_VisibilityFeature_DefaultSymbolVisibilityToJSON(object) {
switch (object) {
case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.DEFAULT_SYMBOL_VISIBILITY_UNKNOWN:
return "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN";
case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.EXPORT_ALL:
return "EXPORT_ALL";
case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.EXPORT_TOP_LEVEL:
return "EXPORT_TOP_LEVEL";
case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.LOCAL_ALL:
return "LOCAL_ALL";
case FeatureSet_VisibilityFeature_DefaultSymbolVisibility.STRICT:
return "STRICT";
default:
throw new globalThis.Error("Unrecognized enum value " + object + " for enum FeatureSet_VisibilityFeature_DefaultSymbolVisibility");
}
}
/**
* Represents the identified object's effect on the element in the original
* .proto file.
@@ -945,6 +1049,9 @@ exports.FileDescriptorProto = {
weakDependency: globalThis.Array.isArray(object?.weakDependency)
? object.weakDependency.map((e) => globalThis.Number(e))
: [],
optionDependency: globalThis.Array.isArray(object?.optionDependency)
? object.optionDependency.map((e) => globalThis.String(e))
: [],
messageType: globalThis.Array.isArray(object?.messageType)
? object.messageType.map((e) => exports.DescriptorProto.fromJSON(e))
: [],
@@ -980,6 +1087,9 @@ exports.FileDescriptorProto = {
if (message.weakDependency?.length) {
obj.weakDependency = message.weakDependency.map((e) => Math.round(e));
}
if (message.optionDependency?.length) {
obj.optionDependency = message.optionDependency;
}
if (message.messageType?.length) {
obj.messageType = message.messageType.map((e) => exports.DescriptorProto.toJSON(e));
}
@@ -1036,6 +1146,7 @@ exports.DescriptorProto = {
reservedName: globalThis.Array.isArray(object?.reservedName)
? object.reservedName.map((e) => globalThis.String(e))
: [],
visibility: isSet(object.visibility) ? symbolVisibilityFromJSON(object.visibility) : 0,
};
},
toJSON(message) {
@@ -1070,6 +1181,9 @@ exports.DescriptorProto = {
if (message.reservedName?.length) {
obj.reservedName = message.reservedName;
}
if (message.visibility !== undefined && message.visibility !== 0) {
obj.visibility = symbolVisibilityToJSON(message.visibility);
}
return obj;
},
};
@@ -1261,6 +1375,7 @@ exports.EnumDescriptorProto = {
reservedName: globalThis.Array.isArray(object?.reservedName)
? object.reservedName.map((e) => globalThis.String(e))
: [],
visibility: isSet(object.visibility) ? symbolVisibilityFromJSON(object.visibility) : 0,
};
},
toJSON(message) {
@@ -1280,6 +1395,9 @@ exports.EnumDescriptorProto = {
if (message.reservedName?.length) {
obj.reservedName = message.reservedName;
}
if (message.visibility !== undefined && message.visibility !== 0) {
obj.visibility = symbolVisibilityToJSON(message.visibility);
}
return obj;
},
};
@@ -1624,6 +1742,7 @@ exports.FieldOptions_FeatureSupport = {
editionDeprecated: isSet(object.editionDeprecated) ? editionFromJSON(object.editionDeprecated) : 0,
deprecationWarning: isSet(object.deprecationWarning) ? globalThis.String(object.deprecationWarning) : "",
editionRemoved: isSet(object.editionRemoved) ? editionFromJSON(object.editionRemoved) : 0,
removalError: isSet(object.removalError) ? globalThis.String(object.removalError) : "",
};
},
toJSON(message) {
@@ -1640,6 +1759,9 @@ exports.FieldOptions_FeatureSupport = {
if (message.editionRemoved !== undefined && message.editionRemoved !== 0) {
obj.editionRemoved = editionToJSON(message.editionRemoved);
}
if (message.removalError !== undefined && message.removalError !== "") {
obj.removalError = message.removalError;
}
return obj;
},
};
@@ -1857,6 +1979,9 @@ exports.FeatureSet = {
enforceNamingStyle: isSet(object.enforceNamingStyle)
? featureSet_EnforceNamingStyleFromJSON(object.enforceNamingStyle)
: 0,
defaultSymbolVisibility: isSet(object.defaultSymbolVisibility)
? featureSet_VisibilityFeature_DefaultSymbolVisibilityFromJSON(object.defaultSymbolVisibility)
: 0,
};
},
toJSON(message) {
@@ -1882,6 +2007,18 @@ exports.FeatureSet = {
if (message.enforceNamingStyle !== undefined && message.enforceNamingStyle !== 0) {
obj.enforceNamingStyle = featureSet_EnforceNamingStyleToJSON(message.enforceNamingStyle);
}
if (message.defaultSymbolVisibility !== undefined && message.defaultSymbolVisibility !== 0) {
obj.defaultSymbolVisibility = featureSet_VisibilityFeature_DefaultSymbolVisibilityToJSON(message.defaultSymbolVisibility);
}
return obj;
},
};
exports.FeatureSet_VisibilityFeature = {
fromJSON(_) {
return {};
},
toJSON(_) {
const obj = {};
return obj;
},
};
@@ -71,8 +71,8 @@
* {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
* seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
* are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
* is required. A proto3 JSON serializer should always use UTC (as indicated by
* "Z") when printing the Timestamp type and a proto3 JSON parser should be
* is required. A ProtoJSON serializer should always use UTC (as indicated by
* "Z") when printing the Timestamp type and a ProtoJSON parser should be
* able to accept both UTC and other timezones (as indicated by an offset).
*
* For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
@@ -91,15 +91,16 @@
*/
export interface Timestamp {
/**
* Represents seconds of UTC time since Unix epoch
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
* 9999-12-31T23:59:59Z inclusive.
* Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must
* be between -62135596800 and 253402300799 inclusive (which corresponds to
* 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z).
*/
seconds: string;
/**
* Non-negative fractions of a second at nanosecond resolution. Negative
* second values with fractions must still have non-negative nanos values
* that count forward in time. Must be from 0 to 999,999,999
* Non-negative fractions of a second at nanosecond resolution. This field is
* the nanosecond portion of the duration, not an alternative to seconds.
* Negative second values with fractions must still have non-negative nanos
* values that count forward in time. Must be between 0 and 999,999,999
* inclusive.
*/
nanos: number;
@@ -1,8 +1,8 @@
"use strict";
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.5
// protoc v6.30.2
// protoc-gen-ts_proto v2.11.5
// protoc v7.34.1
// source: google/protobuf/timestamp.proto
Object.defineProperty(exports, "__esModule", { value: true });
exports.Timestamp = void 0;
+2 -2
View File
@@ -1,8 +1,8 @@
"use strict";
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.5
// protoc v6.30.2
// protoc-gen-ts_proto v2.11.5
// protoc v7.34.1
// source: rekor/v2/dsse.proto
Object.defineProperty(exports, "__esModule", { value: true });
exports.DSSELogEntryV002 = exports.DSSERequestV002 = void 0;
@@ -15,7 +15,7 @@ export interface Entry {
}
/** Spec contains one of the Rekor entry types. */
export interface Spec {
spec?: {
spec: {
$case: "hashedRekordV002";
hashedRekordV002: HashedRekordLogEntryV002;
} | {
@@ -25,7 +25,7 @@ export interface Spec {
}
/** Create a new HashedRekord or DSSE */
export interface CreateEntryRequest {
spec?: {
spec: {
$case: "hashedRekordRequestV002";
hashedRekordRequestV002: HashedRekordRequestV002;
} | {
@@ -1,8 +1,8 @@
"use strict";
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.5
// protoc v6.30.2
// protoc-gen-ts_proto v2.11.5
// protoc v7.34.1
// source: rekor/v2/entry.proto
Object.defineProperty(exports, "__esModule", { value: true });
exports.CreateEntryRequest = exports.Spec = exports.Entry = void 0;
@@ -1,8 +1,8 @@
"use strict";
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.5
// protoc v6.30.2
// protoc-gen-ts_proto v2.11.5
// protoc v7.34.1
// source: rekor/v2/hashedrekord.proto
Object.defineProperty(exports, "__esModule", { value: true });
exports.HashedRekordLogEntryV002 = exports.HashedRekordRequestV002 = void 0;
@@ -6,7 +6,7 @@ export interface PublicKey {
}
/** Either a public key or a X.509 cerificiate with an embedded public key */
export interface Verifier {
verifier?: //
verifier: //
/** DER-encoded public key. Encoding method is specified by the key_details attribute */
{
$case: "publicKey";
@@ -1,8 +1,8 @@
"use strict";
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.5
// protoc v6.30.2
// protoc-gen-ts_proto v2.11.5
// protoc v7.34.1
// source: rekor/v2/verifier.proto
Object.defineProperty(exports, "__esModule", { value: true });
exports.Signature = exports.Verifier = exports.PublicKey = void 0;
@@ -63,7 +63,7 @@ export interface VerificationMaterial {
* When used in a `0.3` bundle with the PGI and "keyless" signing,
* form (3) MUST be used.
*/
content?: {
content: {
$case: "publicKey";
publicKey: PublicKeyIdentifier;
} | {
@@ -112,7 +112,7 @@ export interface Bundle {
* DSSE envelope.
*/
verificationMaterial: VerificationMaterial | undefined;
content?: {
content: {
$case: "messageSignature";
messageSignature: MessageSignature;
} | //
@@ -1,8 +1,8 @@
"use strict";
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.5
// protoc v6.30.2
// protoc-gen-ts_proto v2.11.5
// protoc v7.34.1
// source: sigstore_bundle.proto
Object.defineProperty(exports, "__esModule", { value: true });
exports.Bundle = exports.VerificationMaterial = exports.TimestampVerificationData = void 0;
@@ -12,7 +12,17 @@ export declare enum HashAlgorithm {
SHA2_256 = 1,
SHA2_384 = 2,
SHA2_512 = 3,
/**
* SHA3_256 - Used for LMS
*
* @deprecated
*/
SHA3_256 = 4,
/**
* SHA3_384 - Used for LMS
*
* @deprecated
*/
SHA3_384 = 5
}
export declare function hashAlgorithmFromJSON(object: any): HashAlgorithm;
@@ -88,9 +98,7 @@ export declare enum PublicKeyDetails {
* LMS_SHA256 - LMS and LM-OTS
*
* These algorithms are deprecated and should not be used.
* Keys and signatures MAY be used by private Sigstore
* deployments, but will not be supported by the public
* good instance.
* There are no plans to support SLH-DSA at this time.
*
* USER WARNING: LMS and LM-OTS are both stateful signature schemes.
* Using them correctly requires discretion and careful consideration
@@ -106,20 +114,23 @@ export declare enum PublicKeyDetails {
/** @deprecated */
LMOTS_SHA256 = 15,
/**
* ML_DSA_65 - ML-DSA
* ML_DSA_44 - ML-DSA
*
* These ML_DSA_65 and ML-DSA_87 algorithms are the pure variants that
* take data to sign rather than the prehash variants (HashML-DSA), which
* take digests. While considered quantum-resistant, their usage
* These ML_DSA_44, ML_DSA_65 and ML-DSA_87 algorithms are the pure variants
* that take data to sign rather than the prehash variants (HashML-DSA), which
* take digests. While considered quantum-resistant, their usage
* involves tradeoffs in that signatures and keys are much larger, and
* this makes deployments more costly.
*
* USER WARNING: ML_DSA_65 and ML_DSA_87 are experimental algorithms.
* USER WARNING: ML_DSA_44, ML_DSA_65 and ML_DSA_87 are experimental algorithms.
* In the future they MAY be used by private Sigstore deployments, but
* they are not yet fully functional. This warning will be removed when
* they are not yet fully functional. This warning will be removed when
* these algorithms are widely supported by Sigstore clients and servers,
* but care should still be taken for production environments.
*
* See NIST FIPS 204, RFC 9881 for algorithm identifiers
*/
ML_DSA_44 = 23,
ML_DSA_65 = 21,
ML_DSA_87 = 22
}
@@ -231,7 +242,7 @@ export interface X509Certificate {
}
export interface SubjectAlternativeName {
type: SubjectAlternativeNameType;
identity?: //
identity: //
/**
* A regular expression describing the expected value for
* the SAN.
+27 -11
View File
@@ -1,8 +1,8 @@
"use strict";
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.5
// protoc v6.30.2
// protoc-gen-ts_proto v2.11.5
// protoc v7.34.1
// source: sigstore_common.proto
Object.defineProperty(exports, "__esModule", { value: true });
exports.TimeRange = exports.X509CertificateChain = exports.SubjectAlternativeName = exports.X509Certificate = exports.DistinguishedName = exports.ObjectIdentifierValuePair = exports.ObjectIdentifier = exports.PublicKeyIdentifier = exports.PublicKey = exports.RFC3161SignedTimestamp = exports.LogId = exports.MessageSignature = exports.HashOutput = exports.SubjectAlternativeNameType = exports.PublicKeyDetails = exports.HashAlgorithm = void 0;
@@ -29,7 +29,17 @@ var HashAlgorithm;
HashAlgorithm[HashAlgorithm["SHA2_256"] = 1] = "SHA2_256";
HashAlgorithm[HashAlgorithm["SHA2_384"] = 2] = "SHA2_384";
HashAlgorithm[HashAlgorithm["SHA2_512"] = 3] = "SHA2_512";
/**
* SHA3_256 - Used for LMS
*
* @deprecated
*/
HashAlgorithm[HashAlgorithm["SHA3_256"] = 4] = "SHA3_256";
/**
* SHA3_384 - Used for LMS
*
* @deprecated
*/
HashAlgorithm[HashAlgorithm["SHA3_384"] = 5] = "SHA3_384";
})(HashAlgorithm || (exports.HashAlgorithm = HashAlgorithm = {}));
function hashAlgorithmFromJSON(object) {
@@ -146,9 +156,7 @@ var PublicKeyDetails;
* LMS_SHA256 - LMS and LM-OTS
*
* These algorithms are deprecated and should not be used.
* Keys and signatures MAY be used by private Sigstore
* deployments, but will not be supported by the public
* good instance.
* There are no plans to support SLH-DSA at this time.
*
* USER WARNING: LMS and LM-OTS are both stateful signature schemes.
* Using them correctly requires discretion and careful consideration
@@ -164,20 +172,23 @@ var PublicKeyDetails;
/** @deprecated */
PublicKeyDetails[PublicKeyDetails["LMOTS_SHA256"] = 15] = "LMOTS_SHA256";
/**
* ML_DSA_65 - ML-DSA
* ML_DSA_44 - ML-DSA
*
* These ML_DSA_65 and ML-DSA_87 algorithms are the pure variants that
* take data to sign rather than the prehash variants (HashML-DSA), which
* take digests. While considered quantum-resistant, their usage
* These ML_DSA_44, ML_DSA_65 and ML-DSA_87 algorithms are the pure variants
* that take data to sign rather than the prehash variants (HashML-DSA), which
* take digests. While considered quantum-resistant, their usage
* involves tradeoffs in that signatures and keys are much larger, and
* this makes deployments more costly.
*
* USER WARNING: ML_DSA_65 and ML_DSA_87 are experimental algorithms.
* USER WARNING: ML_DSA_44, ML_DSA_65 and ML_DSA_87 are experimental algorithms.
* In the future they MAY be used by private Sigstore deployments, but
* they are not yet fully functional. This warning will be removed when
* they are not yet fully functional. This warning will be removed when
* these algorithms are widely supported by Sigstore clients and servers,
* but care should still be taken for production environments.
*
* See NIST FIPS 204, RFC 9881 for algorithm identifiers
*/
PublicKeyDetails[PublicKeyDetails["ML_DSA_44"] = 23] = "ML_DSA_44";
PublicKeyDetails[PublicKeyDetails["ML_DSA_65"] = 21] = "ML_DSA_65";
PublicKeyDetails[PublicKeyDetails["ML_DSA_87"] = 22] = "ML_DSA_87";
})(PublicKeyDetails || (exports.PublicKeyDetails = PublicKeyDetails = {}));
@@ -246,6 +257,9 @@ function publicKeyDetailsFromJSON(object) {
case 15:
case "LMOTS_SHA256":
return PublicKeyDetails.LMOTS_SHA256;
case 23:
case "ML_DSA_44":
return PublicKeyDetails.ML_DSA_44;
case 21:
case "ML_DSA_65":
return PublicKeyDetails.ML_DSA_65;
@@ -300,6 +314,8 @@ function publicKeyDetailsToJSON(object) {
return "LMS_SHA256";
case PublicKeyDetails.LMOTS_SHA256:
return "LMOTS_SHA256";
case PublicKeyDetails.ML_DSA_44:
return "ML_DSA_44";
case PublicKeyDetails.ML_DSA_65:
return "ML_DSA_65";
case PublicKeyDetails.ML_DSA_87:
@@ -1,8 +1,8 @@
"use strict";
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.5
// protoc v6.30.2
// protoc-gen-ts_proto v2.11.5
// protoc v7.34.1
// source: sigstore_rekor.proto
Object.defineProperty(exports, "__esModule", { value: true });
exports.TransparencyLogEntry = exports.InclusionPromise = exports.InclusionProof = exports.Checkpoint = exports.KindVersion = void 0;
@@ -167,13 +167,10 @@ export interface CertificateAuthority {
* previously used instance -- otherwise signatures made in the past cannot
* be verified.
*
* All the listed instances SHOULD be sorted by the 'valid_for' in ascending
* order, that is, the oldest instance first. Only the last instance is
* allowed to have their 'end' timestamp unset. All previous instances MUST
* have a closed interval of validity. The last instance MAY have a closed
* interval. Clients MUST accept instances that overlaps in time, if not
* clients may experience problems during rotations of verification
* materials.
* All the listed instances SHOULD be sorted by the 'valid_for.start'
* in ascending order, that is, the oldest instance first. Clients
* MUST accept instances that overlaps in time, if not clients may
* experience problems during rotations of verification materials.
*
* To be able to manage planned rotations of either transparency logs or
* certificate authorities, clienst MUST accept lists of instances where
@@ -1,8 +1,8 @@
"use strict";
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.5
// protoc v6.30.2
// protoc-gen-ts_proto v2.11.5
// protoc v7.34.1
// source: sigstore_trustroot.proto
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClientTrustConfig = exports.ServiceConfiguration = exports.Service = exports.SigningConfig = exports.TrustedRoot = exports.CertificateAuthority = exports.TransparencyLogInstance = exports.ServiceSelector = void 0;
@@ -29,7 +29,7 @@ export interface ArtifactVerificationOptions {
* is an error. If at least one provided identity is found as a
* signer, the verification is considered successful.
*/
signers?: {
signers: {
$case: "certificateIdentities";
certificateIdentities: CertificateIdentities;
} | //
@@ -127,7 +127,7 @@ export interface ArtifactVerificationOptions_ObserverTimestampOptions {
disable: boolean;
}
export interface Artifact {
data?: //
data: //
/** Location of the artifact */
{
$case: "artifactUri";
@@ -1,8 +1,8 @@
"use strict";
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.5
// protoc v6.30.2
// protoc-gen-ts_proto v2.11.5
// protoc v7.34.1
// source: sigstore_verification.proto
Object.defineProperty(exports, "__esModule", { value: true });
exports.Input = exports.Artifact = exports.ArtifactVerificationOptions_ObserverTimestampOptions = exports.ArtifactVerificationOptions_TlogIntegratedTimestampOptions = exports.ArtifactVerificationOptions_TimestampAuthorityOptions = exports.ArtifactVerificationOptions_CtlogOptions = exports.ArtifactVerificationOptions_TlogOptions = exports.ArtifactVerificationOptions = exports.PublicKeyIdentities = exports.CertificateIdentities = exports.CertificateIdentity = void 0;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@sigstore/protobuf-specs",
"version": "0.5.0",
"version": "0.5.1",
"description": "code-signing for npm packages",
"main": "dist/index.js",
"types": "dist/index.d.ts",
+2 -2
View File
@@ -19,15 +19,15 @@ 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 promise_retry_1 = require("@gar/promise-retry");
const http2_1 = require("http2");
const make_fetch_happen_1 = __importDefault(require("make-fetch-happen"));
const proc_log_1 = require("proc-log");
const promise_retry_1 = __importDefault(require("promise-retry"));
const util_1 = require("../util");
const error_1 = require("./error");
const { HTTP2_HEADER_LOCATION, HTTP2_HEADER_CONTENT_TYPE, HTTP2_HEADER_USER_AGENT, HTTP_STATUS_INTERNAL_SERVER_ERROR, HTTP_STATUS_TOO_MANY_REQUESTS, HTTP_STATUS_REQUEST_TIMEOUT, } = http2_1.constants;
async function fetchWithRetry(url, options) {
return (0, promise_retry_1.default)(async (retry, attemptNum) => {
return (0, promise_retry_1.promiseRetry)(async (retry, attemptNum) => {
const method = options.method || 'POST';
const headers = {
[HTTP2_HEADER_USER_AGENT]: util_1.ua.getUserAgent(),
+6 -7
View File
@@ -1,6 +1,6 @@
{
"name": "@sigstore/sign",
"version": "4.1.0",
"version": "4.1.1",
"description": "Sigstore signing library",
"main": "dist/index.js",
"types": "dist/index.d.ts",
@@ -27,18 +27,17 @@
},
"devDependencies": {
"@sigstore/jest": "^0.0.0",
"@sigstore/mock": "^0.11.0",
"@sigstore/mock": "^0.12.0",
"@sigstore/rekor-types": "^4.0.0",
"@types/make-fetch-happen": "^10.0.4",
"@types/promise-retry": "^1.1.6"
"@types/make-fetch-happen": "^10.0.4"
},
"dependencies": {
"@sigstore/bundle": "^4.0.0",
"@sigstore/core": "^3.1.0",
"@sigstore/core": "^3.2.0",
"@sigstore/protobuf-specs": "^0.5.0",
"make-fetch-happen": "^15.0.3",
"make-fetch-happen": "^15.0.4",
"proc-log": "^6.1.0",
"promise-retry": "^2.0.1"
"@gar/promise-retry": "^1.0.2"
},
"engines": {
"node": "^20.17.0 || >=22.9.0"
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@sigstore/tuf",
"version": "4.0.1",
"version": "4.0.2",
"description": "Client for the Sigstore TUF repository",
"main": "dist/index.js",
"types": "dist/index.d.ts",
@@ -28,7 +28,7 @@
},
"devDependencies": {
"@sigstore/jest": "^0.0.0",
"@tufjs/repo-mock": "^4.0.0",
"@tufjs/repo-mock": "^4.0.1",
"@types/make-fetch-happen": "^10.0.4"
},
"dependencies": {
+1 -1
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -3,3 +3,4 @@ export { PolicyError, VerificationError } from './error';
export { KeyFinderFunc, TrustMaterial, toTrustMaterial } from './trust';
export { Verifier, VerifierOptions } from './verifier';
export type { SignedEntity, Signer, VerificationPolicy } from './shared.types';
export type { ObjectIdentifierValuePair } from '@sigstore/protobuf-specs';
+8
View File
@@ -56,9 +56,17 @@ function getSigner(cert) {
else {
issuer = cert.extension(OID_FULCIO_ISSUER_V1)?.value.toString('ascii');
}
const oids = cert.extensions.map((ext) => {
const oid = ext.subs[0].toOID();
return {
oid: { id: oid.split('.').map(Number) },
value: ext.subs[ext.subs.length - 1].value,
};
});
const identity = {
extensions: { issuer },
subjectAlternativeName: cert.subjectAltName,
oids,
};
return {
key: core_1.crypto.createPublicKey(cert.publicKey),
+2
View File
@@ -1,3 +1,5 @@
import { CertificateExtensions } from './shared.types';
import type { ObjectIdentifierValuePair } from '@sigstore/protobuf-specs';
export declare function verifySubjectAlternativeName(policyIdentity: string, signerIdentity: string | undefined): void;
export declare function verifyExtensions(policyExtensions: CertificateExtensions, signerExtensions?: CertificateExtensions): void;
export declare function verifyOIDs(policyOIDs: ObjectIdentifierValuePair[], signerOIDs?: ObjectIdentifierValuePair[]): void;
+26
View File
@@ -2,7 +2,12 @@
Object.defineProperty(exports, "__esModule", { value: true });
exports.verifySubjectAlternativeName = verifySubjectAlternativeName;
exports.verifyExtensions = verifyExtensions;
exports.verifyOIDs = verifyOIDs;
const error_1 = require("./error");
// Verifies that the signer's SAN matches the policy identity. The
// policyIdentity is treated as a JavaScript regular expression pattern and
// tested against the full signerIdentity string. For exact matching, use
// anchored patterns (e.g. '^user@example\\.com$').
function verifySubjectAlternativeName(policyIdentity, signerIdentity) {
if (signerIdentity === undefined || !signerIdentity.match(policyIdentity)) {
throw new error_1.PolicyError({
@@ -22,3 +27,24 @@ function verifyExtensions(policyExtensions, signerExtensions = {}) {
}
}
}
function verifyOIDs(policyOIDs, signerOIDs = []) {
for (const policyOID of policyOIDs) {
const match = signerOIDs.find((signerOID) => oidEquals(policyOID.oid?.id, signerOID.oid?.id) &&
policyOID.value.equals(signerOID.value));
if (!match) {
/* istanbul ignore next */
const oid = policyOID.oid?.id.join('.') ?? '<unknown>';
throw new error_1.PolicyError({
code: 'UNTRUSTED_SIGNER_ERROR',
message: `invalid certificate extension - missing OID ${oid}`,
});
}
}
}
function oidEquals(a, b) {
/* istanbul ignore if */
if (a === undefined || b === undefined) {
return false;
}
return a.length === b.length && a.every((v, i) => v === b[i]);
}
+2
View File
@@ -1,5 +1,6 @@
import type { TransparencyLogEntry } from '@sigstore/bundle';
import type { RFC3161Timestamp, X509Certificate, crypto } from '@sigstore/core';
import type { ObjectIdentifierValuePair } from '@sigstore/protobuf-specs';
export type CertificateExtensionName = 'issuer';
export type CertificateExtensions = {
[key in CertificateExtensionName]?: string;
@@ -7,6 +8,7 @@ export type CertificateExtensions = {
export type CertificateIdentity = {
subjectAlternativeName?: string;
extensions?: CertificateExtensions;
oids?: ObjectIdentifierValuePair[];
};
export type VerificationPolicy = CertificateIdentity;
export type Signer = {
+1 -1
View File
@@ -8,4 +8,4 @@ export type TimestampVerificationResult = {
timestamp: Date;
};
export declare function getTSATimestamp(timestamp: RFC3161Timestamp, data: Buffer, timestampAuthorities: CertAuthority[]): TimestampVerificationResult;
export declare function getTLogTimestamp(entry: TransparencyLogEntry): TimestampVerificationResult;
export declare function getTLogTimestamp(entry: TransparencyLogEntry): TimestampVerificationResult | undefined;
+4
View File
@@ -12,6 +12,10 @@ function getTSATimestamp(timestamp, data, timestampAuthorities) {
};
}
function getTLogTimestamp(entry) {
// Only entries with an inclusion promise provide a verifiable timestamp
if (!entry.inclusionPromise) {
return undefined;
}
return {
type: 'transparency-log',
logID: entry.logId.keyId,
+20 -10
View File
@@ -46,17 +46,22 @@ class Verifier {
}
// Checks that all of the timestamps in the entity are valid and returns them
verifyTimestamps(entity) {
let timestampCount = 0;
const timestamps = entity.timestamps.map((timestamp) => {
const timestamps = [];
for (const timestamp of entity.timestamps) {
switch (timestamp.$case) {
case 'timestamp-authority':
timestampCount++;
return (0, timestamp_1.getTSATimestamp)(timestamp.timestamp, entity.signature.signature, this.trustMaterial.timestampAuthorities);
case 'transparency-log':
timestampCount++;
return (0, timestamp_1.getTLogTimestamp)(timestamp.tlogEntry);
timestamps.push((0, timestamp_1.getTSATimestamp)(timestamp.timestamp, entity.signature.signature, this.trustMaterial.timestampAuthorities));
break;
case 'transparency-log': {
const result = (0, timestamp_1.getTLogTimestamp)(timestamp.tlogEntry);
/* istanbul ignore else */
if (result) {
timestamps.push(result);
}
break;
}
}
});
}
// Check for duplicate timestamps
if (containsDupes(timestamps)) {
throw new error_1.VerificationError({
@@ -64,10 +69,10 @@ class Verifier {
message: 'duplicate timestamp',
});
}
if (timestampCount < this.options.timestampThreshold) {
if (timestamps.length < this.options.timestampThreshold) {
throw new error_1.VerificationError({
code: 'TIMESTAMP_ERROR',
message: `expected ${this.options.timestampThreshold} timestamps, got ${timestampCount}`,
message: `expected ${this.options.timestampThreshold} timestamps, got ${timestamps.length}`,
});
}
return timestamps.map((t) => t.timestamp);
@@ -133,6 +138,11 @@ class Verifier {
if (policy.extensions) {
(0, policy_1.verifyExtensions)(policy.extensions, identity.extensions);
}
// Check that the OIDs of the signer match the policy
/* istanbul ignore if */
if (policy.oids) {
(0, policy_1.verifyOIDs)(policy.oids, identity.oids);
}
}
}
exports.Verifier = Verifier;
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@sigstore/verify",
"version": "3.1.0",
"version": "3.1.1",
"description": "Verification of Sigstore signatures",
"main": "dist/index.js",
"types": "dist/index.d.ts",
@@ -28,7 +28,7 @@
"dependencies": {
"@sigstore/protobuf-specs": "^0.5.0",
"@sigstore/bundle": "^4.0.0",
"@sigstore/core": "^3.1.0"
"@sigstore/core": "^3.2.1"
},
"engines": {
"node": "^20.17.0 || >=22.9.0"