@charter-agreement-protocol/verifier 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const CERTIFIED_INDEX_SHA256_BASE64URL = "n2Se2on9kG3cdeFMiy9OW9lKalvM_02Fmdw-XbYe-A4";
1
+ export declare const CERTIFIED_INDEX_SHA256_BASE64URL = "xiyty9a_VZTgiIYIKqGZQIAhJB-OQZRIcOX_zyNV-VQ";
2
2
  export declare const CERTIFIED_REGISTRY_DIGEST = "sha-256:u754joyHGcLCTm1LYV2s6eHauUUdDfJDwwyhbAbxvzc";
3
3
  export type CanonicalValue = null | boolean | number | string | CanonicalValue[] | {
4
4
  [key: string]: CanonicalValue;
@@ -151,7 +151,7 @@ export declare function encodeBase64url(bytes: Buffer): string;
151
151
  export declare function taggedDigest(domain: string, bytes: Buffer): string;
152
152
  export declare function defaultEmissionName(): string;
153
153
  export declare function decodeArtifact(compact: string): VerifyResult;
154
- export declare function verifySignature(message: Buffer, signature: Buffer, publicKeyBase64url: string, alg: string, options?: VerificationOptions): boolean;
154
+ export declare function verifySignature(message: Uint8Array, signature: Uint8Array, publicKeyBase64url: string, alg: string, options?: VerificationOptions): boolean;
155
155
  export type DescriptorPredecessor = {
156
156
  digest?: string;
157
157
  descriptor_digest?: string;
@@ -207,6 +207,41 @@ export declare function descriptorDigest(compact: unknown): {
207
207
  ok: false;
208
208
  code: string;
209
209
  };
210
+ export type SigningKind = "descriptor" | "acceptance" | "termination" | "receipt";
211
+ export type ChainInput = {
212
+ revisions: string[];
213
+ acceptances: string[];
214
+ descriptors: string[];
215
+ terminations: string[];
216
+ };
217
+ export type SigningOptions = VerificationOptions & {
218
+ algorithm?: string;
219
+ };
220
+ type FinishResult = {
221
+ ok: true;
222
+ compact: string;
223
+ } | {
224
+ ok: false;
225
+ code: string;
226
+ };
227
+ /** A prepared input with retained verification context and settings. */
228
+ export declare class SigningPlan {
229
+ #private;
230
+ readonly kind: SigningKind;
231
+ readonly key: "matched" | "unnamed";
232
+ private constructor();
233
+ get input(): SigningInput;
234
+ }
235
+ /** Check everything that can be checked before producing a signature. */
236
+ export declare function prepareSigning(kind: SigningKind, kid: string, claims: AnyRecord, publicKey: string, context: DescriptorPredecessor | null | ChainInput | string, options?: SigningOptions): {
237
+ ok: true;
238
+ plan: SigningPlan;
239
+ } | {
240
+ ok: false;
241
+ code: string;
242
+ };
243
+ /** Assemble under the retained limits and run public verification. */
244
+ export declare function finishSigning(plan: SigningPlan, signature: Uint8Array): FinishResult;
210
245
  export type SigningInput = {
211
246
  alg: string;
212
247
  protectedSegment: string;