@charter-agreement-protocol/verifier 0.6.0 → 1.0.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/CHANGELOG.md +117 -1
- package/README.md +127 -19
- package/SECURITY.md +90 -0
- package/conformance/cases/acceptance-equivocation.json +1 -1
- package/conformance/cases/acceptance-verify.json +1 -1
- package/conformance/cases/base64url-decode.json +1 -1
- package/conformance/cases/canonicalization-encode.json +1 -1
- package/conformance/cases/chain-verify.json +1 -1
- package/conformance/cases/chain-verify_profile.json +1 -1
- package/conformance/cases/charter_revision-decode.json +1 -1
- package/conformance/cases/descriptor_chain-verify.json +1 -1
- package/conformance/cases/digest-hash.json +1 -1
- package/conformance/cases/governing_revision.json +1 -1
- package/conformance/cases/json-decode.json +1 -1
- package/conformance/cases/party_descriptor-verify.json +1 -1
- package/conformance/cases/receipt-verify.json +1 -1
- package/conformance/cases/schema-validate.json +1 -1
- package/conformance/cases/signing-prepare.json +1 -0
- package/conformance/cases/termination-verify.json +1 -1
- package/conformance/index.json +1 -1
- package/dist/cli.js +1 -1
- package/dist/core.d.ts +37 -2
- package/dist/core.js +1014 -229
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +15 -8
- package/reference.json +7 -0
package/dist/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const CERTIFIED_INDEX_SHA256_BASE64URL = "
|
|
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:
|
|
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;
|