From 45903bc34b0b941ab6287270807d1fa78199451d Mon Sep 17 00:00:00 2001 From: Brian DeHamer Date: Thu, 4 Jan 2024 09:46:37 -0800 Subject: [PATCH] expose signature on SignatureContent (#922) Signed-off-by: Brian DeHamer --- .changeset/shaggy-hotels-cheat.md | 5 +++++ packages/verify/src/bundle/dsse.ts | 2 +- packages/verify/src/bundle/message.ts | 2 +- packages/verify/src/shared.types.ts | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changeset/shaggy-hotels-cheat.md diff --git a/.changeset/shaggy-hotels-cheat.md b/.changeset/shaggy-hotels-cheat.md new file mode 100644 index 00000000..78fcd626 --- /dev/null +++ b/.changeset/shaggy-hotels-cheat.md @@ -0,0 +1,5 @@ +--- +"@sigstore/verify": patch +--- + +Expose public `signature` property on `SignatureContent` interface diff --git a/packages/verify/src/bundle/dsse.ts b/packages/verify/src/bundle/dsse.ts index 06d980ba..4592dde3 100644 --- a/packages/verify/src/bundle/dsse.ts +++ b/packages/verify/src/bundle/dsse.ts @@ -37,7 +37,7 @@ export class DSSESignatureContent implements SignatureContent { return crypto.verify(this.preAuthEncoding, key, this.signature); } - private get signature(): Buffer { + public get signature(): Buffer { return this.env.signatures.length > 0 ? this.env.signatures[0].sig : Buffer.from(''); diff --git a/packages/verify/src/bundle/message.ts b/packages/verify/src/bundle/message.ts index b2b49bf8..7deb61e5 100644 --- a/packages/verify/src/bundle/message.ts +++ b/packages/verify/src/bundle/message.ts @@ -19,7 +19,7 @@ import type { MessageSignature } from '@sigstore/bundle'; import type { SignatureContent } from '../shared.types'; export class MessageSignatureContent implements SignatureContent { - private readonly signature: Buffer; + public readonly signature: Buffer; private readonly messageDigest: Buffer; private readonly artifact: Buffer; diff --git a/packages/verify/src/shared.types.ts b/packages/verify/src/shared.types.ts index 2bb4e605..77b067d1 100644 --- a/packages/verify/src/shared.types.ts +++ b/packages/verify/src/shared.types.ts @@ -57,6 +57,7 @@ export type VerificationKey = }; export type SignatureContent = { + signature: Buffer; compareSignature(signature: Buffer): boolean; compareDigest(digest: Buffer): boolean; verifySignature(key: crypto.KeyObject): boolean;