@vouch-protocol-official/core-wasm 2.1.0 → 2.2.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/package.json +1 -1
- package/vouch_core_wasm.d.ts +96 -0
- package/vouch_core_wasm.js +555 -0
- package/vouch_core_wasm_bg.wasm +0 -0
- package/vouch_core_wasm_bg.wasm.d.ts +14 -0
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"Ramprasad Anandam Gaddam"
|
|
6
6
|
],
|
|
7
7
|
"description": "Vouch Protocol canonical core (WASM): JCS canonicalization, Ed25519, did:key/multikey, Data Integrity (eddsa-jcs-2022), credentials, delegation, dual-proof ML-DSA-44, and BitstringStatusList revocation. One byte-exact Rust implementation shared across every Vouch SDK.",
|
|
8
|
-
"version": "2.
|
|
8
|
+
"version": "2.2.0",
|
|
9
9
|
"license": "Apache-2.0",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
package/vouch_core_wasm.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Build an unsigned AuthorityState credential. Pass null/undefined for the
|
|
6
|
+
* optional subjectDid, which defaults to the issuer. Returns the credential as
|
|
7
|
+
* a JSON string.
|
|
8
|
+
*/
|
|
9
|
+
export function buildAuthorityState(issuer_did: string, credential_id: string, authority_epoch: number, status: string, valid_from: string, valid_until: string, subject_did?: string | null): string;
|
|
10
|
+
|
|
4
11
|
/**
|
|
5
12
|
* Build a delegation link. Pass null/undefined for the optional validFrom,
|
|
6
13
|
* validUntil, parentProofValue. Returns the link as a JSON string.
|
|
@@ -26,6 +33,13 @@ export function ed25519Verify(public_b64: string, message_b64: string, signature
|
|
|
26
33
|
|
|
27
34
|
export function encodeEd25519Multikey(public_b64: string): string;
|
|
28
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Evaluate the Authority Freshness gate for an action. Pass null/undefined for
|
|
38
|
+
* an unknown epoch, an unknown status, or an unevaluated live co-sign. Returns
|
|
39
|
+
* {allow, tier, reason}, where reason is the shared cross-language reason code.
|
|
40
|
+
*/
|
|
41
|
+
export function evaluateAuthorityFreshness(tier: string, voucher_epoch?: number | null, last_seen_epoch?: number | null, current_status?: string | null, live_cosign_ok?: boolean | null): string;
|
|
42
|
+
|
|
29
43
|
/**
|
|
30
44
|
* Generate an Ed25519 key pair. Returns {seed_b64, public_b64, multikey, did_key}.
|
|
31
45
|
*/
|
|
@@ -40,6 +54,63 @@ export function mldsa44Sign(secret_b64: string, public_b64: string, message_b64:
|
|
|
40
54
|
|
|
41
55
|
export function mldsa44Verify(public_b64: string, message_b64: string, signature_b64: string): boolean;
|
|
42
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Read credentialSubject.authorityEpoch without verifying the proof.
|
|
59
|
+
*/
|
|
60
|
+
export function readAuthorityEpoch(credential_json: string): number;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Read credentialSubject.status without verifying the proof.
|
|
64
|
+
*/
|
|
65
|
+
export function readAuthorityStatus(credential_json: string): string;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Multibase SHA-256 of an evidence artifact (JSON object or string).
|
|
69
|
+
*/
|
|
70
|
+
export function reasoningArtifactDigest(artifact_json: string): string;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Build a justification from an intent object, an anchors array, and an optional
|
|
74
|
+
* commitment level. Returns the justification as a JSON string.
|
|
75
|
+
*/
|
|
76
|
+
export function reasoningBuildJustification(intent_json: string, anchors_json: string, commitment_level?: number | null): string;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Verify a ReasonedActionCredential. Returns null on success, else the stable
|
|
80
|
+
* reason string. Pass null for escrow_public_b64 when no escrow is required.
|
|
81
|
+
*/
|
|
82
|
+
export function reasoningCheckReasonedAction(credential_json: string, public_b64: string, escrow_public_b64: string | null | undefined, require_escrow: boolean): string | undefined;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Multibase SHA-256 over the JCS-canonical justification.
|
|
86
|
+
*/
|
|
87
|
+
export function reasoningJustificationDigest(justification_json: string): string;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Classify an execution time against the pulse schedule. Returns
|
|
91
|
+
* {in_window, in_gap, seconds_into_window} as a JSON string.
|
|
92
|
+
*/
|
|
93
|
+
export function reasoningPulseWindow(last_pulse: string, interval_seconds: number, exec_time: string): string;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Execution-time reseal: seal the intent at `now` and issue a fresh
|
|
97
|
+
* ReasonedActionCredential whose sealedAt and validFrom are both `now`.
|
|
98
|
+
*/
|
|
99
|
+
export function reasoningResealIntent(seed_b64: string, issuer_did: string, verification_method: string, intent_json: string, anchors_json: string, commitment_level: number | null | undefined, now: string, credential_id: string, include_reasoning: boolean): string;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Sign a ReasonedActionCredential. Pass null for the optional sealed_at and
|
|
103
|
+
* escrow_receipt_json. Returns the signed credential as a JSON string.
|
|
104
|
+
*/
|
|
105
|
+
export function reasoningSignReasonedAction(seed_b64: string, issuer_did: string, verification_method: string, intent_json: string, justification_json: string, valid_from: string, credential_id: string, include_reasoning: boolean, sealed_at?: string | null, escrow_receipt_json?: string | null): string;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Verify intent freshness for a credential at a consequence tier, using the
|
|
109
|
+
* reference tier policy. Returns null when accepted, else the stable reason
|
|
110
|
+
* string (e.g. "intent_seal_stale:...").
|
|
111
|
+
*/
|
|
112
|
+
export function reasoningVerifyIntentFreshness(credential_json: string, tier: number, last_pulse: string): string | undefined;
|
|
113
|
+
|
|
43
114
|
export function roboticsAttachStatus(credential_json: string, signer_seed_b64: string, params_json: string): string;
|
|
44
115
|
|
|
45
116
|
export function roboticsAttenuateForWear(params_json: string): string;
|
|
@@ -239,6 +310,11 @@ export function roboticsVerifyWearChain(params_json: string, public_b64: string)
|
|
|
239
310
|
|
|
240
311
|
export function sign(credential_json: string, seed_b64: string, verification_method: string, created: string): string;
|
|
241
312
|
|
|
313
|
+
/**
|
|
314
|
+
* Build and sign an AuthorityState credential in one step (eddsa-jcs-2022).
|
|
315
|
+
*/
|
|
316
|
+
export function signAuthorityState(issuer_did: string, credential_id: string, authority_epoch: number, status: string, valid_from: string, valid_until: string, subject_did: string | null | undefined, seed_b64: string, verification_method: string, created: string): string;
|
|
317
|
+
|
|
242
318
|
/**
|
|
243
319
|
* Build a dual proof (Ed25519 + ML-DSA-44) and attach it to the credential.
|
|
244
320
|
*/
|
|
@@ -283,6 +359,12 @@ export function validateDelegationChain(request_json: string): string;
|
|
|
283
359
|
|
|
284
360
|
export function verify(credential_json: string, public_b64: string, now_iso: string, clock_skew_seconds: number): string;
|
|
285
361
|
|
|
362
|
+
/**
|
|
363
|
+
* Verify an AuthorityState credential's proof and validity window.
|
|
364
|
+
* Returns {proofValid, timeValid, valid}.
|
|
365
|
+
*/
|
|
366
|
+
export function verifyAuthorityState(credential_json: string, public_b64: string, now_iso: string, clock_skew_seconds: number): string;
|
|
367
|
+
|
|
286
368
|
/**
|
|
287
369
|
* Validate the time-bound rule over a delegation chain (JSON array of links).
|
|
288
370
|
*/
|
|
@@ -305,6 +387,7 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
305
387
|
|
|
306
388
|
export interface InitOutput {
|
|
307
389
|
readonly memory: WebAssembly.Memory;
|
|
390
|
+
readonly buildAuthorityState: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number) => void;
|
|
308
391
|
readonly buildDelegationLink: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
|
|
309
392
|
readonly buildProof: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
310
393
|
readonly canonicalize: (a: number, b: number, c: number) => void;
|
|
@@ -314,10 +397,21 @@ export interface InitOutput {
|
|
|
314
397
|
readonly ed25519Sign: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
315
398
|
readonly ed25519Verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
316
399
|
readonly encodeEd25519Multikey: (a: number, b: number, c: number) => void;
|
|
400
|
+
readonly evaluateAuthorityFreshness: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
317
401
|
readonly generateEd25519: (a: number) => void;
|
|
318
402
|
readonly generateMldsa44: (a: number) => void;
|
|
319
403
|
readonly mldsa44Sign: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
320
404
|
readonly mldsa44Verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
405
|
+
readonly readAuthorityEpoch: (a: number, b: number, c: number) => void;
|
|
406
|
+
readonly readAuthorityStatus: (a: number, b: number, c: number) => void;
|
|
407
|
+
readonly reasoningArtifactDigest: (a: number, b: number, c: number) => void;
|
|
408
|
+
readonly reasoningBuildJustification: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
409
|
+
readonly reasoningCheckReasonedAction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
410
|
+
readonly reasoningJustificationDigest: (a: number, b: number, c: number) => void;
|
|
411
|
+
readonly reasoningPulseWindow: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
412
|
+
readonly reasoningResealIntent: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number) => void;
|
|
413
|
+
readonly reasoningSignReasonedAction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number) => void;
|
|
414
|
+
readonly reasoningVerifyIntentFreshness: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
321
415
|
readonly roboticsAttachStatus: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
322
416
|
readonly roboticsAttenuateForWear: (a: number, b: number, c: number) => void;
|
|
323
417
|
readonly roboticsAttenuates: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
@@ -413,6 +507,7 @@ export interface InitOutput {
|
|
|
413
507
|
readonly roboticsVerifyWearAttestation: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
414
508
|
readonly roboticsVerifyWearChain: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
415
509
|
readonly sign: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
510
|
+
readonly signAuthorityState: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number) => void;
|
|
416
511
|
readonly signDual: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number) => void;
|
|
417
512
|
readonly thresholdAggregate: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
418
513
|
readonly thresholdCommit: (a: number, b: number, c: number) => void;
|
|
@@ -420,6 +515,7 @@ export interface InitOutput {
|
|
|
420
515
|
readonly thresholdSignShare: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
421
516
|
readonly validateDelegationChain: (a: number, b: number, c: number) => void;
|
|
422
517
|
readonly verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
518
|
+
readonly verifyAuthorityState: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
423
519
|
readonly verifyChainTimeBound: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
424
520
|
readonly verifyComposite: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
425
521
|
readonly verifyDual: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
package/vouch_core_wasm.js
CHANGED
|
@@ -1,5 +1,55 @@
|
|
|
1
1
|
/* @ts-self-types="./vouch_core_wasm.d.ts" */
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Build an unsigned AuthorityState credential. Pass null/undefined for the
|
|
5
|
+
* optional subjectDid, which defaults to the issuer. Returns the credential as
|
|
6
|
+
* a JSON string.
|
|
7
|
+
* @param {string} issuer_did
|
|
8
|
+
* @param {string} credential_id
|
|
9
|
+
* @param {number} authority_epoch
|
|
10
|
+
* @param {string} status
|
|
11
|
+
* @param {string} valid_from
|
|
12
|
+
* @param {string} valid_until
|
|
13
|
+
* @param {string | null} [subject_did]
|
|
14
|
+
* @returns {string}
|
|
15
|
+
*/
|
|
16
|
+
export function buildAuthorityState(issuer_did, credential_id, authority_epoch, status, valid_from, valid_until, subject_did) {
|
|
17
|
+
let deferred8_0;
|
|
18
|
+
let deferred8_1;
|
|
19
|
+
try {
|
|
20
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
21
|
+
const ptr0 = passStringToWasm0(issuer_did, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
22
|
+
const len0 = WASM_VECTOR_LEN;
|
|
23
|
+
const ptr1 = passStringToWasm0(credential_id, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
24
|
+
const len1 = WASM_VECTOR_LEN;
|
|
25
|
+
const ptr2 = passStringToWasm0(status, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
26
|
+
const len2 = WASM_VECTOR_LEN;
|
|
27
|
+
const ptr3 = passStringToWasm0(valid_from, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
28
|
+
const len3 = WASM_VECTOR_LEN;
|
|
29
|
+
const ptr4 = passStringToWasm0(valid_until, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
30
|
+
const len4 = WASM_VECTOR_LEN;
|
|
31
|
+
var ptr5 = isLikeNone(subject_did) ? 0 : passStringToWasm0(subject_did, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
32
|
+
var len5 = WASM_VECTOR_LEN;
|
|
33
|
+
wasm.buildAuthorityState(retptr, ptr0, len0, ptr1, len1, authority_epoch, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5);
|
|
34
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
35
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
36
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
37
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
38
|
+
var ptr7 = r0;
|
|
39
|
+
var len7 = r1;
|
|
40
|
+
if (r3) {
|
|
41
|
+
ptr7 = 0; len7 = 0;
|
|
42
|
+
throw takeObject(r2);
|
|
43
|
+
}
|
|
44
|
+
deferred8_0 = ptr7;
|
|
45
|
+
deferred8_1 = len7;
|
|
46
|
+
return getStringFromWasm0(ptr7, len7);
|
|
47
|
+
} finally {
|
|
48
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
49
|
+
wasm.__wbindgen_export4(deferred8_0, deferred8_1, 1);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
3
53
|
/**
|
|
4
54
|
* Build a delegation link. Pass null/undefined for the optional validFrom,
|
|
5
55
|
* validUntil, parentProofValue. Returns the link as a JSON string.
|
|
@@ -306,6 +356,38 @@ export function encodeEd25519Multikey(public_b64) {
|
|
|
306
356
|
}
|
|
307
357
|
}
|
|
308
358
|
|
|
359
|
+
/**
|
|
360
|
+
* Evaluate the Authority Freshness gate for an action. Pass null/undefined for
|
|
361
|
+
* an unknown epoch, an unknown status, or an unevaluated live co-sign. Returns
|
|
362
|
+
* {allow, tier, reason}, where reason is the shared cross-language reason code.
|
|
363
|
+
* @param {string} tier
|
|
364
|
+
* @param {number | null} [voucher_epoch]
|
|
365
|
+
* @param {number | null} [last_seen_epoch]
|
|
366
|
+
* @param {string | null} [current_status]
|
|
367
|
+
* @param {boolean | null} [live_cosign_ok]
|
|
368
|
+
* @returns {string}
|
|
369
|
+
*/
|
|
370
|
+
export function evaluateAuthorityFreshness(tier, voucher_epoch, last_seen_epoch, current_status, live_cosign_ok) {
|
|
371
|
+
let deferred3_0;
|
|
372
|
+
let deferred3_1;
|
|
373
|
+
try {
|
|
374
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
375
|
+
const ptr0 = passStringToWasm0(tier, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
376
|
+
const len0 = WASM_VECTOR_LEN;
|
|
377
|
+
var ptr1 = isLikeNone(current_status) ? 0 : passStringToWasm0(current_status, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
378
|
+
var len1 = WASM_VECTOR_LEN;
|
|
379
|
+
wasm.evaluateAuthorityFreshness(retptr, ptr0, len0, isLikeNone(voucher_epoch) ? Number.MAX_SAFE_INTEGER : (voucher_epoch) >> 0, isLikeNone(last_seen_epoch) ? Number.MAX_SAFE_INTEGER : (last_seen_epoch) >> 0, ptr1, len1, isLikeNone(live_cosign_ok) ? 0xFFFFFF : live_cosign_ok ? 1 : 0);
|
|
380
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
381
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
382
|
+
deferred3_0 = r0;
|
|
383
|
+
deferred3_1 = r1;
|
|
384
|
+
return getStringFromWasm0(r0, r1);
|
|
385
|
+
} finally {
|
|
386
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
387
|
+
wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
309
391
|
/**
|
|
310
392
|
* Generate an Ed25519 key pair. Returns {seed_b64, public_b64, multikey, did_key}.
|
|
311
393
|
* @returns {string}
|
|
@@ -429,6 +511,382 @@ export function mldsa44Verify(public_b64, message_b64, signature_b64) {
|
|
|
429
511
|
}
|
|
430
512
|
}
|
|
431
513
|
|
|
514
|
+
/**
|
|
515
|
+
* Read credentialSubject.authorityEpoch without verifying the proof.
|
|
516
|
+
* @param {string} credential_json
|
|
517
|
+
* @returns {number}
|
|
518
|
+
*/
|
|
519
|
+
export function readAuthorityEpoch(credential_json) {
|
|
520
|
+
try {
|
|
521
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
522
|
+
const ptr0 = passStringToWasm0(credential_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
523
|
+
const len0 = WASM_VECTOR_LEN;
|
|
524
|
+
wasm.readAuthorityEpoch(retptr, ptr0, len0);
|
|
525
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
526
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
527
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
528
|
+
if (r2) {
|
|
529
|
+
throw takeObject(r1);
|
|
530
|
+
}
|
|
531
|
+
return r0;
|
|
532
|
+
} finally {
|
|
533
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* Read credentialSubject.status without verifying the proof.
|
|
539
|
+
* @param {string} credential_json
|
|
540
|
+
* @returns {string}
|
|
541
|
+
*/
|
|
542
|
+
export function readAuthorityStatus(credential_json) {
|
|
543
|
+
let deferred3_0;
|
|
544
|
+
let deferred3_1;
|
|
545
|
+
try {
|
|
546
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
547
|
+
const ptr0 = passStringToWasm0(credential_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
548
|
+
const len0 = WASM_VECTOR_LEN;
|
|
549
|
+
wasm.readAuthorityStatus(retptr, ptr0, len0);
|
|
550
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
551
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
552
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
553
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
554
|
+
var ptr2 = r0;
|
|
555
|
+
var len2 = r1;
|
|
556
|
+
if (r3) {
|
|
557
|
+
ptr2 = 0; len2 = 0;
|
|
558
|
+
throw takeObject(r2);
|
|
559
|
+
}
|
|
560
|
+
deferred3_0 = ptr2;
|
|
561
|
+
deferred3_1 = len2;
|
|
562
|
+
return getStringFromWasm0(ptr2, len2);
|
|
563
|
+
} finally {
|
|
564
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
565
|
+
wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* Multibase SHA-256 of an evidence artifact (JSON object or string).
|
|
571
|
+
* @param {string} artifact_json
|
|
572
|
+
* @returns {string}
|
|
573
|
+
*/
|
|
574
|
+
export function reasoningArtifactDigest(artifact_json) {
|
|
575
|
+
let deferred3_0;
|
|
576
|
+
let deferred3_1;
|
|
577
|
+
try {
|
|
578
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
579
|
+
const ptr0 = passStringToWasm0(artifact_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
580
|
+
const len0 = WASM_VECTOR_LEN;
|
|
581
|
+
wasm.reasoningArtifactDigest(retptr, ptr0, len0);
|
|
582
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
583
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
584
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
585
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
586
|
+
var ptr2 = r0;
|
|
587
|
+
var len2 = r1;
|
|
588
|
+
if (r3) {
|
|
589
|
+
ptr2 = 0; len2 = 0;
|
|
590
|
+
throw takeObject(r2);
|
|
591
|
+
}
|
|
592
|
+
deferred3_0 = ptr2;
|
|
593
|
+
deferred3_1 = len2;
|
|
594
|
+
return getStringFromWasm0(ptr2, len2);
|
|
595
|
+
} finally {
|
|
596
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
597
|
+
wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* Build a justification from an intent object, an anchors array, and an optional
|
|
603
|
+
* commitment level. Returns the justification as a JSON string.
|
|
604
|
+
* @param {string} intent_json
|
|
605
|
+
* @param {string} anchors_json
|
|
606
|
+
* @param {number | null} [commitment_level]
|
|
607
|
+
* @returns {string}
|
|
608
|
+
*/
|
|
609
|
+
export function reasoningBuildJustification(intent_json, anchors_json, commitment_level) {
|
|
610
|
+
let deferred4_0;
|
|
611
|
+
let deferred4_1;
|
|
612
|
+
try {
|
|
613
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
614
|
+
const ptr0 = passStringToWasm0(intent_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
615
|
+
const len0 = WASM_VECTOR_LEN;
|
|
616
|
+
const ptr1 = passStringToWasm0(anchors_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
617
|
+
const len1 = WASM_VECTOR_LEN;
|
|
618
|
+
wasm.reasoningBuildJustification(retptr, ptr0, len0, ptr1, len1, isLikeNone(commitment_level) ? Number.MAX_SAFE_INTEGER : (commitment_level) >> 0);
|
|
619
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
620
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
621
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
622
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
623
|
+
var ptr3 = r0;
|
|
624
|
+
var len3 = r1;
|
|
625
|
+
if (r3) {
|
|
626
|
+
ptr3 = 0; len3 = 0;
|
|
627
|
+
throw takeObject(r2);
|
|
628
|
+
}
|
|
629
|
+
deferred4_0 = ptr3;
|
|
630
|
+
deferred4_1 = len3;
|
|
631
|
+
return getStringFromWasm0(ptr3, len3);
|
|
632
|
+
} finally {
|
|
633
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
634
|
+
wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* Verify a ReasonedActionCredential. Returns null on success, else the stable
|
|
640
|
+
* reason string. Pass null for escrow_public_b64 when no escrow is required.
|
|
641
|
+
* @param {string} credential_json
|
|
642
|
+
* @param {string} public_b64
|
|
643
|
+
* @param {string | null | undefined} escrow_public_b64
|
|
644
|
+
* @param {boolean} require_escrow
|
|
645
|
+
* @returns {string | undefined}
|
|
646
|
+
*/
|
|
647
|
+
export function reasoningCheckReasonedAction(credential_json, public_b64, escrow_public_b64, require_escrow) {
|
|
648
|
+
try {
|
|
649
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
650
|
+
const ptr0 = passStringToWasm0(credential_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
651
|
+
const len0 = WASM_VECTOR_LEN;
|
|
652
|
+
const ptr1 = passStringToWasm0(public_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
653
|
+
const len1 = WASM_VECTOR_LEN;
|
|
654
|
+
var ptr2 = isLikeNone(escrow_public_b64) ? 0 : passStringToWasm0(escrow_public_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
655
|
+
var len2 = WASM_VECTOR_LEN;
|
|
656
|
+
wasm.reasoningCheckReasonedAction(retptr, ptr0, len0, ptr1, len1, ptr2, len2, require_escrow);
|
|
657
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
658
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
659
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
660
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
661
|
+
if (r3) {
|
|
662
|
+
throw takeObject(r2);
|
|
663
|
+
}
|
|
664
|
+
let v4;
|
|
665
|
+
if (r0 !== 0) {
|
|
666
|
+
v4 = getStringFromWasm0(r0, r1).slice();
|
|
667
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
668
|
+
}
|
|
669
|
+
return v4;
|
|
670
|
+
} finally {
|
|
671
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* Multibase SHA-256 over the JCS-canonical justification.
|
|
677
|
+
* @param {string} justification_json
|
|
678
|
+
* @returns {string}
|
|
679
|
+
*/
|
|
680
|
+
export function reasoningJustificationDigest(justification_json) {
|
|
681
|
+
let deferred3_0;
|
|
682
|
+
let deferred3_1;
|
|
683
|
+
try {
|
|
684
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
685
|
+
const ptr0 = passStringToWasm0(justification_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
686
|
+
const len0 = WASM_VECTOR_LEN;
|
|
687
|
+
wasm.reasoningJustificationDigest(retptr, ptr0, len0);
|
|
688
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
689
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
690
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
691
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
692
|
+
var ptr2 = r0;
|
|
693
|
+
var len2 = r1;
|
|
694
|
+
if (r3) {
|
|
695
|
+
ptr2 = 0; len2 = 0;
|
|
696
|
+
throw takeObject(r2);
|
|
697
|
+
}
|
|
698
|
+
deferred3_0 = ptr2;
|
|
699
|
+
deferred3_1 = len2;
|
|
700
|
+
return getStringFromWasm0(ptr2, len2);
|
|
701
|
+
} finally {
|
|
702
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
703
|
+
wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
/**
|
|
708
|
+
* Classify an execution time against the pulse schedule. Returns
|
|
709
|
+
* {in_window, in_gap, seconds_into_window} as a JSON string.
|
|
710
|
+
* @param {string} last_pulse
|
|
711
|
+
* @param {number} interval_seconds
|
|
712
|
+
* @param {string} exec_time
|
|
713
|
+
* @returns {string}
|
|
714
|
+
*/
|
|
715
|
+
export function reasoningPulseWindow(last_pulse, interval_seconds, exec_time) {
|
|
716
|
+
let deferred4_0;
|
|
717
|
+
let deferred4_1;
|
|
718
|
+
try {
|
|
719
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
720
|
+
const ptr0 = passStringToWasm0(last_pulse, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
721
|
+
const len0 = WASM_VECTOR_LEN;
|
|
722
|
+
const ptr1 = passStringToWasm0(exec_time, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
723
|
+
const len1 = WASM_VECTOR_LEN;
|
|
724
|
+
wasm.reasoningPulseWindow(retptr, ptr0, len0, interval_seconds, ptr1, len1);
|
|
725
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
726
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
727
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
728
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
729
|
+
var ptr3 = r0;
|
|
730
|
+
var len3 = r1;
|
|
731
|
+
if (r3) {
|
|
732
|
+
ptr3 = 0; len3 = 0;
|
|
733
|
+
throw takeObject(r2);
|
|
734
|
+
}
|
|
735
|
+
deferred4_0 = ptr3;
|
|
736
|
+
deferred4_1 = len3;
|
|
737
|
+
return getStringFromWasm0(ptr3, len3);
|
|
738
|
+
} finally {
|
|
739
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
740
|
+
wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1);
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
/**
|
|
745
|
+
* Execution-time reseal: seal the intent at `now` and issue a fresh
|
|
746
|
+
* ReasonedActionCredential whose sealedAt and validFrom are both `now`.
|
|
747
|
+
* @param {string} seed_b64
|
|
748
|
+
* @param {string} issuer_did
|
|
749
|
+
* @param {string} verification_method
|
|
750
|
+
* @param {string} intent_json
|
|
751
|
+
* @param {string} anchors_json
|
|
752
|
+
* @param {number | null | undefined} commitment_level
|
|
753
|
+
* @param {string} now
|
|
754
|
+
* @param {string} credential_id
|
|
755
|
+
* @param {boolean} include_reasoning
|
|
756
|
+
* @returns {string}
|
|
757
|
+
*/
|
|
758
|
+
export function reasoningResealIntent(seed_b64, issuer_did, verification_method, intent_json, anchors_json, commitment_level, now, credential_id, include_reasoning) {
|
|
759
|
+
let deferred9_0;
|
|
760
|
+
let deferred9_1;
|
|
761
|
+
try {
|
|
762
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
763
|
+
const ptr0 = passStringToWasm0(seed_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
764
|
+
const len0 = WASM_VECTOR_LEN;
|
|
765
|
+
const ptr1 = passStringToWasm0(issuer_did, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
766
|
+
const len1 = WASM_VECTOR_LEN;
|
|
767
|
+
const ptr2 = passStringToWasm0(verification_method, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
768
|
+
const len2 = WASM_VECTOR_LEN;
|
|
769
|
+
const ptr3 = passStringToWasm0(intent_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
770
|
+
const len3 = WASM_VECTOR_LEN;
|
|
771
|
+
const ptr4 = passStringToWasm0(anchors_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
772
|
+
const len4 = WASM_VECTOR_LEN;
|
|
773
|
+
const ptr5 = passStringToWasm0(now, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
774
|
+
const len5 = WASM_VECTOR_LEN;
|
|
775
|
+
const ptr6 = passStringToWasm0(credential_id, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
776
|
+
const len6 = WASM_VECTOR_LEN;
|
|
777
|
+
wasm.reasoningResealIntent(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, isLikeNone(commitment_level) ? Number.MAX_SAFE_INTEGER : (commitment_level) >> 0, ptr5, len5, ptr6, len6, include_reasoning);
|
|
778
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
779
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
780
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
781
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
782
|
+
var ptr8 = r0;
|
|
783
|
+
var len8 = r1;
|
|
784
|
+
if (r3) {
|
|
785
|
+
ptr8 = 0; len8 = 0;
|
|
786
|
+
throw takeObject(r2);
|
|
787
|
+
}
|
|
788
|
+
deferred9_0 = ptr8;
|
|
789
|
+
deferred9_1 = len8;
|
|
790
|
+
return getStringFromWasm0(ptr8, len8);
|
|
791
|
+
} finally {
|
|
792
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
793
|
+
wasm.__wbindgen_export4(deferred9_0, deferred9_1, 1);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* Sign a ReasonedActionCredential. Pass null for the optional sealed_at and
|
|
799
|
+
* escrow_receipt_json. Returns the signed credential as a JSON string.
|
|
800
|
+
* @param {string} seed_b64
|
|
801
|
+
* @param {string} issuer_did
|
|
802
|
+
* @param {string} verification_method
|
|
803
|
+
* @param {string} intent_json
|
|
804
|
+
* @param {string} justification_json
|
|
805
|
+
* @param {string} valid_from
|
|
806
|
+
* @param {string} credential_id
|
|
807
|
+
* @param {boolean} include_reasoning
|
|
808
|
+
* @param {string | null} [sealed_at]
|
|
809
|
+
* @param {string | null} [escrow_receipt_json]
|
|
810
|
+
* @returns {string}
|
|
811
|
+
*/
|
|
812
|
+
export function reasoningSignReasonedAction(seed_b64, issuer_did, verification_method, intent_json, justification_json, valid_from, credential_id, include_reasoning, sealed_at, escrow_receipt_json) {
|
|
813
|
+
let deferred11_0;
|
|
814
|
+
let deferred11_1;
|
|
815
|
+
try {
|
|
816
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
817
|
+
const ptr0 = passStringToWasm0(seed_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
818
|
+
const len0 = WASM_VECTOR_LEN;
|
|
819
|
+
const ptr1 = passStringToWasm0(issuer_did, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
820
|
+
const len1 = WASM_VECTOR_LEN;
|
|
821
|
+
const ptr2 = passStringToWasm0(verification_method, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
822
|
+
const len2 = WASM_VECTOR_LEN;
|
|
823
|
+
const ptr3 = passStringToWasm0(intent_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
824
|
+
const len3 = WASM_VECTOR_LEN;
|
|
825
|
+
const ptr4 = passStringToWasm0(justification_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
826
|
+
const len4 = WASM_VECTOR_LEN;
|
|
827
|
+
const ptr5 = passStringToWasm0(valid_from, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
828
|
+
const len5 = WASM_VECTOR_LEN;
|
|
829
|
+
const ptr6 = passStringToWasm0(credential_id, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
830
|
+
const len6 = WASM_VECTOR_LEN;
|
|
831
|
+
var ptr7 = isLikeNone(sealed_at) ? 0 : passStringToWasm0(sealed_at, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
832
|
+
var len7 = WASM_VECTOR_LEN;
|
|
833
|
+
var ptr8 = isLikeNone(escrow_receipt_json) ? 0 : passStringToWasm0(escrow_receipt_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
834
|
+
var len8 = WASM_VECTOR_LEN;
|
|
835
|
+
wasm.reasoningSignReasonedAction(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, include_reasoning, ptr7, len7, ptr8, len8);
|
|
836
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
837
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
838
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
839
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
840
|
+
var ptr10 = r0;
|
|
841
|
+
var len10 = r1;
|
|
842
|
+
if (r3) {
|
|
843
|
+
ptr10 = 0; len10 = 0;
|
|
844
|
+
throw takeObject(r2);
|
|
845
|
+
}
|
|
846
|
+
deferred11_0 = ptr10;
|
|
847
|
+
deferred11_1 = len10;
|
|
848
|
+
return getStringFromWasm0(ptr10, len10);
|
|
849
|
+
} finally {
|
|
850
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
851
|
+
wasm.__wbindgen_export4(deferred11_0, deferred11_1, 1);
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
/**
|
|
856
|
+
* Verify intent freshness for a credential at a consequence tier, using the
|
|
857
|
+
* reference tier policy. Returns null when accepted, else the stable reason
|
|
858
|
+
* string (e.g. "intent_seal_stale:...").
|
|
859
|
+
* @param {string} credential_json
|
|
860
|
+
* @param {number} tier
|
|
861
|
+
* @param {string} last_pulse
|
|
862
|
+
* @returns {string | undefined}
|
|
863
|
+
*/
|
|
864
|
+
export function reasoningVerifyIntentFreshness(credential_json, tier, last_pulse) {
|
|
865
|
+
try {
|
|
866
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
867
|
+
const ptr0 = passStringToWasm0(credential_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
868
|
+
const len0 = WASM_VECTOR_LEN;
|
|
869
|
+
const ptr1 = passStringToWasm0(last_pulse, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
870
|
+
const len1 = WASM_VECTOR_LEN;
|
|
871
|
+
wasm.reasoningVerifyIntentFreshness(retptr, ptr0, len0, tier, ptr1, len1);
|
|
872
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
873
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
874
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
875
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
876
|
+
if (r3) {
|
|
877
|
+
throw takeObject(r2);
|
|
878
|
+
}
|
|
879
|
+
let v3;
|
|
880
|
+
if (r0 !== 0) {
|
|
881
|
+
v3 = getStringFromWasm0(r0, r1).slice();
|
|
882
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
883
|
+
}
|
|
884
|
+
return v3;
|
|
885
|
+
} finally {
|
|
886
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
|
|
432
890
|
/**
|
|
433
891
|
* @param {string} credential_json
|
|
434
892
|
* @param {string} signer_seed_b64
|
|
@@ -3609,6 +4067,63 @@ export function sign(credential_json, seed_b64, verification_method, created) {
|
|
|
3609
4067
|
}
|
|
3610
4068
|
}
|
|
3611
4069
|
|
|
4070
|
+
/**
|
|
4071
|
+
* Build and sign an AuthorityState credential in one step (eddsa-jcs-2022).
|
|
4072
|
+
* @param {string} issuer_did
|
|
4073
|
+
* @param {string} credential_id
|
|
4074
|
+
* @param {number} authority_epoch
|
|
4075
|
+
* @param {string} status
|
|
4076
|
+
* @param {string} valid_from
|
|
4077
|
+
* @param {string} valid_until
|
|
4078
|
+
* @param {string | null | undefined} subject_did
|
|
4079
|
+
* @param {string} seed_b64
|
|
4080
|
+
* @param {string} verification_method
|
|
4081
|
+
* @param {string} created
|
|
4082
|
+
* @returns {string}
|
|
4083
|
+
*/
|
|
4084
|
+
export function signAuthorityState(issuer_did, credential_id, authority_epoch, status, valid_from, valid_until, subject_did, seed_b64, verification_method, created) {
|
|
4085
|
+
let deferred11_0;
|
|
4086
|
+
let deferred11_1;
|
|
4087
|
+
try {
|
|
4088
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4089
|
+
const ptr0 = passStringToWasm0(issuer_did, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
4090
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4091
|
+
const ptr1 = passStringToWasm0(credential_id, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
4092
|
+
const len1 = WASM_VECTOR_LEN;
|
|
4093
|
+
const ptr2 = passStringToWasm0(status, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
4094
|
+
const len2 = WASM_VECTOR_LEN;
|
|
4095
|
+
const ptr3 = passStringToWasm0(valid_from, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
4096
|
+
const len3 = WASM_VECTOR_LEN;
|
|
4097
|
+
const ptr4 = passStringToWasm0(valid_until, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
4098
|
+
const len4 = WASM_VECTOR_LEN;
|
|
4099
|
+
var ptr5 = isLikeNone(subject_did) ? 0 : passStringToWasm0(subject_did, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
4100
|
+
var len5 = WASM_VECTOR_LEN;
|
|
4101
|
+
const ptr6 = passStringToWasm0(seed_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
4102
|
+
const len6 = WASM_VECTOR_LEN;
|
|
4103
|
+
const ptr7 = passStringToWasm0(verification_method, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
4104
|
+
const len7 = WASM_VECTOR_LEN;
|
|
4105
|
+
const ptr8 = passStringToWasm0(created, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
4106
|
+
const len8 = WASM_VECTOR_LEN;
|
|
4107
|
+
wasm.signAuthorityState(retptr, ptr0, len0, ptr1, len1, authority_epoch, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8);
|
|
4108
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4109
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4110
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
4111
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
4112
|
+
var ptr10 = r0;
|
|
4113
|
+
var len10 = r1;
|
|
4114
|
+
if (r3) {
|
|
4115
|
+
ptr10 = 0; len10 = 0;
|
|
4116
|
+
throw takeObject(r2);
|
|
4117
|
+
}
|
|
4118
|
+
deferred11_0 = ptr10;
|
|
4119
|
+
deferred11_1 = len10;
|
|
4120
|
+
return getStringFromWasm0(ptr10, len10);
|
|
4121
|
+
} finally {
|
|
4122
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4123
|
+
wasm.__wbindgen_export4(deferred11_0, deferred11_1, 1);
|
|
4124
|
+
}
|
|
4125
|
+
}
|
|
4126
|
+
|
|
3612
4127
|
/**
|
|
3613
4128
|
* Build a dual proof (Ed25519 + ML-DSA-44) and attach it to the credential.
|
|
3614
4129
|
* @param {string} credential_json
|
|
@@ -3878,6 +4393,46 @@ export function verify(credential_json, public_b64, now_iso, clock_skew_seconds)
|
|
|
3878
4393
|
}
|
|
3879
4394
|
}
|
|
3880
4395
|
|
|
4396
|
+
/**
|
|
4397
|
+
* Verify an AuthorityState credential's proof and validity window.
|
|
4398
|
+
* Returns {proofValid, timeValid, valid}.
|
|
4399
|
+
* @param {string} credential_json
|
|
4400
|
+
* @param {string} public_b64
|
|
4401
|
+
* @param {string} now_iso
|
|
4402
|
+
* @param {number} clock_skew_seconds
|
|
4403
|
+
* @returns {string}
|
|
4404
|
+
*/
|
|
4405
|
+
export function verifyAuthorityState(credential_json, public_b64, now_iso, clock_skew_seconds) {
|
|
4406
|
+
let deferred5_0;
|
|
4407
|
+
let deferred5_1;
|
|
4408
|
+
try {
|
|
4409
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4410
|
+
const ptr0 = passStringToWasm0(credential_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
4411
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4412
|
+
const ptr1 = passStringToWasm0(public_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
4413
|
+
const len1 = WASM_VECTOR_LEN;
|
|
4414
|
+
const ptr2 = passStringToWasm0(now_iso, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
4415
|
+
const len2 = WASM_VECTOR_LEN;
|
|
4416
|
+
wasm.verifyAuthorityState(retptr, ptr0, len0, ptr1, len1, ptr2, len2, clock_skew_seconds);
|
|
4417
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4418
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4419
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
4420
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
4421
|
+
var ptr4 = r0;
|
|
4422
|
+
var len4 = r1;
|
|
4423
|
+
if (r3) {
|
|
4424
|
+
ptr4 = 0; len4 = 0;
|
|
4425
|
+
throw takeObject(r2);
|
|
4426
|
+
}
|
|
4427
|
+
deferred5_0 = ptr4;
|
|
4428
|
+
deferred5_1 = len4;
|
|
4429
|
+
return getStringFromWasm0(ptr4, len4);
|
|
4430
|
+
} finally {
|
|
4431
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4432
|
+
wasm.__wbindgen_export4(deferred5_0, deferred5_1, 1);
|
|
4433
|
+
}
|
|
4434
|
+
}
|
|
4435
|
+
|
|
3881
4436
|
/**
|
|
3882
4437
|
* Validate the time-bound rule over a delegation chain (JSON array of links).
|
|
3883
4438
|
* @param {string} chain_json
|
package/vouch_core_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const buildAuthorityState: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number) => void;
|
|
4
5
|
export const buildDelegationLink: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
|
|
5
6
|
export const buildProof: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
6
7
|
export const canonicalize: (a: number, b: number, c: number) => void;
|
|
@@ -10,10 +11,21 @@ export const ed25519FromDidKey: (a: number, b: number, c: number) => void;
|
|
|
10
11
|
export const ed25519Sign: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
11
12
|
export const ed25519Verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
12
13
|
export const encodeEd25519Multikey: (a: number, b: number, c: number) => void;
|
|
14
|
+
export const evaluateAuthorityFreshness: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
13
15
|
export const generateEd25519: (a: number) => void;
|
|
14
16
|
export const generateMldsa44: (a: number) => void;
|
|
15
17
|
export const mldsa44Sign: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
16
18
|
export const mldsa44Verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
19
|
+
export const readAuthorityEpoch: (a: number, b: number, c: number) => void;
|
|
20
|
+
export const readAuthorityStatus: (a: number, b: number, c: number) => void;
|
|
21
|
+
export const reasoningArtifactDigest: (a: number, b: number, c: number) => void;
|
|
22
|
+
export const reasoningBuildJustification: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
23
|
+
export const reasoningCheckReasonedAction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
24
|
+
export const reasoningJustificationDigest: (a: number, b: number, c: number) => void;
|
|
25
|
+
export const reasoningPulseWindow: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
26
|
+
export const reasoningResealIntent: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number) => void;
|
|
27
|
+
export const reasoningSignReasonedAction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number) => void;
|
|
28
|
+
export const reasoningVerifyIntentFreshness: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
17
29
|
export const roboticsAttachStatus: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
18
30
|
export const roboticsAttenuateForWear: (a: number, b: number, c: number) => void;
|
|
19
31
|
export const roboticsAttenuates: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
@@ -109,6 +121,7 @@ export const roboticsVerifySafetyRecord: (a: number, b: number, c: number, d: nu
|
|
|
109
121
|
export const roboticsVerifyWearAttestation: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
110
122
|
export const roboticsVerifyWearChain: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
111
123
|
export const sign: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
124
|
+
export const signAuthorityState: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number) => void;
|
|
112
125
|
export const signDual: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number) => void;
|
|
113
126
|
export const thresholdAggregate: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
114
127
|
export const thresholdCommit: (a: number, b: number, c: number) => void;
|
|
@@ -116,6 +129,7 @@ export const thresholdGenerateKey: (a: number, b: number, c: number) => void;
|
|
|
116
129
|
export const thresholdSignShare: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
117
130
|
export const validateDelegationChain: (a: number, b: number, c: number) => void;
|
|
118
131
|
export const verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
132
|
+
export const verifyAuthorityState: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
119
133
|
export const verifyChainTimeBound: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
120
134
|
export const verifyComposite: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
121
135
|
export const verifyDual: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|