@vouch-protocol-official/core-wasm 0.1.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/LICENSE +198 -0
- package/README.md +103 -0
- package/package.json +32 -0
- package/vouch_core_wasm.d.ts +123 -0
- package/vouch_core_wasm.js +1051 -0
- package/vouch_core_wasm_bg.wasm +0 -0
- package/vouch_core_wasm_bg.wasm.d.ts +30 -0
|
@@ -0,0 +1,1051 @@
|
|
|
1
|
+
/* @ts-self-types="./vouch_core_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Build a delegation link. Pass null/undefined for the optional validFrom,
|
|
5
|
+
* validUntil, parentProofValue. Returns the link as a JSON string.
|
|
6
|
+
* @param {string} issuer
|
|
7
|
+
* @param {string} subject
|
|
8
|
+
* @param {string} intent_json
|
|
9
|
+
* @param {string | null} [valid_from]
|
|
10
|
+
* @param {string | null} [valid_until]
|
|
11
|
+
* @param {string | null} [parent_proof_value]
|
|
12
|
+
* @returns {string}
|
|
13
|
+
*/
|
|
14
|
+
export function buildDelegationLink(issuer, subject, intent_json, valid_from, valid_until, parent_proof_value) {
|
|
15
|
+
let deferred8_0;
|
|
16
|
+
let deferred8_1;
|
|
17
|
+
try {
|
|
18
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
19
|
+
const ptr0 = passStringToWasm0(issuer, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
20
|
+
const len0 = WASM_VECTOR_LEN;
|
|
21
|
+
const ptr1 = passStringToWasm0(subject, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
22
|
+
const len1 = WASM_VECTOR_LEN;
|
|
23
|
+
const ptr2 = passStringToWasm0(intent_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
24
|
+
const len2 = WASM_VECTOR_LEN;
|
|
25
|
+
var ptr3 = isLikeNone(valid_from) ? 0 : passStringToWasm0(valid_from, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
26
|
+
var len3 = WASM_VECTOR_LEN;
|
|
27
|
+
var ptr4 = isLikeNone(valid_until) ? 0 : passStringToWasm0(valid_until, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
28
|
+
var len4 = WASM_VECTOR_LEN;
|
|
29
|
+
var ptr5 = isLikeNone(parent_proof_value) ? 0 : passStringToWasm0(parent_proof_value, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
30
|
+
var len5 = WASM_VECTOR_LEN;
|
|
31
|
+
wasm.buildDelegationLink(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5);
|
|
32
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
33
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
34
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
35
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
36
|
+
var ptr7 = r0;
|
|
37
|
+
var len7 = r1;
|
|
38
|
+
if (r3) {
|
|
39
|
+
ptr7 = 0; len7 = 0;
|
|
40
|
+
throw takeObject(r2);
|
|
41
|
+
}
|
|
42
|
+
deferred8_0 = ptr7;
|
|
43
|
+
deferred8_1 = len7;
|
|
44
|
+
return getStringFromWasm0(ptr7, len7);
|
|
45
|
+
} finally {
|
|
46
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
47
|
+
wasm.__wbindgen_export4(deferred8_0, deferred8_1, 1);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @param {string} credential_json
|
|
53
|
+
* @param {string} seed_b64
|
|
54
|
+
* @param {string} verification_method
|
|
55
|
+
* @param {string} created
|
|
56
|
+
* @returns {string}
|
|
57
|
+
*/
|
|
58
|
+
export function buildProof(credential_json, seed_b64, verification_method, created) {
|
|
59
|
+
let deferred6_0;
|
|
60
|
+
let deferred6_1;
|
|
61
|
+
try {
|
|
62
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
63
|
+
const ptr0 = passStringToWasm0(credential_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
64
|
+
const len0 = WASM_VECTOR_LEN;
|
|
65
|
+
const ptr1 = passStringToWasm0(seed_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
66
|
+
const len1 = WASM_VECTOR_LEN;
|
|
67
|
+
const ptr2 = passStringToWasm0(verification_method, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
68
|
+
const len2 = WASM_VECTOR_LEN;
|
|
69
|
+
const ptr3 = passStringToWasm0(created, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
70
|
+
const len3 = WASM_VECTOR_LEN;
|
|
71
|
+
wasm.buildProof(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
72
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
73
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
74
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
75
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
76
|
+
var ptr5 = r0;
|
|
77
|
+
var len5 = r1;
|
|
78
|
+
if (r3) {
|
|
79
|
+
ptr5 = 0; len5 = 0;
|
|
80
|
+
throw takeObject(r2);
|
|
81
|
+
}
|
|
82
|
+
deferred6_0 = ptr5;
|
|
83
|
+
deferred6_1 = len5;
|
|
84
|
+
return getStringFromWasm0(ptr5, len5);
|
|
85
|
+
} finally {
|
|
86
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
87
|
+
wasm.__wbindgen_export4(deferred6_0, deferred6_1, 1);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* RFC 8785 canonicalization of a JSON string.
|
|
93
|
+
* @param {string} json_str
|
|
94
|
+
* @returns {string}
|
|
95
|
+
*/
|
|
96
|
+
export function canonicalize(json_str) {
|
|
97
|
+
let deferred3_0;
|
|
98
|
+
let deferred3_1;
|
|
99
|
+
try {
|
|
100
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
101
|
+
const ptr0 = passStringToWasm0(json_str, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
102
|
+
const len0 = WASM_VECTOR_LEN;
|
|
103
|
+
wasm.canonicalize(retptr, ptr0, len0);
|
|
104
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
105
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
106
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
107
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
108
|
+
var ptr2 = r0;
|
|
109
|
+
var len2 = r1;
|
|
110
|
+
if (r3) {
|
|
111
|
+
ptr2 = 0; len2 = 0;
|
|
112
|
+
throw takeObject(r2);
|
|
113
|
+
}
|
|
114
|
+
deferred3_0 = ptr2;
|
|
115
|
+
deferred3_1 = len2;
|
|
116
|
+
return getStringFromWasm0(ptr2, len2);
|
|
117
|
+
} finally {
|
|
118
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
119
|
+
wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @param {string} multikey_str
|
|
125
|
+
* @returns {string}
|
|
126
|
+
*/
|
|
127
|
+
export function decodeMultikey(multikey_str) {
|
|
128
|
+
let deferred3_0;
|
|
129
|
+
let deferred3_1;
|
|
130
|
+
try {
|
|
131
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
132
|
+
const ptr0 = passStringToWasm0(multikey_str, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
133
|
+
const len0 = WASM_VECTOR_LEN;
|
|
134
|
+
wasm.decodeMultikey(retptr, ptr0, len0);
|
|
135
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
136
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
137
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
138
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
139
|
+
var ptr2 = r0;
|
|
140
|
+
var len2 = r1;
|
|
141
|
+
if (r3) {
|
|
142
|
+
ptr2 = 0; len2 = 0;
|
|
143
|
+
throw takeObject(r2);
|
|
144
|
+
}
|
|
145
|
+
deferred3_0 = ptr2;
|
|
146
|
+
deferred3_1 = len2;
|
|
147
|
+
return getStringFromWasm0(ptr2, len2);
|
|
148
|
+
} finally {
|
|
149
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
150
|
+
wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* @param {string} public_b64
|
|
156
|
+
* @returns {string}
|
|
157
|
+
*/
|
|
158
|
+
export function didKeyFromEd25519(public_b64) {
|
|
159
|
+
let deferred3_0;
|
|
160
|
+
let deferred3_1;
|
|
161
|
+
try {
|
|
162
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
163
|
+
const ptr0 = passStringToWasm0(public_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
164
|
+
const len0 = WASM_VECTOR_LEN;
|
|
165
|
+
wasm.didKeyFromEd25519(retptr, ptr0, len0);
|
|
166
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
167
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
168
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
169
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
170
|
+
var ptr2 = r0;
|
|
171
|
+
var len2 = r1;
|
|
172
|
+
if (r3) {
|
|
173
|
+
ptr2 = 0; len2 = 0;
|
|
174
|
+
throw takeObject(r2);
|
|
175
|
+
}
|
|
176
|
+
deferred3_0 = ptr2;
|
|
177
|
+
deferred3_1 = len2;
|
|
178
|
+
return getStringFromWasm0(ptr2, len2);
|
|
179
|
+
} finally {
|
|
180
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
181
|
+
wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* @param {string} did
|
|
187
|
+
* @returns {string}
|
|
188
|
+
*/
|
|
189
|
+
export function ed25519FromDidKey(did) {
|
|
190
|
+
let deferred3_0;
|
|
191
|
+
let deferred3_1;
|
|
192
|
+
try {
|
|
193
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
194
|
+
const ptr0 = passStringToWasm0(did, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
195
|
+
const len0 = WASM_VECTOR_LEN;
|
|
196
|
+
wasm.ed25519FromDidKey(retptr, ptr0, len0);
|
|
197
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
198
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
199
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
200
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
201
|
+
var ptr2 = r0;
|
|
202
|
+
var len2 = r1;
|
|
203
|
+
if (r3) {
|
|
204
|
+
ptr2 = 0; len2 = 0;
|
|
205
|
+
throw takeObject(r2);
|
|
206
|
+
}
|
|
207
|
+
deferred3_0 = ptr2;
|
|
208
|
+
deferred3_1 = len2;
|
|
209
|
+
return getStringFromWasm0(ptr2, len2);
|
|
210
|
+
} finally {
|
|
211
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
212
|
+
wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* @param {string} seed_b64
|
|
218
|
+
* @param {string} message_b64
|
|
219
|
+
* @returns {string}
|
|
220
|
+
*/
|
|
221
|
+
export function ed25519Sign(seed_b64, message_b64) {
|
|
222
|
+
let deferred4_0;
|
|
223
|
+
let deferred4_1;
|
|
224
|
+
try {
|
|
225
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
226
|
+
const ptr0 = passStringToWasm0(seed_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
227
|
+
const len0 = WASM_VECTOR_LEN;
|
|
228
|
+
const ptr1 = passStringToWasm0(message_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
229
|
+
const len1 = WASM_VECTOR_LEN;
|
|
230
|
+
wasm.ed25519Sign(retptr, ptr0, len0, ptr1, len1);
|
|
231
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
232
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
233
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
234
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
235
|
+
var ptr3 = r0;
|
|
236
|
+
var len3 = r1;
|
|
237
|
+
if (r3) {
|
|
238
|
+
ptr3 = 0; len3 = 0;
|
|
239
|
+
throw takeObject(r2);
|
|
240
|
+
}
|
|
241
|
+
deferred4_0 = ptr3;
|
|
242
|
+
deferred4_1 = len3;
|
|
243
|
+
return getStringFromWasm0(ptr3, len3);
|
|
244
|
+
} finally {
|
|
245
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
246
|
+
wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* @param {string} public_b64
|
|
252
|
+
* @param {string} message_b64
|
|
253
|
+
* @param {string} signature_b64
|
|
254
|
+
* @returns {boolean}
|
|
255
|
+
*/
|
|
256
|
+
export function ed25519Verify(public_b64, message_b64, signature_b64) {
|
|
257
|
+
try {
|
|
258
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
259
|
+
const ptr0 = passStringToWasm0(public_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
260
|
+
const len0 = WASM_VECTOR_LEN;
|
|
261
|
+
const ptr1 = passStringToWasm0(message_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
262
|
+
const len1 = WASM_VECTOR_LEN;
|
|
263
|
+
const ptr2 = passStringToWasm0(signature_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
264
|
+
const len2 = WASM_VECTOR_LEN;
|
|
265
|
+
wasm.ed25519Verify(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
266
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
267
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
268
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
269
|
+
if (r2) {
|
|
270
|
+
throw takeObject(r1);
|
|
271
|
+
}
|
|
272
|
+
return r0 !== 0;
|
|
273
|
+
} finally {
|
|
274
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* @param {string} public_b64
|
|
280
|
+
* @returns {string}
|
|
281
|
+
*/
|
|
282
|
+
export function encodeEd25519Multikey(public_b64) {
|
|
283
|
+
let deferred3_0;
|
|
284
|
+
let deferred3_1;
|
|
285
|
+
try {
|
|
286
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
287
|
+
const ptr0 = passStringToWasm0(public_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
288
|
+
const len0 = WASM_VECTOR_LEN;
|
|
289
|
+
wasm.encodeEd25519Multikey(retptr, ptr0, len0);
|
|
290
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
291
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
292
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
293
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
294
|
+
var ptr2 = r0;
|
|
295
|
+
var len2 = r1;
|
|
296
|
+
if (r3) {
|
|
297
|
+
ptr2 = 0; len2 = 0;
|
|
298
|
+
throw takeObject(r2);
|
|
299
|
+
}
|
|
300
|
+
deferred3_0 = ptr2;
|
|
301
|
+
deferred3_1 = len2;
|
|
302
|
+
return getStringFromWasm0(ptr2, len2);
|
|
303
|
+
} finally {
|
|
304
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
305
|
+
wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Generate an Ed25519 key pair. Returns {seed_b64, public_b64, multikey, did_key}.
|
|
311
|
+
* @returns {string}
|
|
312
|
+
*/
|
|
313
|
+
export function generateEd25519() {
|
|
314
|
+
let deferred2_0;
|
|
315
|
+
let deferred2_1;
|
|
316
|
+
try {
|
|
317
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
318
|
+
wasm.generateEd25519(retptr);
|
|
319
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
320
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
321
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
322
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
323
|
+
var ptr1 = r0;
|
|
324
|
+
var len1 = r1;
|
|
325
|
+
if (r3) {
|
|
326
|
+
ptr1 = 0; len1 = 0;
|
|
327
|
+
throw takeObject(r2);
|
|
328
|
+
}
|
|
329
|
+
deferred2_0 = ptr1;
|
|
330
|
+
deferred2_1 = len1;
|
|
331
|
+
return getStringFromWasm0(ptr1, len1);
|
|
332
|
+
} finally {
|
|
333
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
334
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Generate an ML-DSA-44 key pair. Returns {secret_b64, public_b64}.
|
|
340
|
+
* @returns {string}
|
|
341
|
+
*/
|
|
342
|
+
export function generateMldsa44() {
|
|
343
|
+
let deferred2_0;
|
|
344
|
+
let deferred2_1;
|
|
345
|
+
try {
|
|
346
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
347
|
+
wasm.generateMldsa44(retptr);
|
|
348
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
349
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
350
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
351
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
352
|
+
var ptr1 = r0;
|
|
353
|
+
var len1 = r1;
|
|
354
|
+
if (r3) {
|
|
355
|
+
ptr1 = 0; len1 = 0;
|
|
356
|
+
throw takeObject(r2);
|
|
357
|
+
}
|
|
358
|
+
deferred2_0 = ptr1;
|
|
359
|
+
deferred2_1 = len1;
|
|
360
|
+
return getStringFromWasm0(ptr1, len1);
|
|
361
|
+
} finally {
|
|
362
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
363
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* @param {string} secret_b64
|
|
369
|
+
* @param {string} public_b64
|
|
370
|
+
* @param {string} message_b64
|
|
371
|
+
* @returns {string}
|
|
372
|
+
*/
|
|
373
|
+
export function mldsa44Sign(secret_b64, public_b64, message_b64) {
|
|
374
|
+
let deferred5_0;
|
|
375
|
+
let deferred5_1;
|
|
376
|
+
try {
|
|
377
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
378
|
+
const ptr0 = passStringToWasm0(secret_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
379
|
+
const len0 = WASM_VECTOR_LEN;
|
|
380
|
+
const ptr1 = passStringToWasm0(public_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
381
|
+
const len1 = WASM_VECTOR_LEN;
|
|
382
|
+
const ptr2 = passStringToWasm0(message_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
383
|
+
const len2 = WASM_VECTOR_LEN;
|
|
384
|
+
wasm.mldsa44Sign(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
385
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
386
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
387
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
388
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
389
|
+
var ptr4 = r0;
|
|
390
|
+
var len4 = r1;
|
|
391
|
+
if (r3) {
|
|
392
|
+
ptr4 = 0; len4 = 0;
|
|
393
|
+
throw takeObject(r2);
|
|
394
|
+
}
|
|
395
|
+
deferred5_0 = ptr4;
|
|
396
|
+
deferred5_1 = len4;
|
|
397
|
+
return getStringFromWasm0(ptr4, len4);
|
|
398
|
+
} finally {
|
|
399
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
400
|
+
wasm.__wbindgen_export4(deferred5_0, deferred5_1, 1);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* @param {string} public_b64
|
|
406
|
+
* @param {string} message_b64
|
|
407
|
+
* @param {string} signature_b64
|
|
408
|
+
* @returns {boolean}
|
|
409
|
+
*/
|
|
410
|
+
export function mldsa44Verify(public_b64, message_b64, signature_b64) {
|
|
411
|
+
try {
|
|
412
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
413
|
+
const ptr0 = passStringToWasm0(public_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
414
|
+
const len0 = WASM_VECTOR_LEN;
|
|
415
|
+
const ptr1 = passStringToWasm0(message_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
416
|
+
const len1 = WASM_VECTOR_LEN;
|
|
417
|
+
const ptr2 = passStringToWasm0(signature_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
418
|
+
const len2 = WASM_VECTOR_LEN;
|
|
419
|
+
wasm.mldsa44Verify(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
420
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
421
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
422
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
423
|
+
if (r2) {
|
|
424
|
+
throw takeObject(r1);
|
|
425
|
+
}
|
|
426
|
+
return r0 !== 0;
|
|
427
|
+
} finally {
|
|
428
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* @param {string} credential_json
|
|
434
|
+
* @param {string} seed_b64
|
|
435
|
+
* @param {string} verification_method
|
|
436
|
+
* @param {string} created
|
|
437
|
+
* @returns {string}
|
|
438
|
+
*/
|
|
439
|
+
export function signCredential(credential_json, seed_b64, verification_method, created) {
|
|
440
|
+
let deferred6_0;
|
|
441
|
+
let deferred6_1;
|
|
442
|
+
try {
|
|
443
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
444
|
+
const ptr0 = passStringToWasm0(credential_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
445
|
+
const len0 = WASM_VECTOR_LEN;
|
|
446
|
+
const ptr1 = passStringToWasm0(seed_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
447
|
+
const len1 = WASM_VECTOR_LEN;
|
|
448
|
+
const ptr2 = passStringToWasm0(verification_method, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
449
|
+
const len2 = WASM_VECTOR_LEN;
|
|
450
|
+
const ptr3 = passStringToWasm0(created, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
451
|
+
const len3 = WASM_VECTOR_LEN;
|
|
452
|
+
wasm.signCredential(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
453
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
454
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
455
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
456
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
457
|
+
var ptr5 = r0;
|
|
458
|
+
var len5 = r1;
|
|
459
|
+
if (r3) {
|
|
460
|
+
ptr5 = 0; len5 = 0;
|
|
461
|
+
throw takeObject(r2);
|
|
462
|
+
}
|
|
463
|
+
deferred6_0 = ptr5;
|
|
464
|
+
deferred6_1 = len5;
|
|
465
|
+
return getStringFromWasm0(ptr5, len5);
|
|
466
|
+
} finally {
|
|
467
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
468
|
+
wasm.__wbindgen_export4(deferred6_0, deferred6_1, 1);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* Build a dual proof (Ed25519 + ML-DSA-44) and attach it to the credential.
|
|
474
|
+
* @param {string} credential_json
|
|
475
|
+
* @param {string} ed25519_seed_b64
|
|
476
|
+
* @param {string} mldsa_secret_b64
|
|
477
|
+
* @param {string} mldsa_public_b64
|
|
478
|
+
* @param {string} ed25519_vm
|
|
479
|
+
* @param {string} mldsa_vm
|
|
480
|
+
* @param {string} created
|
|
481
|
+
* @returns {string}
|
|
482
|
+
*/
|
|
483
|
+
export function signDual(credential_json, ed25519_seed_b64, mldsa_secret_b64, mldsa_public_b64, ed25519_vm, mldsa_vm, created) {
|
|
484
|
+
let deferred9_0;
|
|
485
|
+
let deferred9_1;
|
|
486
|
+
try {
|
|
487
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
488
|
+
const ptr0 = passStringToWasm0(credential_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
489
|
+
const len0 = WASM_VECTOR_LEN;
|
|
490
|
+
const ptr1 = passStringToWasm0(ed25519_seed_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
491
|
+
const len1 = WASM_VECTOR_LEN;
|
|
492
|
+
const ptr2 = passStringToWasm0(mldsa_secret_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
493
|
+
const len2 = WASM_VECTOR_LEN;
|
|
494
|
+
const ptr3 = passStringToWasm0(mldsa_public_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
495
|
+
const len3 = WASM_VECTOR_LEN;
|
|
496
|
+
const ptr4 = passStringToWasm0(ed25519_vm, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
497
|
+
const len4 = WASM_VECTOR_LEN;
|
|
498
|
+
const ptr5 = passStringToWasm0(mldsa_vm, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
499
|
+
const len5 = WASM_VECTOR_LEN;
|
|
500
|
+
const ptr6 = passStringToWasm0(created, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
501
|
+
const len6 = WASM_VECTOR_LEN;
|
|
502
|
+
wasm.signDual(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6);
|
|
503
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
504
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
505
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
506
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
507
|
+
var ptr8 = r0;
|
|
508
|
+
var len8 = r1;
|
|
509
|
+
if (r3) {
|
|
510
|
+
ptr8 = 0; len8 = 0;
|
|
511
|
+
throw takeObject(r2);
|
|
512
|
+
}
|
|
513
|
+
deferred9_0 = ptr8;
|
|
514
|
+
deferred9_1 = len8;
|
|
515
|
+
return getStringFromWasm0(ptr8, len8);
|
|
516
|
+
} finally {
|
|
517
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
518
|
+
wasm.__wbindgen_export4(deferred9_0, deferred9_1, 1);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Validate the time-bound rule over a delegation chain (JSON array of links).
|
|
524
|
+
* @param {string} chain_json
|
|
525
|
+
* @param {string} now_iso
|
|
526
|
+
* @param {number} clock_skew_seconds
|
|
527
|
+
* @returns {boolean}
|
|
528
|
+
*/
|
|
529
|
+
export function verifyChainTimeBound(chain_json, now_iso, clock_skew_seconds) {
|
|
530
|
+
try {
|
|
531
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
532
|
+
const ptr0 = passStringToWasm0(chain_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
533
|
+
const len0 = WASM_VECTOR_LEN;
|
|
534
|
+
const ptr1 = passStringToWasm0(now_iso, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
535
|
+
const len1 = WASM_VECTOR_LEN;
|
|
536
|
+
wasm.verifyChainTimeBound(retptr, ptr0, len0, ptr1, len1, clock_skew_seconds);
|
|
537
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
538
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
539
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
540
|
+
if (r2) {
|
|
541
|
+
throw takeObject(r1);
|
|
542
|
+
}
|
|
543
|
+
return r0 !== 0;
|
|
544
|
+
} finally {
|
|
545
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* @param {string} credential_json
|
|
551
|
+
* @param {string} ed25519_public_b64
|
|
552
|
+
* @param {string} mldsa_public_b64
|
|
553
|
+
* @returns {boolean}
|
|
554
|
+
*/
|
|
555
|
+
export function verifyComposite(credential_json, ed25519_public_b64, mldsa_public_b64) {
|
|
556
|
+
try {
|
|
557
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
558
|
+
const ptr0 = passStringToWasm0(credential_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
559
|
+
const len0 = WASM_VECTOR_LEN;
|
|
560
|
+
const ptr1 = passStringToWasm0(ed25519_public_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
561
|
+
const len1 = WASM_VECTOR_LEN;
|
|
562
|
+
const ptr2 = passStringToWasm0(mldsa_public_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
563
|
+
const len2 = WASM_VECTOR_LEN;
|
|
564
|
+
wasm.verifyComposite(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
565
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
566
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
567
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
568
|
+
if (r2) {
|
|
569
|
+
throw takeObject(r1);
|
|
570
|
+
}
|
|
571
|
+
return r0 !== 0;
|
|
572
|
+
} finally {
|
|
573
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* @param {string} credential_json
|
|
579
|
+
* @param {string} public_b64
|
|
580
|
+
* @param {string} now_iso
|
|
581
|
+
* @param {number} clock_skew_seconds
|
|
582
|
+
* @returns {string}
|
|
583
|
+
*/
|
|
584
|
+
export function verifyCredential(credential_json, public_b64, now_iso, clock_skew_seconds) {
|
|
585
|
+
let deferred5_0;
|
|
586
|
+
let deferred5_1;
|
|
587
|
+
try {
|
|
588
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
589
|
+
const ptr0 = passStringToWasm0(credential_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
590
|
+
const len0 = WASM_VECTOR_LEN;
|
|
591
|
+
const ptr1 = passStringToWasm0(public_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
592
|
+
const len1 = WASM_VECTOR_LEN;
|
|
593
|
+
const ptr2 = passStringToWasm0(now_iso, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
594
|
+
const len2 = WASM_VECTOR_LEN;
|
|
595
|
+
wasm.verifyCredential(retptr, ptr0, len0, ptr1, len1, ptr2, len2, clock_skew_seconds);
|
|
596
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
597
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
598
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
599
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
600
|
+
var ptr4 = r0;
|
|
601
|
+
var len4 = r1;
|
|
602
|
+
if (r3) {
|
|
603
|
+
ptr4 = 0; len4 = 0;
|
|
604
|
+
throw takeObject(r2);
|
|
605
|
+
}
|
|
606
|
+
deferred5_0 = ptr4;
|
|
607
|
+
deferred5_1 = len4;
|
|
608
|
+
return getStringFromWasm0(ptr4, len4);
|
|
609
|
+
} finally {
|
|
610
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
611
|
+
wasm.__wbindgen_export4(deferred5_0, deferred5_1, 1);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* @param {string} credential_json
|
|
617
|
+
* @param {string} ed25519_public_b64
|
|
618
|
+
* @param {string} mldsa_public_b64
|
|
619
|
+
* @returns {boolean}
|
|
620
|
+
*/
|
|
621
|
+
export function verifyDual(credential_json, ed25519_public_b64, mldsa_public_b64) {
|
|
622
|
+
try {
|
|
623
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
624
|
+
const ptr0 = passStringToWasm0(credential_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
625
|
+
const len0 = WASM_VECTOR_LEN;
|
|
626
|
+
const ptr1 = passStringToWasm0(ed25519_public_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
627
|
+
const len1 = WASM_VECTOR_LEN;
|
|
628
|
+
const ptr2 = passStringToWasm0(mldsa_public_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
629
|
+
const len2 = WASM_VECTOR_LEN;
|
|
630
|
+
wasm.verifyDual(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
631
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
632
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
633
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
634
|
+
if (r2) {
|
|
635
|
+
throw takeObject(r1);
|
|
636
|
+
}
|
|
637
|
+
return r0 !== 0;
|
|
638
|
+
} finally {
|
|
639
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* @param {string} credential_json
|
|
645
|
+
* @param {string} public_b64
|
|
646
|
+
* @returns {boolean}
|
|
647
|
+
*/
|
|
648
|
+
export function verifyProof(credential_json, public_b64) {
|
|
649
|
+
try {
|
|
650
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
651
|
+
const ptr0 = passStringToWasm0(credential_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
652
|
+
const len0 = WASM_VECTOR_LEN;
|
|
653
|
+
const ptr1 = passStringToWasm0(public_b64, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
654
|
+
const len1 = WASM_VECTOR_LEN;
|
|
655
|
+
wasm.verifyProof(retptr, ptr0, len0, ptr1, len1);
|
|
656
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
657
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
658
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
659
|
+
if (r2) {
|
|
660
|
+
throw takeObject(r1);
|
|
661
|
+
}
|
|
662
|
+
return r0 !== 0;
|
|
663
|
+
} finally {
|
|
664
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* @param {string} credential_status_json
|
|
670
|
+
* @param {string} status_list_credential_json
|
|
671
|
+
* @returns {boolean}
|
|
672
|
+
*/
|
|
673
|
+
export function verifyStatus(credential_status_json, status_list_credential_json) {
|
|
674
|
+
try {
|
|
675
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
676
|
+
const ptr0 = passStringToWasm0(credential_status_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
677
|
+
const len0 = WASM_VECTOR_LEN;
|
|
678
|
+
const ptr1 = passStringToWasm0(status_list_credential_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
679
|
+
const len1 = WASM_VECTOR_LEN;
|
|
680
|
+
wasm.verifyStatus(retptr, ptr0, len0, ptr1, len1);
|
|
681
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
682
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
683
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
684
|
+
if (r2) {
|
|
685
|
+
throw takeObject(r1);
|
|
686
|
+
}
|
|
687
|
+
return r0 !== 0;
|
|
688
|
+
} finally {
|
|
689
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
/**
|
|
694
|
+
* Library version (matches the crate version).
|
|
695
|
+
* @returns {string}
|
|
696
|
+
*/
|
|
697
|
+
export function version() {
|
|
698
|
+
let deferred1_0;
|
|
699
|
+
let deferred1_1;
|
|
700
|
+
try {
|
|
701
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
702
|
+
wasm.version(retptr);
|
|
703
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
704
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
705
|
+
deferred1_0 = r0;
|
|
706
|
+
deferred1_1 = r1;
|
|
707
|
+
return getStringFromWasm0(r0, r1);
|
|
708
|
+
} finally {
|
|
709
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
710
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
function __wbg_get_imports() {
|
|
714
|
+
const import0 = {
|
|
715
|
+
__proto__: null,
|
|
716
|
+
__wbg_Error_ef53bc310eb298a0: function(arg0, arg1) {
|
|
717
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
718
|
+
return addHeapObject(ret);
|
|
719
|
+
},
|
|
720
|
+
__wbg___wbindgen_is_function_754e9f305ff6029e: function(arg0) {
|
|
721
|
+
const ret = typeof(getObject(arg0)) === 'function';
|
|
722
|
+
return ret;
|
|
723
|
+
},
|
|
724
|
+
__wbg___wbindgen_is_object_56732c2bc353f41d: function(arg0) {
|
|
725
|
+
const val = getObject(arg0);
|
|
726
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
727
|
+
return ret;
|
|
728
|
+
},
|
|
729
|
+
__wbg___wbindgen_is_string_c236cabd84a4d769: function(arg0) {
|
|
730
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
731
|
+
return ret;
|
|
732
|
+
},
|
|
733
|
+
__wbg___wbindgen_is_undefined_67b456be8673d3d7: function(arg0) {
|
|
734
|
+
const ret = getObject(arg0) === undefined;
|
|
735
|
+
return ret;
|
|
736
|
+
},
|
|
737
|
+
__wbg___wbindgen_throw_1506f2235d1bdba0: function(arg0, arg1) {
|
|
738
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
739
|
+
},
|
|
740
|
+
__wbg_call_9c758de292015997: function() { return handleError(function (arg0, arg1, arg2) {
|
|
741
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
|
742
|
+
return addHeapObject(ret);
|
|
743
|
+
}, arguments); },
|
|
744
|
+
__wbg_crypto_38df2bab126b63dc: function(arg0) {
|
|
745
|
+
const ret = getObject(arg0).crypto;
|
|
746
|
+
return addHeapObject(ret);
|
|
747
|
+
},
|
|
748
|
+
__wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
|
|
749
|
+
getObject(arg0).getRandomValues(getObject(arg1));
|
|
750
|
+
}, arguments); },
|
|
751
|
+
__wbg_length_4a591ecaa01354d9: function(arg0) {
|
|
752
|
+
const ret = getObject(arg0).length;
|
|
753
|
+
return ret;
|
|
754
|
+
},
|
|
755
|
+
__wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
|
|
756
|
+
const ret = getObject(arg0).msCrypto;
|
|
757
|
+
return addHeapObject(ret);
|
|
758
|
+
},
|
|
759
|
+
__wbg_new_with_length_36a4998e27b014c5: function(arg0) {
|
|
760
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
761
|
+
return addHeapObject(ret);
|
|
762
|
+
},
|
|
763
|
+
__wbg_node_84ea875411254db1: function(arg0) {
|
|
764
|
+
const ret = getObject(arg0).node;
|
|
765
|
+
return addHeapObject(ret);
|
|
766
|
+
},
|
|
767
|
+
__wbg_process_44c7a14e11e9f69e: function(arg0) {
|
|
768
|
+
const ret = getObject(arg0).process;
|
|
769
|
+
return addHeapObject(ret);
|
|
770
|
+
},
|
|
771
|
+
__wbg_prototypesetcall_3249fc62a0fafa30: function(arg0, arg1, arg2) {
|
|
772
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
773
|
+
},
|
|
774
|
+
__wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
|
|
775
|
+
getObject(arg0).randomFillSync(takeObject(arg1));
|
|
776
|
+
}, arguments); },
|
|
777
|
+
__wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
|
|
778
|
+
const ret = module.require;
|
|
779
|
+
return addHeapObject(ret);
|
|
780
|
+
}, arguments); },
|
|
781
|
+
__wbg_static_accessor_GLOBAL_9d53f2689e622ca1: function() {
|
|
782
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
783
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
784
|
+
},
|
|
785
|
+
__wbg_static_accessor_GLOBAL_THIS_a1a35cec07001a8a: function() {
|
|
786
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
787
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
788
|
+
},
|
|
789
|
+
__wbg_static_accessor_SELF_4c59f6c7ea29a144: function() {
|
|
790
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
791
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
792
|
+
},
|
|
793
|
+
__wbg_static_accessor_WINDOW_e70ae9f2eb052253: function() {
|
|
794
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
795
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
796
|
+
},
|
|
797
|
+
__wbg_subarray_4aa221f6a4f5ab22: function(arg0, arg1, arg2) {
|
|
798
|
+
const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
|
|
799
|
+
return addHeapObject(ret);
|
|
800
|
+
},
|
|
801
|
+
__wbg_versions_276b2795b1c6a219: function(arg0) {
|
|
802
|
+
const ret = getObject(arg0).versions;
|
|
803
|
+
return addHeapObject(ret);
|
|
804
|
+
},
|
|
805
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
806
|
+
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
807
|
+
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
808
|
+
return addHeapObject(ret);
|
|
809
|
+
},
|
|
810
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
811
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
812
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
813
|
+
return addHeapObject(ret);
|
|
814
|
+
},
|
|
815
|
+
__wbindgen_object_clone_ref: function(arg0) {
|
|
816
|
+
const ret = getObject(arg0);
|
|
817
|
+
return addHeapObject(ret);
|
|
818
|
+
},
|
|
819
|
+
__wbindgen_object_drop_ref: function(arg0) {
|
|
820
|
+
takeObject(arg0);
|
|
821
|
+
},
|
|
822
|
+
};
|
|
823
|
+
return {
|
|
824
|
+
__proto__: null,
|
|
825
|
+
"./vouch_core_wasm_bg.js": import0,
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
function addHeapObject(obj) {
|
|
830
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
831
|
+
const idx = heap_next;
|
|
832
|
+
heap_next = heap[idx];
|
|
833
|
+
|
|
834
|
+
heap[idx] = obj;
|
|
835
|
+
return idx;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
function dropObject(idx) {
|
|
839
|
+
if (idx < 1028) return;
|
|
840
|
+
heap[idx] = heap_next;
|
|
841
|
+
heap_next = idx;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
845
|
+
ptr = ptr >>> 0;
|
|
846
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
let cachedDataViewMemory0 = null;
|
|
850
|
+
function getDataViewMemory0() {
|
|
851
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
852
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
853
|
+
}
|
|
854
|
+
return cachedDataViewMemory0;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
function getStringFromWasm0(ptr, len) {
|
|
858
|
+
return decodeText(ptr >>> 0, len);
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
let cachedUint8ArrayMemory0 = null;
|
|
862
|
+
function getUint8ArrayMemory0() {
|
|
863
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
864
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
865
|
+
}
|
|
866
|
+
return cachedUint8ArrayMemory0;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
function getObject(idx) { return heap[idx]; }
|
|
870
|
+
|
|
871
|
+
function handleError(f, args) {
|
|
872
|
+
try {
|
|
873
|
+
return f.apply(this, args);
|
|
874
|
+
} catch (e) {
|
|
875
|
+
wasm.__wbindgen_export(addHeapObject(e));
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
let heap = new Array(1024).fill(undefined);
|
|
880
|
+
heap.push(undefined, null, true, false);
|
|
881
|
+
|
|
882
|
+
let heap_next = heap.length;
|
|
883
|
+
|
|
884
|
+
function isLikeNone(x) {
|
|
885
|
+
return x === undefined || x === null;
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
889
|
+
if (realloc === undefined) {
|
|
890
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
891
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
892
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
893
|
+
WASM_VECTOR_LEN = buf.length;
|
|
894
|
+
return ptr;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
let len = arg.length;
|
|
898
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
899
|
+
|
|
900
|
+
const mem = getUint8ArrayMemory0();
|
|
901
|
+
|
|
902
|
+
let offset = 0;
|
|
903
|
+
|
|
904
|
+
for (; offset < len; offset++) {
|
|
905
|
+
const code = arg.charCodeAt(offset);
|
|
906
|
+
if (code > 0x7F) break;
|
|
907
|
+
mem[ptr + offset] = code;
|
|
908
|
+
}
|
|
909
|
+
if (offset !== len) {
|
|
910
|
+
if (offset !== 0) {
|
|
911
|
+
arg = arg.slice(offset);
|
|
912
|
+
}
|
|
913
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
914
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
915
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
916
|
+
|
|
917
|
+
offset += ret.written;
|
|
918
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
WASM_VECTOR_LEN = offset;
|
|
922
|
+
return ptr;
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
function takeObject(idx) {
|
|
926
|
+
const ret = getObject(idx);
|
|
927
|
+
dropObject(idx);
|
|
928
|
+
return ret;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
932
|
+
cachedTextDecoder.decode();
|
|
933
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
934
|
+
let numBytesDecoded = 0;
|
|
935
|
+
function decodeText(ptr, len) {
|
|
936
|
+
numBytesDecoded += len;
|
|
937
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
938
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
939
|
+
cachedTextDecoder.decode();
|
|
940
|
+
numBytesDecoded = len;
|
|
941
|
+
}
|
|
942
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
const cachedTextEncoder = new TextEncoder();
|
|
946
|
+
|
|
947
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
948
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
949
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
950
|
+
view.set(buf);
|
|
951
|
+
return {
|
|
952
|
+
read: arg.length,
|
|
953
|
+
written: buf.length
|
|
954
|
+
};
|
|
955
|
+
};
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
let WASM_VECTOR_LEN = 0;
|
|
959
|
+
|
|
960
|
+
let wasmModule, wasmInstance, wasm;
|
|
961
|
+
function __wbg_finalize_init(instance, module) {
|
|
962
|
+
wasmInstance = instance;
|
|
963
|
+
wasm = instance.exports;
|
|
964
|
+
wasmModule = module;
|
|
965
|
+
cachedDataViewMemory0 = null;
|
|
966
|
+
cachedUint8ArrayMemory0 = null;
|
|
967
|
+
return wasm;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
async function __wbg_load(module, imports) {
|
|
971
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
972
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
973
|
+
try {
|
|
974
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
975
|
+
} catch (e) {
|
|
976
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
977
|
+
|
|
978
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
979
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
980
|
+
|
|
981
|
+
} else { throw e; }
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
const bytes = await module.arrayBuffer();
|
|
986
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
987
|
+
} else {
|
|
988
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
989
|
+
|
|
990
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
991
|
+
return { instance, module };
|
|
992
|
+
} else {
|
|
993
|
+
return instance;
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
function expectedResponseType(type) {
|
|
998
|
+
switch (type) {
|
|
999
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
1000
|
+
}
|
|
1001
|
+
return false;
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
function initSync(module) {
|
|
1006
|
+
if (wasm !== undefined) return wasm;
|
|
1007
|
+
|
|
1008
|
+
|
|
1009
|
+
if (module !== undefined) {
|
|
1010
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
1011
|
+
({module} = module)
|
|
1012
|
+
} else {
|
|
1013
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
const imports = __wbg_get_imports();
|
|
1018
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
1019
|
+
module = new WebAssembly.Module(module);
|
|
1020
|
+
}
|
|
1021
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
1022
|
+
return __wbg_finalize_init(instance, module);
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
async function __wbg_init(module_or_path) {
|
|
1026
|
+
if (wasm !== undefined) return wasm;
|
|
1027
|
+
|
|
1028
|
+
|
|
1029
|
+
if (module_or_path !== undefined) {
|
|
1030
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
1031
|
+
({module_or_path} = module_or_path)
|
|
1032
|
+
} else {
|
|
1033
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
if (module_or_path === undefined) {
|
|
1038
|
+
module_or_path = new URL('vouch_core_wasm_bg.wasm', import.meta.url);
|
|
1039
|
+
}
|
|
1040
|
+
const imports = __wbg_get_imports();
|
|
1041
|
+
|
|
1042
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
1043
|
+
module_or_path = fetch(module_or_path);
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
1047
|
+
|
|
1048
|
+
return __wbg_finalize_init(instance, module);
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
export { initSync, __wbg_init as default };
|