@charter-agreement-protocol/verifier 0.5.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/CHANGELOG.md +261 -0
- package/README.md +100 -11
- package/SECURITY.md +89 -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 +75 -15
- package/dist/core.js +1734 -507
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +9 -6
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;
|
|
@@ -95,7 +95,29 @@ type Result<T> = {
|
|
|
95
95
|
};
|
|
96
96
|
type AnyRecord = Record<string, any>;
|
|
97
97
|
export declare function canonical(value: CanonicalValue): string;
|
|
98
|
-
export declare function decodeJsonText(text: string): Result<CanonicalValue>;
|
|
98
|
+
export declare function decodeJsonText(text: string, selected?: Partial<Limits>): Result<CanonicalValue>;
|
|
99
|
+
export type Limits = {
|
|
100
|
+
max_bytes: number;
|
|
101
|
+
max_depth: number;
|
|
102
|
+
max_object_members: number;
|
|
103
|
+
max_array_items: number;
|
|
104
|
+
max_string_bytes: number;
|
|
105
|
+
max_artifact_set_items: number;
|
|
106
|
+
max_artifact_set_bytes: number;
|
|
107
|
+
};
|
|
108
|
+
export type Profile = {
|
|
109
|
+
algorithms?: string[];
|
|
110
|
+
revisions?: {
|
|
111
|
+
min: number;
|
|
112
|
+
max: number;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
export type VerificationOptions = {
|
|
116
|
+
limits?: Partial<Limits>;
|
|
117
|
+
profile?: Profile;
|
|
118
|
+
};
|
|
119
|
+
export declare const DEFAULT_LIMITS: Readonly<Limits>;
|
|
120
|
+
export declare const MAXIMUM_LIMITS: Readonly<Limits>;
|
|
99
121
|
export declare function jsonProjection(value: any): Projection;
|
|
100
122
|
export declare function capabilities(): {
|
|
101
123
|
linkedCrypto: string;
|
|
@@ -129,30 +151,33 @@ export declare function encodeBase64url(bytes: Buffer): string;
|
|
|
129
151
|
export declare function taggedDigest(domain: string, bytes: Buffer): string;
|
|
130
152
|
export declare function defaultEmissionName(): string;
|
|
131
153
|
export declare function decodeArtifact(compact: string): VerifyResult;
|
|
132
|
-
export declare function verifySignature(message:
|
|
133
|
-
export
|
|
134
|
-
digest
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
export declare function
|
|
140
|
-
export declare function
|
|
141
|
-
export declare function
|
|
154
|
+
export declare function verifySignature(message: Uint8Array, signature: Uint8Array, publicKeyBase64url: string, alg: string, options?: VerificationOptions): boolean;
|
|
155
|
+
export type DescriptorPredecessor = {
|
|
156
|
+
digest?: string;
|
|
157
|
+
descriptor_digest?: string;
|
|
158
|
+
claims?: AnyRecord | null;
|
|
159
|
+
lineage?: string[];
|
|
160
|
+
};
|
|
161
|
+
export declare function verifyDescriptor(compact: string, predecessor?: DescriptorPredecessor | null, options?: VerificationOptions): VerifyResult;
|
|
162
|
+
export declare function verifyDescriptorChain(compacts: string[], options?: VerificationOptions): VerifyResult;
|
|
163
|
+
export declare function verifyAcceptance(compact: string, revisionText: string, descriptorCompacts: string[], options?: VerificationOptions): VerifyResult;
|
|
164
|
+
export declare function verifyTermination(compact: string, revisionText: string, descriptorCompacts: string[], options?: VerificationOptions): VerifyResult;
|
|
165
|
+
export declare function verifyChain(chainInput: AnyRecord, options?: VerificationOptions): VerifyResult;
|
|
166
|
+
export declare function verifyReceipt(compact: string, context: AnyRecord | string, options?: VerificationOptions): VerifyResult;
|
|
142
167
|
export declare function checkSigningClaims(kind: "descriptor" | "acceptance" | "termination" | "receipt", claims: AnyRecord): {
|
|
143
168
|
ok: true;
|
|
144
169
|
} | {
|
|
145
170
|
ok: false;
|
|
146
171
|
code: string;
|
|
147
172
|
};
|
|
148
|
-
export declare function governingRevision(chainInput: AnyRecord, at: string): {
|
|
173
|
+
export declare function governingRevision(chainInput: AnyRecord, at: string, options?: VerificationOptions): {
|
|
149
174
|
ok: true;
|
|
150
175
|
governing: string;
|
|
151
176
|
} | {
|
|
152
177
|
ok: false;
|
|
153
178
|
code: string;
|
|
154
179
|
};
|
|
155
|
-
export declare function decodeCharterRevision(text: unknown): {
|
|
180
|
+
export declare function decodeCharterRevision(text: unknown, options?: VerificationOptions): {
|
|
156
181
|
ok: true;
|
|
157
182
|
revision: AnyRecord;
|
|
158
183
|
digest: string;
|
|
@@ -160,7 +185,7 @@ export declare function decodeCharterRevision(text: unknown): {
|
|
|
160
185
|
ok: false;
|
|
161
186
|
code: string;
|
|
162
187
|
};
|
|
163
|
-
export declare function revisionDigest(text: unknown): {
|
|
188
|
+
export declare function revisionDigest(text: unknown, options?: VerificationOptions): {
|
|
164
189
|
ok: true;
|
|
165
190
|
digest: string;
|
|
166
191
|
} | {
|
|
@@ -182,6 +207,41 @@ export declare function descriptorDigest(compact: unknown): {
|
|
|
182
207
|
ok: false;
|
|
183
208
|
code: string;
|
|
184
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;
|
|
185
245
|
export type SigningInput = {
|
|
186
246
|
alg: string;
|
|
187
247
|
protectedSegment: string;
|