@worldcoin/idkit-core 2.0.2 → 4.0.0-dev.777cdbe
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/README.md +101 -0
- package/dist/idkit_wasm_bg.wasm +0 -0
- package/dist/index.cjs +2113 -0
- package/dist/index.d.cts +763 -0
- package/dist/index.d.ts +763 -0
- package/dist/index.js +2098 -0
- package/package.json +34 -62
- package/LICENSE +0 -7
- package/build/chunk-HZ2SQA5V.js +0 -50
- package/build/config-fuwC_Hia.d.cts +0 -41
- package/build/config-fuwC_Hia.d.ts +0 -41
- package/build/index.cjs +0 -331
- package/build/index.d.cts +0 -30
- package/build/index.d.ts +0 -30
- package/build/index.js +0 -266
- package/build/lib/backend.cjs +0 -70
- package/build/lib/backend.d.cts +0 -12
- package/build/lib/backend.d.ts +0 -12
- package/build/lib/backend.js +0 -30
- package/build/lib/hashing.cjs +0 -78
- package/build/lib/hashing.d.cts +0 -21
- package/build/lib/hashing.d.ts +0 -21
- package/build/lib/hashing.js +0 -14
- package/build/result-BZ4QXOc2.d.cts +0 -35
- package/build/result-CqgtArQe.d.ts +0 -35
package/dist/index.js
ADDED
|
@@ -0,0 +1,2098 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __export = (target, all2) => {
|
|
3
|
+
for (var name in all2)
|
|
4
|
+
__defProp(target, name, { get: all2[name], enumerable: true });
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
// src/types/result.ts
|
|
8
|
+
var IDKitErrorCodes = /* @__PURE__ */ ((IDKitErrorCodes2) => {
|
|
9
|
+
IDKitErrorCodes2["UserRejected"] = "user_rejected";
|
|
10
|
+
IDKitErrorCodes2["VerificationRejected"] = "verification_rejected";
|
|
11
|
+
IDKitErrorCodes2["CredentialUnavailable"] = "credential_unavailable";
|
|
12
|
+
IDKitErrorCodes2["MalformedRequest"] = "malformed_request";
|
|
13
|
+
IDKitErrorCodes2["InvalidNetwork"] = "invalid_network";
|
|
14
|
+
IDKitErrorCodes2["InclusionProofPending"] = "inclusion_proof_pending";
|
|
15
|
+
IDKitErrorCodes2["InclusionProofFailed"] = "inclusion_proof_failed";
|
|
16
|
+
IDKitErrorCodes2["UnexpectedResponse"] = "unexpected_response";
|
|
17
|
+
IDKitErrorCodes2["ConnectionFailed"] = "connection_failed";
|
|
18
|
+
IDKitErrorCodes2["MaxVerificationsReached"] = "max_verifications_reached";
|
|
19
|
+
IDKitErrorCodes2["FailedByHostApp"] = "failed_by_host_app";
|
|
20
|
+
IDKitErrorCodes2["GenericError"] = "generic_error";
|
|
21
|
+
IDKitErrorCodes2["Timeout"] = "timeout";
|
|
22
|
+
IDKitErrorCodes2["Cancelled"] = "cancelled";
|
|
23
|
+
return IDKitErrorCodes2;
|
|
24
|
+
})(IDKitErrorCodes || {});
|
|
25
|
+
|
|
26
|
+
// wasm/idkit_wasm.js
|
|
27
|
+
var idkit_wasm_exports = {};
|
|
28
|
+
__export(idkit_wasm_exports, {
|
|
29
|
+
BridgeEncryption: () => BridgeEncryption,
|
|
30
|
+
CredentialRequestWasm: () => CredentialRequestWasm,
|
|
31
|
+
IDKitBuilder: () => IDKitBuilder,
|
|
32
|
+
IDKitProof: () => IDKitProof,
|
|
33
|
+
IDKitRequest: () => IDKitRequest,
|
|
34
|
+
RpContextWasm: () => RpContextWasm,
|
|
35
|
+
RpSignature: () => RpSignature,
|
|
36
|
+
base64Decode: () => base64Decode,
|
|
37
|
+
base64Encode: () => base64Encode,
|
|
38
|
+
createSession: () => createSession,
|
|
39
|
+
default: () => idkit_wasm_default,
|
|
40
|
+
hashSignal: () => hashSignal,
|
|
41
|
+
initSync: () => initSync,
|
|
42
|
+
init_wasm: () => init_wasm,
|
|
43
|
+
proveSession: () => proveSession,
|
|
44
|
+
request: () => request,
|
|
45
|
+
signRequest: () => signRequest
|
|
46
|
+
});
|
|
47
|
+
var wasm;
|
|
48
|
+
var cachedUint8ArrayMemory0 = null;
|
|
49
|
+
function getUint8ArrayMemory0() {
|
|
50
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
51
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
52
|
+
}
|
|
53
|
+
return cachedUint8ArrayMemory0;
|
|
54
|
+
}
|
|
55
|
+
var cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
|
|
56
|
+
cachedTextDecoder.decode();
|
|
57
|
+
var MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
58
|
+
var numBytesDecoded = 0;
|
|
59
|
+
function decodeText(ptr, len) {
|
|
60
|
+
numBytesDecoded += len;
|
|
61
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
62
|
+
cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
|
|
63
|
+
cachedTextDecoder.decode();
|
|
64
|
+
numBytesDecoded = len;
|
|
65
|
+
}
|
|
66
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
67
|
+
}
|
|
68
|
+
function getStringFromWasm0(ptr, len) {
|
|
69
|
+
ptr = ptr >>> 0;
|
|
70
|
+
return decodeText(ptr, len);
|
|
71
|
+
}
|
|
72
|
+
var heap = new Array(128).fill(void 0);
|
|
73
|
+
heap.push(void 0, null, true, false);
|
|
74
|
+
var heap_next = heap.length;
|
|
75
|
+
function addHeapObject(obj) {
|
|
76
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
77
|
+
const idx = heap_next;
|
|
78
|
+
heap_next = heap[idx];
|
|
79
|
+
heap[idx] = obj;
|
|
80
|
+
return idx;
|
|
81
|
+
}
|
|
82
|
+
function getObject(idx) {
|
|
83
|
+
return heap[idx];
|
|
84
|
+
}
|
|
85
|
+
var WASM_VECTOR_LEN = 0;
|
|
86
|
+
var cachedTextEncoder = new TextEncoder();
|
|
87
|
+
if (!("encodeInto" in cachedTextEncoder)) {
|
|
88
|
+
cachedTextEncoder.encodeInto = function(arg, view) {
|
|
89
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
90
|
+
view.set(buf);
|
|
91
|
+
return {
|
|
92
|
+
read: arg.length,
|
|
93
|
+
written: buf.length
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
98
|
+
if (realloc === void 0) {
|
|
99
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
100
|
+
const ptr2 = malloc(buf.length, 1) >>> 0;
|
|
101
|
+
getUint8ArrayMemory0().subarray(ptr2, ptr2 + buf.length).set(buf);
|
|
102
|
+
WASM_VECTOR_LEN = buf.length;
|
|
103
|
+
return ptr2;
|
|
104
|
+
}
|
|
105
|
+
let len = arg.length;
|
|
106
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
107
|
+
const mem = getUint8ArrayMemory0();
|
|
108
|
+
let offset = 0;
|
|
109
|
+
for (; offset < len; offset++) {
|
|
110
|
+
const code = arg.charCodeAt(offset);
|
|
111
|
+
if (code > 127) break;
|
|
112
|
+
mem[ptr + offset] = code;
|
|
113
|
+
}
|
|
114
|
+
if (offset !== len) {
|
|
115
|
+
if (offset !== 0) {
|
|
116
|
+
arg = arg.slice(offset);
|
|
117
|
+
}
|
|
118
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
119
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
120
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
121
|
+
offset += ret.written;
|
|
122
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
123
|
+
}
|
|
124
|
+
WASM_VECTOR_LEN = offset;
|
|
125
|
+
return ptr;
|
|
126
|
+
}
|
|
127
|
+
var cachedDataViewMemory0 = null;
|
|
128
|
+
function getDataViewMemory0() {
|
|
129
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === void 0 && cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
|
|
130
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
131
|
+
}
|
|
132
|
+
return cachedDataViewMemory0;
|
|
133
|
+
}
|
|
134
|
+
function isLikeNone(x) {
|
|
135
|
+
return x === void 0 || x === null;
|
|
136
|
+
}
|
|
137
|
+
function debugString(val) {
|
|
138
|
+
const type = typeof val;
|
|
139
|
+
if (type == "number" || type == "boolean" || val == null) {
|
|
140
|
+
return `${val}`;
|
|
141
|
+
}
|
|
142
|
+
if (type == "string") {
|
|
143
|
+
return `"${val}"`;
|
|
144
|
+
}
|
|
145
|
+
if (type == "symbol") {
|
|
146
|
+
const description = val.description;
|
|
147
|
+
if (description == null) {
|
|
148
|
+
return "Symbol";
|
|
149
|
+
} else {
|
|
150
|
+
return `Symbol(${description})`;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (type == "function") {
|
|
154
|
+
const name = val.name;
|
|
155
|
+
if (typeof name == "string" && name.length > 0) {
|
|
156
|
+
return `Function(${name})`;
|
|
157
|
+
} else {
|
|
158
|
+
return "Function";
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if (Array.isArray(val)) {
|
|
162
|
+
const length = val.length;
|
|
163
|
+
let debug = "[";
|
|
164
|
+
if (length > 0) {
|
|
165
|
+
debug += debugString(val[0]);
|
|
166
|
+
}
|
|
167
|
+
for (let i = 1; i < length; i++) {
|
|
168
|
+
debug += ", " + debugString(val[i]);
|
|
169
|
+
}
|
|
170
|
+
debug += "]";
|
|
171
|
+
return debug;
|
|
172
|
+
}
|
|
173
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
174
|
+
let className;
|
|
175
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
176
|
+
className = builtInMatches[1];
|
|
177
|
+
} else {
|
|
178
|
+
return toString.call(val);
|
|
179
|
+
}
|
|
180
|
+
if (className == "Object") {
|
|
181
|
+
try {
|
|
182
|
+
return "Object(" + JSON.stringify(val) + ")";
|
|
183
|
+
} catch (_) {
|
|
184
|
+
return "Object";
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (val instanceof Error) {
|
|
188
|
+
return `${val.name}: ${val.message}
|
|
189
|
+
${val.stack}`;
|
|
190
|
+
}
|
|
191
|
+
return className;
|
|
192
|
+
}
|
|
193
|
+
function handleError(f, args) {
|
|
194
|
+
try {
|
|
195
|
+
return f.apply(this, args);
|
|
196
|
+
} catch (e) {
|
|
197
|
+
wasm.__wbindgen_export3(addHeapObject(e));
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
function dropObject(idx) {
|
|
201
|
+
if (idx < 132) return;
|
|
202
|
+
heap[idx] = heap_next;
|
|
203
|
+
heap_next = idx;
|
|
204
|
+
}
|
|
205
|
+
function takeObject(idx) {
|
|
206
|
+
const ret = getObject(idx);
|
|
207
|
+
dropObject(idx);
|
|
208
|
+
return ret;
|
|
209
|
+
}
|
|
210
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
211
|
+
ptr = ptr >>> 0;
|
|
212
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
213
|
+
}
|
|
214
|
+
var CLOSURE_DTORS = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
215
|
+
}, unregister: () => {
|
|
216
|
+
} } : new FinalizationRegistry((state) => state.dtor(state.a, state.b));
|
|
217
|
+
function makeMutClosure(arg0, arg1, dtor, f) {
|
|
218
|
+
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
219
|
+
const real = (...args) => {
|
|
220
|
+
state.cnt++;
|
|
221
|
+
const a = state.a;
|
|
222
|
+
state.a = 0;
|
|
223
|
+
try {
|
|
224
|
+
return f(a, state.b, ...args);
|
|
225
|
+
} finally {
|
|
226
|
+
state.a = a;
|
|
227
|
+
real._wbg_cb_unref();
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
real._wbg_cb_unref = () => {
|
|
231
|
+
if (--state.cnt === 0) {
|
|
232
|
+
state.dtor(state.a, state.b);
|
|
233
|
+
state.a = 0;
|
|
234
|
+
CLOSURE_DTORS.unregister(state);
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
238
|
+
return real;
|
|
239
|
+
}
|
|
240
|
+
function _assertClass(instance, klass) {
|
|
241
|
+
if (!(instance instanceof klass)) {
|
|
242
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
function request(app_id, action, rp_context, action_description, bridge_url, allow_legacy_proofs, override_connect_base_url, environment) {
|
|
246
|
+
const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
247
|
+
const len0 = WASM_VECTOR_LEN;
|
|
248
|
+
const ptr1 = passStringToWasm0(action, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
249
|
+
const len1 = WASM_VECTOR_LEN;
|
|
250
|
+
_assertClass(rp_context, RpContextWasm);
|
|
251
|
+
var ptr2 = rp_context.__destroy_into_raw();
|
|
252
|
+
var ptr3 = isLikeNone(action_description) ? 0 : passStringToWasm0(action_description, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
253
|
+
var len3 = WASM_VECTOR_LEN;
|
|
254
|
+
var ptr4 = isLikeNone(bridge_url) ? 0 : passStringToWasm0(bridge_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
255
|
+
var len4 = WASM_VECTOR_LEN;
|
|
256
|
+
var ptr5 = isLikeNone(override_connect_base_url) ? 0 : passStringToWasm0(override_connect_base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
257
|
+
var len5 = WASM_VECTOR_LEN;
|
|
258
|
+
var ptr6 = isLikeNone(environment) ? 0 : passStringToWasm0(environment, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
259
|
+
var len6 = WASM_VECTOR_LEN;
|
|
260
|
+
const ret = wasm.idkitbuilder_new(ptr0, len0, ptr1, len1, ptr2, ptr3, len3, ptr4, len4, allow_legacy_proofs, ptr5, len5, ptr6, len6);
|
|
261
|
+
return IDKitBuilder.__wrap(ret);
|
|
262
|
+
}
|
|
263
|
+
function init_wasm() {
|
|
264
|
+
wasm.init_wasm();
|
|
265
|
+
}
|
|
266
|
+
function base64Decode(data) {
|
|
267
|
+
try {
|
|
268
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
269
|
+
const ptr0 = passStringToWasm0(data, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
270
|
+
const len0 = WASM_VECTOR_LEN;
|
|
271
|
+
wasm.base64Decode(retptr, ptr0, len0);
|
|
272
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
273
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
274
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
275
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
276
|
+
if (r3) {
|
|
277
|
+
throw takeObject(r2);
|
|
278
|
+
}
|
|
279
|
+
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
280
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
281
|
+
return v2;
|
|
282
|
+
} finally {
|
|
283
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
function proveSession(session_id, app_id, rp_context, action_description, bridge_url, override_connect_base_url, environment) {
|
|
287
|
+
const ptr0 = passStringToWasm0(session_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
288
|
+
const len0 = WASM_VECTOR_LEN;
|
|
289
|
+
const ptr1 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
290
|
+
const len1 = WASM_VECTOR_LEN;
|
|
291
|
+
_assertClass(rp_context, RpContextWasm);
|
|
292
|
+
var ptr2 = rp_context.__destroy_into_raw();
|
|
293
|
+
var ptr3 = isLikeNone(action_description) ? 0 : passStringToWasm0(action_description, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
294
|
+
var len3 = WASM_VECTOR_LEN;
|
|
295
|
+
var ptr4 = isLikeNone(bridge_url) ? 0 : passStringToWasm0(bridge_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
296
|
+
var len4 = WASM_VECTOR_LEN;
|
|
297
|
+
var ptr5 = isLikeNone(override_connect_base_url) ? 0 : passStringToWasm0(override_connect_base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
298
|
+
var len5 = WASM_VECTOR_LEN;
|
|
299
|
+
var ptr6 = isLikeNone(environment) ? 0 : passStringToWasm0(environment, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
300
|
+
var len6 = WASM_VECTOR_LEN;
|
|
301
|
+
const ret = wasm.idkitbuilder_forProveSession(ptr0, len0, ptr1, len1, ptr2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6);
|
|
302
|
+
return IDKitBuilder.__wrap(ret);
|
|
303
|
+
}
|
|
304
|
+
function createSession(app_id, rp_context, action_description, bridge_url, override_connect_base_url, environment) {
|
|
305
|
+
const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
306
|
+
const len0 = WASM_VECTOR_LEN;
|
|
307
|
+
_assertClass(rp_context, RpContextWasm);
|
|
308
|
+
var ptr1 = rp_context.__destroy_into_raw();
|
|
309
|
+
var ptr2 = isLikeNone(action_description) ? 0 : passStringToWasm0(action_description, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
310
|
+
var len2 = WASM_VECTOR_LEN;
|
|
311
|
+
var ptr3 = isLikeNone(bridge_url) ? 0 : passStringToWasm0(bridge_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
312
|
+
var len3 = WASM_VECTOR_LEN;
|
|
313
|
+
var ptr4 = isLikeNone(override_connect_base_url) ? 0 : passStringToWasm0(override_connect_base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
314
|
+
var len4 = WASM_VECTOR_LEN;
|
|
315
|
+
var ptr5 = isLikeNone(environment) ? 0 : passStringToWasm0(environment, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
316
|
+
var len5 = WASM_VECTOR_LEN;
|
|
317
|
+
const ret = wasm.createSession(ptr0, len0, ptr1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5);
|
|
318
|
+
return IDKitBuilder.__wrap(ret);
|
|
319
|
+
}
|
|
320
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
321
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
322
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
323
|
+
WASM_VECTOR_LEN = arg.length;
|
|
324
|
+
return ptr;
|
|
325
|
+
}
|
|
326
|
+
function base64Encode(data) {
|
|
327
|
+
let deferred2_0;
|
|
328
|
+
let deferred2_1;
|
|
329
|
+
try {
|
|
330
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
331
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export);
|
|
332
|
+
const len0 = WASM_VECTOR_LEN;
|
|
333
|
+
wasm.base64Encode(retptr, ptr0, len0);
|
|
334
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
335
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
336
|
+
deferred2_0 = r0;
|
|
337
|
+
deferred2_1 = r1;
|
|
338
|
+
return getStringFromWasm0(r0, r1);
|
|
339
|
+
} finally {
|
|
340
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
341
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
function hashSignal(signal) {
|
|
345
|
+
let deferred2_0;
|
|
346
|
+
let deferred2_1;
|
|
347
|
+
try {
|
|
348
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
349
|
+
wasm.hashSignal(retptr, addHeapObject(signal));
|
|
350
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
351
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
352
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
353
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
354
|
+
var ptr1 = r0;
|
|
355
|
+
var len1 = r1;
|
|
356
|
+
if (r3) {
|
|
357
|
+
ptr1 = 0;
|
|
358
|
+
len1 = 0;
|
|
359
|
+
throw takeObject(r2);
|
|
360
|
+
}
|
|
361
|
+
deferred2_0 = ptr1;
|
|
362
|
+
deferred2_1 = len1;
|
|
363
|
+
return getStringFromWasm0(ptr1, len1);
|
|
364
|
+
} finally {
|
|
365
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
366
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
function signRequest(action, signing_key_hex, ttl_seconds) {
|
|
370
|
+
try {
|
|
371
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
372
|
+
const ptr0 = passStringToWasm0(action, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
373
|
+
const len0 = WASM_VECTOR_LEN;
|
|
374
|
+
const ptr1 = passStringToWasm0(signing_key_hex, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
375
|
+
const len1 = WASM_VECTOR_LEN;
|
|
376
|
+
wasm.signRequest(retptr, ptr0, len0, ptr1, len1, !isLikeNone(ttl_seconds), isLikeNone(ttl_seconds) ? BigInt(0) : ttl_seconds);
|
|
377
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
378
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
379
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
380
|
+
if (r2) {
|
|
381
|
+
throw takeObject(r1);
|
|
382
|
+
}
|
|
383
|
+
return RpSignature.__wrap(r0);
|
|
384
|
+
} finally {
|
|
385
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
function __wasm_bindgen_func_elem_960(arg0, arg1, arg2) {
|
|
389
|
+
wasm.__wasm_bindgen_func_elem_960(arg0, arg1, addHeapObject(arg2));
|
|
390
|
+
}
|
|
391
|
+
function __wasm_bindgen_func_elem_597(arg0, arg1) {
|
|
392
|
+
wasm.__wasm_bindgen_func_elem_597(arg0, arg1);
|
|
393
|
+
}
|
|
394
|
+
function __wasm_bindgen_func_elem_1343(arg0, arg1, arg2, arg3) {
|
|
395
|
+
wasm.__wasm_bindgen_func_elem_1343(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
396
|
+
}
|
|
397
|
+
var __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
|
|
398
|
+
var __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
|
|
399
|
+
var __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
|
|
400
|
+
var BridgeEncryptionFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
401
|
+
}, unregister: () => {
|
|
402
|
+
} } : new FinalizationRegistry((ptr) => wasm.__wbg_bridgeencryption_free(ptr >>> 0, 1));
|
|
403
|
+
var BridgeEncryption = class {
|
|
404
|
+
__destroy_into_raw() {
|
|
405
|
+
const ptr = this.__wbg_ptr;
|
|
406
|
+
this.__wbg_ptr = 0;
|
|
407
|
+
BridgeEncryptionFinalization.unregister(this);
|
|
408
|
+
return ptr;
|
|
409
|
+
}
|
|
410
|
+
free() {
|
|
411
|
+
const ptr = this.__destroy_into_raw();
|
|
412
|
+
wasm.__wbg_bridgeencryption_free(ptr, 0);
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Returns the key as a base64-encoded string
|
|
416
|
+
* @returns {string}
|
|
417
|
+
*/
|
|
418
|
+
keyBase64() {
|
|
419
|
+
let deferred1_0;
|
|
420
|
+
let deferred1_1;
|
|
421
|
+
try {
|
|
422
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
423
|
+
wasm.bridgeencryption_keyBase64(retptr, this.__wbg_ptr);
|
|
424
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
425
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
426
|
+
deferred1_0 = r0;
|
|
427
|
+
deferred1_1 = r1;
|
|
428
|
+
return getStringFromWasm0(r0, r1);
|
|
429
|
+
} finally {
|
|
430
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
431
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Returns the nonce as a base64-encoded string
|
|
436
|
+
* @returns {string}
|
|
437
|
+
*/
|
|
438
|
+
nonceBase64() {
|
|
439
|
+
let deferred1_0;
|
|
440
|
+
let deferred1_1;
|
|
441
|
+
try {
|
|
442
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
443
|
+
wasm.bridgeencryption_nonceBase64(retptr, this.__wbg_ptr);
|
|
444
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
445
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
446
|
+
deferred1_0 = r0;
|
|
447
|
+
deferred1_1 = r1;
|
|
448
|
+
return getStringFromWasm0(r0, r1);
|
|
449
|
+
} finally {
|
|
450
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
451
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Creates a new `BridgeEncryption` instance with randomly generated key and nonce
|
|
456
|
+
*
|
|
457
|
+
* # Errors
|
|
458
|
+
*
|
|
459
|
+
* Returns an error if key generation fails
|
|
460
|
+
*/
|
|
461
|
+
constructor() {
|
|
462
|
+
try {
|
|
463
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
464
|
+
wasm.bridgeencryption_new(retptr);
|
|
465
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
466
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
467
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
468
|
+
if (r2) {
|
|
469
|
+
throw takeObject(r1);
|
|
470
|
+
}
|
|
471
|
+
this.__wbg_ptr = r0 >>> 0;
|
|
472
|
+
BridgeEncryptionFinalization.register(this, this.__wbg_ptr, this);
|
|
473
|
+
return this;
|
|
474
|
+
} finally {
|
|
475
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Decrypts a base64-encoded ciphertext using AES-256-GCM
|
|
480
|
+
*
|
|
481
|
+
* # Errors
|
|
482
|
+
*
|
|
483
|
+
* Returns an error if decryption fails or the output is not valid UTF-8
|
|
484
|
+
* @param {string} ciphertext_base64
|
|
485
|
+
* @returns {string}
|
|
486
|
+
*/
|
|
487
|
+
decrypt(ciphertext_base64) {
|
|
488
|
+
let deferred3_0;
|
|
489
|
+
let deferred3_1;
|
|
490
|
+
try {
|
|
491
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
492
|
+
const ptr0 = passStringToWasm0(ciphertext_base64, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
493
|
+
const len0 = WASM_VECTOR_LEN;
|
|
494
|
+
wasm.bridgeencryption_decrypt(retptr, this.__wbg_ptr, ptr0, len0);
|
|
495
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
496
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
497
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
498
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
499
|
+
var ptr2 = r0;
|
|
500
|
+
var len2 = r1;
|
|
501
|
+
if (r3) {
|
|
502
|
+
ptr2 = 0;
|
|
503
|
+
len2 = 0;
|
|
504
|
+
throw takeObject(r2);
|
|
505
|
+
}
|
|
506
|
+
deferred3_0 = ptr2;
|
|
507
|
+
deferred3_1 = len2;
|
|
508
|
+
return getStringFromWasm0(ptr2, len2);
|
|
509
|
+
} finally {
|
|
510
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
511
|
+
wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Encrypts a plaintext string using AES-256-GCM and returns base64
|
|
516
|
+
*
|
|
517
|
+
* # Errors
|
|
518
|
+
*
|
|
519
|
+
* Returns an error if encryption fails
|
|
520
|
+
* @param {string} plaintext
|
|
521
|
+
* @returns {string}
|
|
522
|
+
*/
|
|
523
|
+
encrypt(plaintext) {
|
|
524
|
+
let deferred3_0;
|
|
525
|
+
let deferred3_1;
|
|
526
|
+
try {
|
|
527
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
528
|
+
const ptr0 = passStringToWasm0(plaintext, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
529
|
+
const len0 = WASM_VECTOR_LEN;
|
|
530
|
+
wasm.bridgeencryption_encrypt(retptr, this.__wbg_ptr, ptr0, len0);
|
|
531
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
532
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
533
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
534
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
535
|
+
var ptr2 = r0;
|
|
536
|
+
var len2 = r1;
|
|
537
|
+
if (r3) {
|
|
538
|
+
ptr2 = 0;
|
|
539
|
+
len2 = 0;
|
|
540
|
+
throw takeObject(r2);
|
|
541
|
+
}
|
|
542
|
+
deferred3_0 = ptr2;
|
|
543
|
+
deferred3_1 = len2;
|
|
544
|
+
return getStringFromWasm0(ptr2, len2);
|
|
545
|
+
} finally {
|
|
546
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
547
|
+
wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
if (Symbol.dispose) BridgeEncryption.prototype[Symbol.dispose] = BridgeEncryption.prototype.free;
|
|
552
|
+
var CredentialRequestWasmFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
553
|
+
}, unregister: () => {
|
|
554
|
+
} } : new FinalizationRegistry((ptr) => wasm.__wbg_credentialrequestwasm_free(ptr >>> 0, 1));
|
|
555
|
+
var CredentialRequestWasm = class _CredentialRequestWasm {
|
|
556
|
+
static __wrap(ptr) {
|
|
557
|
+
ptr = ptr >>> 0;
|
|
558
|
+
const obj = Object.create(_CredentialRequestWasm.prototype);
|
|
559
|
+
obj.__wbg_ptr = ptr;
|
|
560
|
+
CredentialRequestWasmFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
561
|
+
return obj;
|
|
562
|
+
}
|
|
563
|
+
__destroy_into_raw() {
|
|
564
|
+
const ptr = this.__wbg_ptr;
|
|
565
|
+
this.__wbg_ptr = 0;
|
|
566
|
+
CredentialRequestWasmFinalization.unregister(this);
|
|
567
|
+
return ptr;
|
|
568
|
+
}
|
|
569
|
+
free() {
|
|
570
|
+
const ptr = this.__destroy_into_raw();
|
|
571
|
+
wasm.__wbg_credentialrequestwasm_free(ptr, 0);
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Creates a new request item with raw bytes for the signal
|
|
575
|
+
*
|
|
576
|
+
* # Errors
|
|
577
|
+
*
|
|
578
|
+
* Returns an error if the credential type is invalid
|
|
579
|
+
* @param {any} credential_type
|
|
580
|
+
* @param {Uint8Array} signal_bytes
|
|
581
|
+
* @returns {CredentialRequestWasm}
|
|
582
|
+
*/
|
|
583
|
+
static withBytes(credential_type, signal_bytes) {
|
|
584
|
+
try {
|
|
585
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
586
|
+
const ptr0 = passArray8ToWasm0(signal_bytes, wasm.__wbindgen_export);
|
|
587
|
+
const len0 = WASM_VECTOR_LEN;
|
|
588
|
+
wasm.credentialrequestwasm_withBytes(retptr, addHeapObject(credential_type), ptr0, len0);
|
|
589
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
590
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
591
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
592
|
+
if (r2) {
|
|
593
|
+
throw takeObject(r1);
|
|
594
|
+
}
|
|
595
|
+
return _CredentialRequestWasm.__wrap(r0);
|
|
596
|
+
} finally {
|
|
597
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Gets the credential type
|
|
602
|
+
* @returns {any}
|
|
603
|
+
*/
|
|
604
|
+
credentialType() {
|
|
605
|
+
const ret = wasm.credentialrequestwasm_credentialType(this.__wbg_ptr);
|
|
606
|
+
return takeObject(ret);
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* Gets the signal as raw bytes
|
|
610
|
+
* @returns {Uint8Array | undefined}
|
|
611
|
+
*/
|
|
612
|
+
getSignalBytes() {
|
|
613
|
+
try {
|
|
614
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
615
|
+
wasm.credentialrequestwasm_getSignalBytes(retptr, this.__wbg_ptr);
|
|
616
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
617
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
618
|
+
let v1;
|
|
619
|
+
if (r0 !== 0) {
|
|
620
|
+
v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
621
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
622
|
+
}
|
|
623
|
+
return v1;
|
|
624
|
+
} finally {
|
|
625
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
/**
|
|
629
|
+
* Creates a new request item with genesis minimum timestamp
|
|
630
|
+
*
|
|
631
|
+
* # Errors
|
|
632
|
+
*
|
|
633
|
+
* Returns an error if the credential type is invalid
|
|
634
|
+
* @param {any} credential_type
|
|
635
|
+
* @param {string | null | undefined} signal
|
|
636
|
+
* @param {bigint} genesis_min
|
|
637
|
+
* @returns {CredentialRequestWasm}
|
|
638
|
+
*/
|
|
639
|
+
static withGenesisMin(credential_type, signal, genesis_min) {
|
|
640
|
+
try {
|
|
641
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
642
|
+
var ptr0 = isLikeNone(signal) ? 0 : passStringToWasm0(signal, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
643
|
+
var len0 = WASM_VECTOR_LEN;
|
|
644
|
+
wasm.credentialrequestwasm_withGenesisMin(retptr, addHeapObject(credential_type), ptr0, len0, genesis_min);
|
|
645
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
646
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
647
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
648
|
+
if (r2) {
|
|
649
|
+
throw takeObject(r1);
|
|
650
|
+
}
|
|
651
|
+
return _CredentialRequestWasm.__wrap(r0);
|
|
652
|
+
} finally {
|
|
653
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* Creates a new request item with expiration minimum timestamp
|
|
658
|
+
*
|
|
659
|
+
* # Errors
|
|
660
|
+
*
|
|
661
|
+
* Returns an error if the credential type is invalid
|
|
662
|
+
* @param {any} credential_type
|
|
663
|
+
* @param {string | null | undefined} signal
|
|
664
|
+
* @param {bigint} expires_at_min
|
|
665
|
+
* @returns {CredentialRequestWasm}
|
|
666
|
+
*/
|
|
667
|
+
static withExpiresAtMin(credential_type, signal, expires_at_min) {
|
|
668
|
+
try {
|
|
669
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
670
|
+
var ptr0 = isLikeNone(signal) ? 0 : passStringToWasm0(signal, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
671
|
+
var len0 = WASM_VECTOR_LEN;
|
|
672
|
+
wasm.credentialrequestwasm_withExpiresAtMin(retptr, addHeapObject(credential_type), ptr0, len0, expires_at_min);
|
|
673
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
674
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
675
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
676
|
+
if (r2) {
|
|
677
|
+
throw takeObject(r1);
|
|
678
|
+
}
|
|
679
|
+
return _CredentialRequestWasm.__wrap(r0);
|
|
680
|
+
} finally {
|
|
681
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* Creates a new request item
|
|
686
|
+
*
|
|
687
|
+
* # Arguments
|
|
688
|
+
* * `credential_type` - The type of credential to request (e.g., "orb", "face")
|
|
689
|
+
* * `signal` - Optional signal string
|
|
690
|
+
*
|
|
691
|
+
* # Errors
|
|
692
|
+
*
|
|
693
|
+
* Returns an error if the credential type is invalid
|
|
694
|
+
* @param {any} credential_type
|
|
695
|
+
* @param {string | null} [signal]
|
|
696
|
+
*/
|
|
697
|
+
constructor(credential_type, signal) {
|
|
698
|
+
try {
|
|
699
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
700
|
+
var ptr0 = isLikeNone(signal) ? 0 : passStringToWasm0(signal, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
701
|
+
var len0 = WASM_VECTOR_LEN;
|
|
702
|
+
wasm.credentialrequestwasm_new(retptr, addHeapObject(credential_type), ptr0, len0);
|
|
703
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
704
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
705
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
706
|
+
if (r2) {
|
|
707
|
+
throw takeObject(r1);
|
|
708
|
+
}
|
|
709
|
+
this.__wbg_ptr = r0 >>> 0;
|
|
710
|
+
CredentialRequestWasmFinalization.register(this, this.__wbg_ptr, this);
|
|
711
|
+
return this;
|
|
712
|
+
} finally {
|
|
713
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* Converts the request item to JSON
|
|
718
|
+
*
|
|
719
|
+
* # Errors
|
|
720
|
+
*
|
|
721
|
+
* Returns an error if serialization fails
|
|
722
|
+
* @returns {any}
|
|
723
|
+
*/
|
|
724
|
+
toJSON() {
|
|
725
|
+
try {
|
|
726
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
727
|
+
wasm.credentialrequestwasm_toJSON(retptr, this.__wbg_ptr);
|
|
728
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
729
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
730
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
731
|
+
if (r2) {
|
|
732
|
+
throw takeObject(r1);
|
|
733
|
+
}
|
|
734
|
+
return takeObject(r0);
|
|
735
|
+
} finally {
|
|
736
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
};
|
|
740
|
+
if (Symbol.dispose) CredentialRequestWasm.prototype[Symbol.dispose] = CredentialRequestWasm.prototype.free;
|
|
741
|
+
var IDKitBuilderFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
742
|
+
}, unregister: () => {
|
|
743
|
+
} } : new FinalizationRegistry((ptr) => wasm.__wbg_idkitbuilder_free(ptr >>> 0, 1));
|
|
744
|
+
var IDKitBuilder = class _IDKitBuilder {
|
|
745
|
+
static __wrap(ptr) {
|
|
746
|
+
ptr = ptr >>> 0;
|
|
747
|
+
const obj = Object.create(_IDKitBuilder.prototype);
|
|
748
|
+
obj.__wbg_ptr = ptr;
|
|
749
|
+
IDKitBuilderFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
750
|
+
return obj;
|
|
751
|
+
}
|
|
752
|
+
__destroy_into_raw() {
|
|
753
|
+
const ptr = this.__wbg_ptr;
|
|
754
|
+
this.__wbg_ptr = 0;
|
|
755
|
+
IDKitBuilderFinalization.unregister(this);
|
|
756
|
+
return ptr;
|
|
757
|
+
}
|
|
758
|
+
free() {
|
|
759
|
+
const ptr = this.__destroy_into_raw();
|
|
760
|
+
wasm.__wbg_idkitbuilder_free(ptr, 0);
|
|
761
|
+
}
|
|
762
|
+
/**
|
|
763
|
+
* Creates a `BridgeConnection` with the given constraints
|
|
764
|
+
* @param {any} constraints_json
|
|
765
|
+
* @returns {Promise<any>}
|
|
766
|
+
*/
|
|
767
|
+
constraints(constraints_json) {
|
|
768
|
+
const ptr = this.__destroy_into_raw();
|
|
769
|
+
const ret = wasm.idkitbuilder_constraints(ptr, addHeapObject(constraints_json));
|
|
770
|
+
return takeObject(ret);
|
|
771
|
+
}
|
|
772
|
+
/**
|
|
773
|
+
* Creates a new builder for proving an existing session
|
|
774
|
+
* @param {string} session_id
|
|
775
|
+
* @param {string} app_id
|
|
776
|
+
* @param {RpContextWasm} rp_context
|
|
777
|
+
* @param {string | null} [action_description]
|
|
778
|
+
* @param {string | null} [bridge_url]
|
|
779
|
+
* @param {string | null} [override_connect_base_url]
|
|
780
|
+
* @param {string | null} [environment]
|
|
781
|
+
* @returns {IDKitBuilder}
|
|
782
|
+
*/
|
|
783
|
+
static forProveSession(session_id, app_id, rp_context, action_description, bridge_url, override_connect_base_url, environment) {
|
|
784
|
+
const ptr0 = passStringToWasm0(session_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
785
|
+
const len0 = WASM_VECTOR_LEN;
|
|
786
|
+
const ptr1 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
787
|
+
const len1 = WASM_VECTOR_LEN;
|
|
788
|
+
_assertClass(rp_context, RpContextWasm);
|
|
789
|
+
var ptr2 = rp_context.__destroy_into_raw();
|
|
790
|
+
var ptr3 = isLikeNone(action_description) ? 0 : passStringToWasm0(action_description, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
791
|
+
var len3 = WASM_VECTOR_LEN;
|
|
792
|
+
var ptr4 = isLikeNone(bridge_url) ? 0 : passStringToWasm0(bridge_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
793
|
+
var len4 = WASM_VECTOR_LEN;
|
|
794
|
+
var ptr5 = isLikeNone(override_connect_base_url) ? 0 : passStringToWasm0(override_connect_base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
795
|
+
var len5 = WASM_VECTOR_LEN;
|
|
796
|
+
var ptr6 = isLikeNone(environment) ? 0 : passStringToWasm0(environment, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
797
|
+
var len6 = WASM_VECTOR_LEN;
|
|
798
|
+
const ret = wasm.idkitbuilder_forProveSession(ptr0, len0, ptr1, len1, ptr2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6);
|
|
799
|
+
return _IDKitBuilder.__wrap(ret);
|
|
800
|
+
}
|
|
801
|
+
/**
|
|
802
|
+
* Creates a new builder for creating a new session
|
|
803
|
+
* @param {string} app_id
|
|
804
|
+
* @param {RpContextWasm} rp_context
|
|
805
|
+
* @param {string | null} [action_description]
|
|
806
|
+
* @param {string | null} [bridge_url]
|
|
807
|
+
* @param {string | null} [override_connect_base_url]
|
|
808
|
+
* @param {string | null} [environment]
|
|
809
|
+
* @returns {IDKitBuilder}
|
|
810
|
+
*/
|
|
811
|
+
static forCreateSession(app_id, rp_context, action_description, bridge_url, override_connect_base_url, environment) {
|
|
812
|
+
const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
813
|
+
const len0 = WASM_VECTOR_LEN;
|
|
814
|
+
_assertClass(rp_context, RpContextWasm);
|
|
815
|
+
var ptr1 = rp_context.__destroy_into_raw();
|
|
816
|
+
var ptr2 = isLikeNone(action_description) ? 0 : passStringToWasm0(action_description, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
817
|
+
var len2 = WASM_VECTOR_LEN;
|
|
818
|
+
var ptr3 = isLikeNone(bridge_url) ? 0 : passStringToWasm0(bridge_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
819
|
+
var len3 = WASM_VECTOR_LEN;
|
|
820
|
+
var ptr4 = isLikeNone(override_connect_base_url) ? 0 : passStringToWasm0(override_connect_base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
821
|
+
var len4 = WASM_VECTOR_LEN;
|
|
822
|
+
var ptr5 = isLikeNone(environment) ? 0 : passStringToWasm0(environment, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
823
|
+
var len5 = WASM_VECTOR_LEN;
|
|
824
|
+
const ret = wasm.createSession(ptr0, len0, ptr1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5);
|
|
825
|
+
return _IDKitBuilder.__wrap(ret);
|
|
826
|
+
}
|
|
827
|
+
/**
|
|
828
|
+
* Creates a new builder for uniqueness requests
|
|
829
|
+
* @param {string} app_id
|
|
830
|
+
* @param {string} action
|
|
831
|
+
* @param {RpContextWasm} rp_context
|
|
832
|
+
* @param {string | null | undefined} action_description
|
|
833
|
+
* @param {string | null | undefined} bridge_url
|
|
834
|
+
* @param {boolean} allow_legacy_proofs
|
|
835
|
+
* @param {string | null} [override_connect_base_url]
|
|
836
|
+
* @param {string | null} [environment]
|
|
837
|
+
*/
|
|
838
|
+
constructor(app_id, action, rp_context, action_description, bridge_url, allow_legacy_proofs, override_connect_base_url, environment) {
|
|
839
|
+
const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
840
|
+
const len0 = WASM_VECTOR_LEN;
|
|
841
|
+
const ptr1 = passStringToWasm0(action, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
842
|
+
const len1 = WASM_VECTOR_LEN;
|
|
843
|
+
_assertClass(rp_context, RpContextWasm);
|
|
844
|
+
var ptr2 = rp_context.__destroy_into_raw();
|
|
845
|
+
var ptr3 = isLikeNone(action_description) ? 0 : passStringToWasm0(action_description, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
846
|
+
var len3 = WASM_VECTOR_LEN;
|
|
847
|
+
var ptr4 = isLikeNone(bridge_url) ? 0 : passStringToWasm0(bridge_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
848
|
+
var len4 = WASM_VECTOR_LEN;
|
|
849
|
+
var ptr5 = isLikeNone(override_connect_base_url) ? 0 : passStringToWasm0(override_connect_base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
850
|
+
var len5 = WASM_VECTOR_LEN;
|
|
851
|
+
var ptr6 = isLikeNone(environment) ? 0 : passStringToWasm0(environment, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
852
|
+
var len6 = WASM_VECTOR_LEN;
|
|
853
|
+
const ret = wasm.idkitbuilder_new(ptr0, len0, ptr1, len1, ptr2, ptr3, len3, ptr4, len4, allow_legacy_proofs, ptr5, len5, ptr6, len6);
|
|
854
|
+
this.__wbg_ptr = ret >>> 0;
|
|
855
|
+
IDKitBuilderFinalization.register(this, this.__wbg_ptr, this);
|
|
856
|
+
return this;
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* Creates a `BridgeConnection` from a preset (works for all request types)
|
|
860
|
+
* @param {any} preset_json
|
|
861
|
+
* @returns {Promise<any>}
|
|
862
|
+
*/
|
|
863
|
+
preset(preset_json) {
|
|
864
|
+
const ptr = this.__destroy_into_raw();
|
|
865
|
+
const ret = wasm.idkitbuilder_preset(ptr, addHeapObject(preset_json));
|
|
866
|
+
return takeObject(ret);
|
|
867
|
+
}
|
|
868
|
+
};
|
|
869
|
+
if (Symbol.dispose) IDKitBuilder.prototype[Symbol.dispose] = IDKitBuilder.prototype.free;
|
|
870
|
+
var IDKitProofFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
871
|
+
}, unregister: () => {
|
|
872
|
+
} } : new FinalizationRegistry((ptr) => wasm.__wbg_idkitproof_free(ptr >>> 0, 1));
|
|
873
|
+
var IDKitProof = class {
|
|
874
|
+
__destroy_into_raw() {
|
|
875
|
+
const ptr = this.__wbg_ptr;
|
|
876
|
+
this.__wbg_ptr = 0;
|
|
877
|
+
IDKitProofFinalization.unregister(this);
|
|
878
|
+
return ptr;
|
|
879
|
+
}
|
|
880
|
+
free() {
|
|
881
|
+
const ptr = this.__destroy_into_raw();
|
|
882
|
+
wasm.__wbg_idkitproof_free(ptr, 0);
|
|
883
|
+
}
|
|
884
|
+
/**
|
|
885
|
+
* Creates a new legacy proof (protocol v1 / World ID v3)
|
|
886
|
+
*
|
|
887
|
+
* # Errors
|
|
888
|
+
*
|
|
889
|
+
* Returns an error if the verification level cannot be deserialized
|
|
890
|
+
* @param {string} proof
|
|
891
|
+
* @param {string} merkle_root
|
|
892
|
+
* @param {string} nullifier_hash
|
|
893
|
+
* @param {any} verification_level
|
|
894
|
+
*/
|
|
895
|
+
constructor(proof, merkle_root, nullifier_hash, verification_level) {
|
|
896
|
+
try {
|
|
897
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
898
|
+
const ptr0 = passStringToWasm0(proof, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
899
|
+
const len0 = WASM_VECTOR_LEN;
|
|
900
|
+
const ptr1 = passStringToWasm0(merkle_root, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
901
|
+
const len1 = WASM_VECTOR_LEN;
|
|
902
|
+
const ptr2 = passStringToWasm0(nullifier_hash, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
903
|
+
const len2 = WASM_VECTOR_LEN;
|
|
904
|
+
wasm.idkitproof_new(retptr, ptr0, len0, ptr1, len1, ptr2, len2, addHeapObject(verification_level));
|
|
905
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
906
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
907
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
908
|
+
if (r2) {
|
|
909
|
+
throw takeObject(r1);
|
|
910
|
+
}
|
|
911
|
+
this.__wbg_ptr = r0 >>> 0;
|
|
912
|
+
IDKitProofFinalization.register(this, this.__wbg_ptr, this);
|
|
913
|
+
return this;
|
|
914
|
+
} finally {
|
|
915
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* Converts the proof to JSON
|
|
920
|
+
*
|
|
921
|
+
* # Errors
|
|
922
|
+
*
|
|
923
|
+
* Returns an error if serialization fails
|
|
924
|
+
* @returns {any}
|
|
925
|
+
*/
|
|
926
|
+
toJSON() {
|
|
927
|
+
try {
|
|
928
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
929
|
+
wasm.idkitproof_toJSON(retptr, this.__wbg_ptr);
|
|
930
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
931
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
932
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
933
|
+
if (r2) {
|
|
934
|
+
throw takeObject(r1);
|
|
935
|
+
}
|
|
936
|
+
return takeObject(r0);
|
|
937
|
+
} finally {
|
|
938
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
};
|
|
942
|
+
if (Symbol.dispose) IDKitProof.prototype[Symbol.dispose] = IDKitProof.prototype.free;
|
|
943
|
+
var IDKitRequestFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
944
|
+
}, unregister: () => {
|
|
945
|
+
} } : new FinalizationRegistry((ptr) => wasm.__wbg_idkitrequest_free(ptr >>> 0, 1));
|
|
946
|
+
var IDKitRequest = class _IDKitRequest {
|
|
947
|
+
static __wrap(ptr) {
|
|
948
|
+
ptr = ptr >>> 0;
|
|
949
|
+
const obj = Object.create(_IDKitRequest.prototype);
|
|
950
|
+
obj.__wbg_ptr = ptr;
|
|
951
|
+
IDKitRequestFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
952
|
+
return obj;
|
|
953
|
+
}
|
|
954
|
+
__destroy_into_raw() {
|
|
955
|
+
const ptr = this.__wbg_ptr;
|
|
956
|
+
this.__wbg_ptr = 0;
|
|
957
|
+
IDKitRequestFinalization.unregister(this);
|
|
958
|
+
return ptr;
|
|
959
|
+
}
|
|
960
|
+
free() {
|
|
961
|
+
const ptr = this.__destroy_into_raw();
|
|
962
|
+
wasm.__wbg_idkitrequest_free(ptr, 0);
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
965
|
+
* Returns the request ID for this request
|
|
966
|
+
*
|
|
967
|
+
* # Errors
|
|
968
|
+
*
|
|
969
|
+
* Returns an error if the request has been closed
|
|
970
|
+
* @returns {string}
|
|
971
|
+
*/
|
|
972
|
+
requestId() {
|
|
973
|
+
let deferred2_0;
|
|
974
|
+
let deferred2_1;
|
|
975
|
+
try {
|
|
976
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
977
|
+
wasm.idkitrequest_requestId(retptr, this.__wbg_ptr);
|
|
978
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
979
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
980
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
981
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
982
|
+
var ptr1 = r0;
|
|
983
|
+
var len1 = r1;
|
|
984
|
+
if (r3) {
|
|
985
|
+
ptr1 = 0;
|
|
986
|
+
len1 = 0;
|
|
987
|
+
throw takeObject(r2);
|
|
988
|
+
}
|
|
989
|
+
deferred2_0 = ptr1;
|
|
990
|
+
deferred2_1 = len1;
|
|
991
|
+
return getStringFromWasm0(ptr1, len1);
|
|
992
|
+
} finally {
|
|
993
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
994
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
/**
|
|
998
|
+
* Returns the connect URL for World App
|
|
999
|
+
*
|
|
1000
|
+
* This URL should be displayed as a QR code for users to scan with World App.
|
|
1001
|
+
*
|
|
1002
|
+
* # Errors
|
|
1003
|
+
*
|
|
1004
|
+
* Returns an error if the request has been closed
|
|
1005
|
+
* @returns {string}
|
|
1006
|
+
*/
|
|
1007
|
+
connectUrl() {
|
|
1008
|
+
let deferred2_0;
|
|
1009
|
+
let deferred2_1;
|
|
1010
|
+
try {
|
|
1011
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1012
|
+
wasm.idkitrequest_connectUrl(retptr, this.__wbg_ptr);
|
|
1013
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1014
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1015
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1016
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1017
|
+
var ptr1 = r0;
|
|
1018
|
+
var len1 = r1;
|
|
1019
|
+
if (r3) {
|
|
1020
|
+
ptr1 = 0;
|
|
1021
|
+
len1 = 0;
|
|
1022
|
+
throw takeObject(r2);
|
|
1023
|
+
}
|
|
1024
|
+
deferred2_0 = ptr1;
|
|
1025
|
+
deferred2_1 = len1;
|
|
1026
|
+
return getStringFromWasm0(ptr1, len1);
|
|
1027
|
+
} finally {
|
|
1028
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1029
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
/**
|
|
1033
|
+
* Polls the bridge for the current status (non-blocking)
|
|
1034
|
+
*
|
|
1035
|
+
* Returns a status object with type:
|
|
1036
|
+
* - `"waiting_for_connection"` - Waiting for World App to retrieve the request
|
|
1037
|
+
* - `"awaiting_confirmation"` - World App has retrieved the request, waiting for user
|
|
1038
|
+
* - `"confirmed"` - User confirmed and provided a proof
|
|
1039
|
+
* - `"failed"` - Request has failed
|
|
1040
|
+
*
|
|
1041
|
+
* # Errors
|
|
1042
|
+
*
|
|
1043
|
+
* Returns an error if the request fails or the response is invalid
|
|
1044
|
+
* @returns {Promise<any>}
|
|
1045
|
+
*/
|
|
1046
|
+
pollForStatus() {
|
|
1047
|
+
const ret = wasm.idkitrequest_pollForStatus(this.__wbg_ptr);
|
|
1048
|
+
return takeObject(ret);
|
|
1049
|
+
}
|
|
1050
|
+
};
|
|
1051
|
+
if (Symbol.dispose) IDKitRequest.prototype[Symbol.dispose] = IDKitRequest.prototype.free;
|
|
1052
|
+
var RpContextWasmFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
1053
|
+
}, unregister: () => {
|
|
1054
|
+
} } : new FinalizationRegistry((ptr) => wasm.__wbg_rpcontextwasm_free(ptr >>> 0, 1));
|
|
1055
|
+
var RpContextWasm = class {
|
|
1056
|
+
__destroy_into_raw() {
|
|
1057
|
+
const ptr = this.__wbg_ptr;
|
|
1058
|
+
this.__wbg_ptr = 0;
|
|
1059
|
+
RpContextWasmFinalization.unregister(this);
|
|
1060
|
+
return ptr;
|
|
1061
|
+
}
|
|
1062
|
+
free() {
|
|
1063
|
+
const ptr = this.__destroy_into_raw();
|
|
1064
|
+
wasm.__wbg_rpcontextwasm_free(ptr, 0);
|
|
1065
|
+
}
|
|
1066
|
+
/**
|
|
1067
|
+
* Creates a new RP context
|
|
1068
|
+
*
|
|
1069
|
+
* # Arguments
|
|
1070
|
+
* * `rp_id` - The registered RP ID (e.g., `"rp_123456789abcdef0"`)
|
|
1071
|
+
* * `nonce` - Unique nonce for this proof request
|
|
1072
|
+
* * `created_at` - Unix timestamp (seconds since epoch) when created
|
|
1073
|
+
* * `expires_at` - Unix timestamp (seconds since epoch) when expires
|
|
1074
|
+
* * `signature` - The RP's ECDSA signature of the `nonce` and `created_at` timestamp
|
|
1075
|
+
*
|
|
1076
|
+
* # Errors
|
|
1077
|
+
*
|
|
1078
|
+
* Returns an error if `rp_id` is not a valid RP ID (must start with `rp_`)
|
|
1079
|
+
* @param {string} rp_id
|
|
1080
|
+
* @param {string} nonce
|
|
1081
|
+
* @param {bigint} created_at
|
|
1082
|
+
* @param {bigint} expires_at
|
|
1083
|
+
* @param {string} signature
|
|
1084
|
+
*/
|
|
1085
|
+
constructor(rp_id, nonce, created_at, expires_at, signature) {
|
|
1086
|
+
try {
|
|
1087
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1088
|
+
const ptr0 = passStringToWasm0(rp_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1089
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1090
|
+
const ptr1 = passStringToWasm0(nonce, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1091
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1092
|
+
const ptr2 = passStringToWasm0(signature, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1093
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1094
|
+
wasm.rpcontextwasm_new(retptr, ptr0, len0, ptr1, len1, created_at, expires_at, ptr2, len2);
|
|
1095
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1096
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1097
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1098
|
+
if (r2) {
|
|
1099
|
+
throw takeObject(r1);
|
|
1100
|
+
}
|
|
1101
|
+
this.__wbg_ptr = r0 >>> 0;
|
|
1102
|
+
RpContextWasmFinalization.register(this, this.__wbg_ptr, this);
|
|
1103
|
+
return this;
|
|
1104
|
+
} finally {
|
|
1105
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
};
|
|
1109
|
+
if (Symbol.dispose) RpContextWasm.prototype[Symbol.dispose] = RpContextWasm.prototype.free;
|
|
1110
|
+
var RpSignatureFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
1111
|
+
}, unregister: () => {
|
|
1112
|
+
} } : new FinalizationRegistry((ptr) => wasm.__wbg_rpsignature_free(ptr >>> 0, 1));
|
|
1113
|
+
var RpSignature = class _RpSignature {
|
|
1114
|
+
static __wrap(ptr) {
|
|
1115
|
+
ptr = ptr >>> 0;
|
|
1116
|
+
const obj = Object.create(_RpSignature.prototype);
|
|
1117
|
+
obj.__wbg_ptr = ptr;
|
|
1118
|
+
RpSignatureFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1119
|
+
return obj;
|
|
1120
|
+
}
|
|
1121
|
+
__destroy_into_raw() {
|
|
1122
|
+
const ptr = this.__wbg_ptr;
|
|
1123
|
+
this.__wbg_ptr = 0;
|
|
1124
|
+
RpSignatureFinalization.unregister(this);
|
|
1125
|
+
return ptr;
|
|
1126
|
+
}
|
|
1127
|
+
free() {
|
|
1128
|
+
const ptr = this.__destroy_into_raw();
|
|
1129
|
+
wasm.__wbg_rpsignature_free(ptr, 0);
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1132
|
+
* Gets the creation timestamp
|
|
1133
|
+
* @returns {bigint}
|
|
1134
|
+
*/
|
|
1135
|
+
get createdAt() {
|
|
1136
|
+
const ret = wasm.rpsignature_createdAt(this.__wbg_ptr);
|
|
1137
|
+
return BigInt.asUintN(64, ret);
|
|
1138
|
+
}
|
|
1139
|
+
/**
|
|
1140
|
+
* Gets the expiration timestamp
|
|
1141
|
+
* @returns {bigint}
|
|
1142
|
+
*/
|
|
1143
|
+
get expiresAt() {
|
|
1144
|
+
const ret = wasm.rpsignature_expiresAt(this.__wbg_ptr);
|
|
1145
|
+
return BigInt.asUintN(64, ret);
|
|
1146
|
+
}
|
|
1147
|
+
/**
|
|
1148
|
+
* Gets the signature as hex string (0x-prefixed, 65 bytes)
|
|
1149
|
+
* @returns {string}
|
|
1150
|
+
*/
|
|
1151
|
+
get sig() {
|
|
1152
|
+
let deferred1_0;
|
|
1153
|
+
let deferred1_1;
|
|
1154
|
+
try {
|
|
1155
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1156
|
+
wasm.rpsignature_sig(retptr, this.__wbg_ptr);
|
|
1157
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1158
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1159
|
+
deferred1_0 = r0;
|
|
1160
|
+
deferred1_1 = r1;
|
|
1161
|
+
return getStringFromWasm0(r0, r1);
|
|
1162
|
+
} finally {
|
|
1163
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1164
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
/**
|
|
1168
|
+
* Gets the nonce as hex string (0x-prefixed field element)
|
|
1169
|
+
* @returns {string}
|
|
1170
|
+
*/
|
|
1171
|
+
get nonce() {
|
|
1172
|
+
let deferred1_0;
|
|
1173
|
+
let deferred1_1;
|
|
1174
|
+
try {
|
|
1175
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1176
|
+
wasm.rpsignature_nonce(retptr, this.__wbg_ptr);
|
|
1177
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1178
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1179
|
+
deferred1_0 = r0;
|
|
1180
|
+
deferred1_1 = r1;
|
|
1181
|
+
return getStringFromWasm0(r0, r1);
|
|
1182
|
+
} finally {
|
|
1183
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1184
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
/**
|
|
1188
|
+
* Converts to JSON
|
|
1189
|
+
*
|
|
1190
|
+
* # Errors
|
|
1191
|
+
*
|
|
1192
|
+
* Returns an error if setting object properties fails
|
|
1193
|
+
* @returns {any}
|
|
1194
|
+
*/
|
|
1195
|
+
toJSON() {
|
|
1196
|
+
try {
|
|
1197
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1198
|
+
wasm.rpsignature_toJSON(retptr, this.__wbg_ptr);
|
|
1199
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1200
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1201
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1202
|
+
if (r2) {
|
|
1203
|
+
throw takeObject(r1);
|
|
1204
|
+
}
|
|
1205
|
+
return takeObject(r0);
|
|
1206
|
+
} finally {
|
|
1207
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
};
|
|
1211
|
+
if (Symbol.dispose) RpSignature.prototype[Symbol.dispose] = RpSignature.prototype.free;
|
|
1212
|
+
var EXPECTED_RESPONSE_TYPES = /* @__PURE__ */ new Set(["basic", "cors", "default"]);
|
|
1213
|
+
async function __wbg_load(module2, imports) {
|
|
1214
|
+
if (typeof Response === "function" && module2 instanceof Response) {
|
|
1215
|
+
if (typeof WebAssembly.instantiateStreaming === "function") {
|
|
1216
|
+
try {
|
|
1217
|
+
return await WebAssembly.instantiateStreaming(module2, imports);
|
|
1218
|
+
} catch (e) {
|
|
1219
|
+
const validResponse = module2.ok && EXPECTED_RESPONSE_TYPES.has(module2.type);
|
|
1220
|
+
if (validResponse && module2.headers.get("Content-Type") !== "application/wasm") {
|
|
1221
|
+
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);
|
|
1222
|
+
} else {
|
|
1223
|
+
throw e;
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
const bytes = await module2.arrayBuffer();
|
|
1228
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
1229
|
+
} else {
|
|
1230
|
+
const instance = await WebAssembly.instantiate(module2, imports);
|
|
1231
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
1232
|
+
return { instance, module: module2 };
|
|
1233
|
+
} else {
|
|
1234
|
+
return instance;
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
function __wbg_get_imports() {
|
|
1239
|
+
const imports = {};
|
|
1240
|
+
imports.wbg = {};
|
|
1241
|
+
imports.wbg.__wbg_Error_e83987f665cf5504 = function(arg0, arg1) {
|
|
1242
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
1243
|
+
return addHeapObject(ret);
|
|
1244
|
+
};
|
|
1245
|
+
imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
|
|
1246
|
+
const ret = String(getObject(arg1));
|
|
1247
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1248
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1249
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1250
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1251
|
+
};
|
|
1252
|
+
imports.wbg.__wbg___wbindgen_bigint_get_as_i64_f3ebc5a755000afd = function(arg0, arg1) {
|
|
1253
|
+
const v = getObject(arg1);
|
|
1254
|
+
const ret = typeof v === "bigint" ? v : void 0;
|
|
1255
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
1256
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
1257
|
+
};
|
|
1258
|
+
imports.wbg.__wbg___wbindgen_boolean_get_6d5a1ee65bab5f68 = function(arg0) {
|
|
1259
|
+
const v = getObject(arg0);
|
|
1260
|
+
const ret = typeof v === "boolean" ? v : void 0;
|
|
1261
|
+
return isLikeNone(ret) ? 16777215 : ret ? 1 : 0;
|
|
1262
|
+
};
|
|
1263
|
+
imports.wbg.__wbg___wbindgen_debug_string_df47ffb5e35e6763 = function(arg0, arg1) {
|
|
1264
|
+
const ret = debugString(getObject(arg1));
|
|
1265
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1266
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1267
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1268
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1269
|
+
};
|
|
1270
|
+
imports.wbg.__wbg___wbindgen_in_bb933bd9e1b3bc0f = function(arg0, arg1) {
|
|
1271
|
+
const ret = getObject(arg0) in getObject(arg1);
|
|
1272
|
+
return ret;
|
|
1273
|
+
};
|
|
1274
|
+
imports.wbg.__wbg___wbindgen_is_bigint_cb320707dcd35f0b = function(arg0) {
|
|
1275
|
+
const ret = typeof getObject(arg0) === "bigint";
|
|
1276
|
+
return ret;
|
|
1277
|
+
};
|
|
1278
|
+
imports.wbg.__wbg___wbindgen_is_function_ee8a6c5833c90377 = function(arg0) {
|
|
1279
|
+
const ret = typeof getObject(arg0) === "function";
|
|
1280
|
+
return ret;
|
|
1281
|
+
};
|
|
1282
|
+
imports.wbg.__wbg___wbindgen_is_object_c818261d21f283a4 = function(arg0) {
|
|
1283
|
+
const val = getObject(arg0);
|
|
1284
|
+
const ret = typeof val === "object" && val !== null;
|
|
1285
|
+
return ret;
|
|
1286
|
+
};
|
|
1287
|
+
imports.wbg.__wbg___wbindgen_is_string_fbb76cb2940daafd = function(arg0) {
|
|
1288
|
+
const ret = typeof getObject(arg0) === "string";
|
|
1289
|
+
return ret;
|
|
1290
|
+
};
|
|
1291
|
+
imports.wbg.__wbg___wbindgen_is_undefined_2d472862bd29a478 = function(arg0) {
|
|
1292
|
+
const ret = getObject(arg0) === void 0;
|
|
1293
|
+
return ret;
|
|
1294
|
+
};
|
|
1295
|
+
imports.wbg.__wbg___wbindgen_jsval_eq_6b13ab83478b1c50 = function(arg0, arg1) {
|
|
1296
|
+
const ret = getObject(arg0) === getObject(arg1);
|
|
1297
|
+
return ret;
|
|
1298
|
+
};
|
|
1299
|
+
imports.wbg.__wbg___wbindgen_jsval_loose_eq_b664b38a2f582147 = function(arg0, arg1) {
|
|
1300
|
+
const ret = getObject(arg0) == getObject(arg1);
|
|
1301
|
+
return ret;
|
|
1302
|
+
};
|
|
1303
|
+
imports.wbg.__wbg___wbindgen_number_get_a20bf9b85341449d = function(arg0, arg1) {
|
|
1304
|
+
const obj = getObject(arg1);
|
|
1305
|
+
const ret = typeof obj === "number" ? obj : void 0;
|
|
1306
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
1307
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
1308
|
+
};
|
|
1309
|
+
imports.wbg.__wbg___wbindgen_string_get_e4f06c90489ad01b = function(arg0, arg1) {
|
|
1310
|
+
const obj = getObject(arg1);
|
|
1311
|
+
const ret = typeof obj === "string" ? obj : void 0;
|
|
1312
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1313
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1314
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1315
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1316
|
+
};
|
|
1317
|
+
imports.wbg.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
|
|
1318
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1319
|
+
};
|
|
1320
|
+
imports.wbg.__wbg__wbg_cb_unref_2454a539ea5790d9 = function(arg0) {
|
|
1321
|
+
getObject(arg0)._wbg_cb_unref();
|
|
1322
|
+
};
|
|
1323
|
+
imports.wbg.__wbg_abort_28ad55c5825b004d = function(arg0, arg1) {
|
|
1324
|
+
getObject(arg0).abort(getObject(arg1));
|
|
1325
|
+
};
|
|
1326
|
+
imports.wbg.__wbg_abort_e7eb059f72f9ed0c = function(arg0) {
|
|
1327
|
+
getObject(arg0).abort();
|
|
1328
|
+
};
|
|
1329
|
+
imports.wbg.__wbg_append_b577eb3a177bc0fa = function() {
|
|
1330
|
+
return handleError(function(arg0, arg1, arg2, arg3, arg4) {
|
|
1331
|
+
getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
1332
|
+
}, arguments);
|
|
1333
|
+
};
|
|
1334
|
+
imports.wbg.__wbg_arrayBuffer_b375eccb84b4ddf3 = function() {
|
|
1335
|
+
return handleError(function(arg0) {
|
|
1336
|
+
const ret = getObject(arg0).arrayBuffer();
|
|
1337
|
+
return addHeapObject(ret);
|
|
1338
|
+
}, arguments);
|
|
1339
|
+
};
|
|
1340
|
+
imports.wbg.__wbg_call_525440f72fbfc0ea = function() {
|
|
1341
|
+
return handleError(function(arg0, arg1, arg2) {
|
|
1342
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
|
1343
|
+
return addHeapObject(ret);
|
|
1344
|
+
}, arguments);
|
|
1345
|
+
};
|
|
1346
|
+
imports.wbg.__wbg_call_e762c39fa8ea36bf = function() {
|
|
1347
|
+
return handleError(function(arg0, arg1) {
|
|
1348
|
+
const ret = getObject(arg0).call(getObject(arg1));
|
|
1349
|
+
return addHeapObject(ret);
|
|
1350
|
+
}, arguments);
|
|
1351
|
+
};
|
|
1352
|
+
imports.wbg.__wbg_clearTimeout_7a42b49784aea641 = function(arg0) {
|
|
1353
|
+
const ret = clearTimeout(takeObject(arg0));
|
|
1354
|
+
return addHeapObject(ret);
|
|
1355
|
+
};
|
|
1356
|
+
imports.wbg.__wbg_crypto_574e78ad8b13b65f = function(arg0) {
|
|
1357
|
+
const ret = getObject(arg0).crypto;
|
|
1358
|
+
return addHeapObject(ret);
|
|
1359
|
+
};
|
|
1360
|
+
imports.wbg.__wbg_done_2042aa2670fb1db1 = function(arg0) {
|
|
1361
|
+
const ret = getObject(arg0).done;
|
|
1362
|
+
return ret;
|
|
1363
|
+
};
|
|
1364
|
+
imports.wbg.__wbg_entries_e171b586f8f6bdbf = function(arg0) {
|
|
1365
|
+
const ret = Object.entries(getObject(arg0));
|
|
1366
|
+
return addHeapObject(ret);
|
|
1367
|
+
};
|
|
1368
|
+
imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
|
|
1369
|
+
let deferred0_0;
|
|
1370
|
+
let deferred0_1;
|
|
1371
|
+
try {
|
|
1372
|
+
deferred0_0 = arg0;
|
|
1373
|
+
deferred0_1 = arg1;
|
|
1374
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
1375
|
+
} finally {
|
|
1376
|
+
wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
|
|
1377
|
+
}
|
|
1378
|
+
};
|
|
1379
|
+
imports.wbg.__wbg_fetch_74a3e84ebd2c9a0e = function(arg0) {
|
|
1380
|
+
const ret = fetch(getObject(arg0));
|
|
1381
|
+
return addHeapObject(ret);
|
|
1382
|
+
};
|
|
1383
|
+
imports.wbg.__wbg_fetch_f8ba0e29a9d6de0d = function(arg0, arg1) {
|
|
1384
|
+
const ret = getObject(arg0).fetch(getObject(arg1));
|
|
1385
|
+
return addHeapObject(ret);
|
|
1386
|
+
};
|
|
1387
|
+
imports.wbg.__wbg_getRandomValues_38a1ff1ea09f6cc7 = function() {
|
|
1388
|
+
return handleError(function(arg0, arg1) {
|
|
1389
|
+
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
1390
|
+
}, arguments);
|
|
1391
|
+
};
|
|
1392
|
+
imports.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() {
|
|
1393
|
+
return handleError(function(arg0, arg1) {
|
|
1394
|
+
getObject(arg0).getRandomValues(getObject(arg1));
|
|
1395
|
+
}, arguments);
|
|
1396
|
+
};
|
|
1397
|
+
imports.wbg.__wbg_get_7bed016f185add81 = function(arg0, arg1) {
|
|
1398
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
1399
|
+
return addHeapObject(ret);
|
|
1400
|
+
};
|
|
1401
|
+
imports.wbg.__wbg_get_efcb449f58ec27c2 = function() {
|
|
1402
|
+
return handleError(function(arg0, arg1) {
|
|
1403
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
1404
|
+
return addHeapObject(ret);
|
|
1405
|
+
}, arguments);
|
|
1406
|
+
};
|
|
1407
|
+
imports.wbg.__wbg_has_787fafc980c3ccdb = function() {
|
|
1408
|
+
return handleError(function(arg0, arg1) {
|
|
1409
|
+
const ret = Reflect.has(getObject(arg0), getObject(arg1));
|
|
1410
|
+
return ret;
|
|
1411
|
+
}, arguments);
|
|
1412
|
+
};
|
|
1413
|
+
imports.wbg.__wbg_headers_b87d7eaba61c3278 = function(arg0) {
|
|
1414
|
+
const ret = getObject(arg0).headers;
|
|
1415
|
+
return addHeapObject(ret);
|
|
1416
|
+
};
|
|
1417
|
+
imports.wbg.__wbg_idkitrequest_new = function(arg0) {
|
|
1418
|
+
const ret = IDKitRequest.__wrap(arg0);
|
|
1419
|
+
return addHeapObject(ret);
|
|
1420
|
+
};
|
|
1421
|
+
imports.wbg.__wbg_instanceof_ArrayBuffer_70beb1189ca63b38 = function(arg0) {
|
|
1422
|
+
let result;
|
|
1423
|
+
try {
|
|
1424
|
+
result = getObject(arg0) instanceof ArrayBuffer;
|
|
1425
|
+
} catch (_) {
|
|
1426
|
+
result = false;
|
|
1427
|
+
}
|
|
1428
|
+
const ret = result;
|
|
1429
|
+
return ret;
|
|
1430
|
+
};
|
|
1431
|
+
imports.wbg.__wbg_instanceof_Map_8579b5e2ab5437c7 = function(arg0) {
|
|
1432
|
+
let result;
|
|
1433
|
+
try {
|
|
1434
|
+
result = getObject(arg0) instanceof Map;
|
|
1435
|
+
} catch (_) {
|
|
1436
|
+
result = false;
|
|
1437
|
+
}
|
|
1438
|
+
const ret = result;
|
|
1439
|
+
return ret;
|
|
1440
|
+
};
|
|
1441
|
+
imports.wbg.__wbg_instanceof_Response_f4f3e87e07f3135c = function(arg0) {
|
|
1442
|
+
let result;
|
|
1443
|
+
try {
|
|
1444
|
+
result = getObject(arg0) instanceof Response;
|
|
1445
|
+
} catch (_) {
|
|
1446
|
+
result = false;
|
|
1447
|
+
}
|
|
1448
|
+
const ret = result;
|
|
1449
|
+
return ret;
|
|
1450
|
+
};
|
|
1451
|
+
imports.wbg.__wbg_instanceof_Uint8Array_20c8e73002f7af98 = function(arg0) {
|
|
1452
|
+
let result;
|
|
1453
|
+
try {
|
|
1454
|
+
result = getObject(arg0) instanceof Uint8Array;
|
|
1455
|
+
} catch (_) {
|
|
1456
|
+
result = false;
|
|
1457
|
+
}
|
|
1458
|
+
const ret = result;
|
|
1459
|
+
return ret;
|
|
1460
|
+
};
|
|
1461
|
+
imports.wbg.__wbg_isArray_96e0af9891d0945d = function(arg0) {
|
|
1462
|
+
const ret = Array.isArray(getObject(arg0));
|
|
1463
|
+
return ret;
|
|
1464
|
+
};
|
|
1465
|
+
imports.wbg.__wbg_isSafeInteger_d216eda7911dde36 = function(arg0) {
|
|
1466
|
+
const ret = Number.isSafeInteger(getObject(arg0));
|
|
1467
|
+
return ret;
|
|
1468
|
+
};
|
|
1469
|
+
imports.wbg.__wbg_iterator_e5822695327a3c39 = function() {
|
|
1470
|
+
const ret = Symbol.iterator;
|
|
1471
|
+
return addHeapObject(ret);
|
|
1472
|
+
};
|
|
1473
|
+
imports.wbg.__wbg_length_69bca3cb64fc8748 = function(arg0) {
|
|
1474
|
+
const ret = getObject(arg0).length;
|
|
1475
|
+
return ret;
|
|
1476
|
+
};
|
|
1477
|
+
imports.wbg.__wbg_length_cdd215e10d9dd507 = function(arg0) {
|
|
1478
|
+
const ret = getObject(arg0).length;
|
|
1479
|
+
return ret;
|
|
1480
|
+
};
|
|
1481
|
+
imports.wbg.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
|
|
1482
|
+
const ret = getObject(arg0).msCrypto;
|
|
1483
|
+
return addHeapObject(ret);
|
|
1484
|
+
};
|
|
1485
|
+
imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
|
|
1486
|
+
const ret = new Object();
|
|
1487
|
+
return addHeapObject(ret);
|
|
1488
|
+
};
|
|
1489
|
+
imports.wbg.__wbg_new_2531773dac38ebb3 = function() {
|
|
1490
|
+
return handleError(function() {
|
|
1491
|
+
const ret = new AbortController();
|
|
1492
|
+
return addHeapObject(ret);
|
|
1493
|
+
}, arguments);
|
|
1494
|
+
};
|
|
1495
|
+
imports.wbg.__wbg_new_3c3d849046688a66 = function(arg0, arg1) {
|
|
1496
|
+
try {
|
|
1497
|
+
var state0 = { a: arg0, b: arg1 };
|
|
1498
|
+
var cb0 = (arg02, arg12) => {
|
|
1499
|
+
const a = state0.a;
|
|
1500
|
+
state0.a = 0;
|
|
1501
|
+
try {
|
|
1502
|
+
return __wasm_bindgen_func_elem_1343(a, state0.b, arg02, arg12);
|
|
1503
|
+
} finally {
|
|
1504
|
+
state0.a = a;
|
|
1505
|
+
}
|
|
1506
|
+
};
|
|
1507
|
+
const ret = new Promise(cb0);
|
|
1508
|
+
return addHeapObject(ret);
|
|
1509
|
+
} finally {
|
|
1510
|
+
state0.a = state0.b = 0;
|
|
1511
|
+
}
|
|
1512
|
+
};
|
|
1513
|
+
imports.wbg.__wbg_new_5a79be3ab53b8aa5 = function(arg0) {
|
|
1514
|
+
const ret = new Uint8Array(getObject(arg0));
|
|
1515
|
+
return addHeapObject(ret);
|
|
1516
|
+
};
|
|
1517
|
+
imports.wbg.__wbg_new_68651c719dcda04e = function() {
|
|
1518
|
+
const ret = /* @__PURE__ */ new Map();
|
|
1519
|
+
return addHeapObject(ret);
|
|
1520
|
+
};
|
|
1521
|
+
imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
|
|
1522
|
+
const ret = new Error();
|
|
1523
|
+
return addHeapObject(ret);
|
|
1524
|
+
};
|
|
1525
|
+
imports.wbg.__wbg_new_9edf9838a2def39c = function() {
|
|
1526
|
+
return handleError(function() {
|
|
1527
|
+
const ret = new Headers();
|
|
1528
|
+
return addHeapObject(ret);
|
|
1529
|
+
}, arguments);
|
|
1530
|
+
};
|
|
1531
|
+
imports.wbg.__wbg_new_e17d9f43105b08be = function() {
|
|
1532
|
+
const ret = new Array();
|
|
1533
|
+
return addHeapObject(ret);
|
|
1534
|
+
};
|
|
1535
|
+
imports.wbg.__wbg_new_from_slice_92f4d78ca282a2d2 = function(arg0, arg1) {
|
|
1536
|
+
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
1537
|
+
return addHeapObject(ret);
|
|
1538
|
+
};
|
|
1539
|
+
imports.wbg.__wbg_new_no_args_ee98eee5275000a4 = function(arg0, arg1) {
|
|
1540
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
1541
|
+
return addHeapObject(ret);
|
|
1542
|
+
};
|
|
1543
|
+
imports.wbg.__wbg_new_with_length_01aa0dc35aa13543 = function(arg0) {
|
|
1544
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
1545
|
+
return addHeapObject(ret);
|
|
1546
|
+
};
|
|
1547
|
+
imports.wbg.__wbg_new_with_str_and_init_0ae7728b6ec367b1 = function() {
|
|
1548
|
+
return handleError(function(arg0, arg1, arg2) {
|
|
1549
|
+
const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
|
|
1550
|
+
return addHeapObject(ret);
|
|
1551
|
+
}, arguments);
|
|
1552
|
+
};
|
|
1553
|
+
imports.wbg.__wbg_next_020810e0ae8ebcb0 = function() {
|
|
1554
|
+
return handleError(function(arg0) {
|
|
1555
|
+
const ret = getObject(arg0).next();
|
|
1556
|
+
return addHeapObject(ret);
|
|
1557
|
+
}, arguments);
|
|
1558
|
+
};
|
|
1559
|
+
imports.wbg.__wbg_next_2c826fe5dfec6b6a = function(arg0) {
|
|
1560
|
+
const ret = getObject(arg0).next;
|
|
1561
|
+
return addHeapObject(ret);
|
|
1562
|
+
};
|
|
1563
|
+
imports.wbg.__wbg_node_905d3e251edff8a2 = function(arg0) {
|
|
1564
|
+
const ret = getObject(arg0).node;
|
|
1565
|
+
return addHeapObject(ret);
|
|
1566
|
+
};
|
|
1567
|
+
imports.wbg.__wbg_now_793306c526e2e3b6 = function() {
|
|
1568
|
+
const ret = Date.now();
|
|
1569
|
+
return ret;
|
|
1570
|
+
};
|
|
1571
|
+
imports.wbg.__wbg_process_dc0fbacc7c1c06f7 = function(arg0) {
|
|
1572
|
+
const ret = getObject(arg0).process;
|
|
1573
|
+
return addHeapObject(ret);
|
|
1574
|
+
};
|
|
1575
|
+
imports.wbg.__wbg_prototypesetcall_2a6620b6922694b2 = function(arg0, arg1, arg2) {
|
|
1576
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
1577
|
+
};
|
|
1578
|
+
imports.wbg.__wbg_queueMicrotask_34d692c25c47d05b = function(arg0) {
|
|
1579
|
+
const ret = getObject(arg0).queueMicrotask;
|
|
1580
|
+
return addHeapObject(ret);
|
|
1581
|
+
};
|
|
1582
|
+
imports.wbg.__wbg_queueMicrotask_9d76cacb20c84d58 = function(arg0) {
|
|
1583
|
+
queueMicrotask(getObject(arg0));
|
|
1584
|
+
};
|
|
1585
|
+
imports.wbg.__wbg_randomFillSync_ac0988aba3254290 = function() {
|
|
1586
|
+
return handleError(function(arg0, arg1) {
|
|
1587
|
+
getObject(arg0).randomFillSync(takeObject(arg1));
|
|
1588
|
+
}, arguments);
|
|
1589
|
+
};
|
|
1590
|
+
imports.wbg.__wbg_require_60cc747a6bc5215a = function() {
|
|
1591
|
+
return handleError(function() {
|
|
1592
|
+
const ret = module.require;
|
|
1593
|
+
return addHeapObject(ret);
|
|
1594
|
+
}, arguments);
|
|
1595
|
+
};
|
|
1596
|
+
imports.wbg.__wbg_resolve_caf97c30b83f7053 = function(arg0) {
|
|
1597
|
+
const ret = Promise.resolve(getObject(arg0));
|
|
1598
|
+
return addHeapObject(ret);
|
|
1599
|
+
};
|
|
1600
|
+
imports.wbg.__wbg_setTimeout_7bb3429662ab1e70 = function(arg0, arg1) {
|
|
1601
|
+
const ret = setTimeout(getObject(arg0), arg1);
|
|
1602
|
+
return addHeapObject(ret);
|
|
1603
|
+
};
|
|
1604
|
+
imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
|
|
1605
|
+
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
1606
|
+
};
|
|
1607
|
+
imports.wbg.__wbg_set_907fb406c34a251d = function(arg0, arg1, arg2) {
|
|
1608
|
+
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
|
1609
|
+
return addHeapObject(ret);
|
|
1610
|
+
};
|
|
1611
|
+
imports.wbg.__wbg_set_body_3c365989753d61f4 = function(arg0, arg1) {
|
|
1612
|
+
getObject(arg0).body = getObject(arg1);
|
|
1613
|
+
};
|
|
1614
|
+
imports.wbg.__wbg_set_c213c871859d6500 = function(arg0, arg1, arg2) {
|
|
1615
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
1616
|
+
};
|
|
1617
|
+
imports.wbg.__wbg_set_c2abbebe8b9ebee1 = function() {
|
|
1618
|
+
return handleError(function(arg0, arg1, arg2) {
|
|
1619
|
+
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
1620
|
+
return ret;
|
|
1621
|
+
}, arguments);
|
|
1622
|
+
};
|
|
1623
|
+
imports.wbg.__wbg_set_cache_2f9deb19b92b81e3 = function(arg0, arg1) {
|
|
1624
|
+
getObject(arg0).cache = __wbindgen_enum_RequestCache[arg1];
|
|
1625
|
+
};
|
|
1626
|
+
imports.wbg.__wbg_set_credentials_f621cd2d85c0c228 = function(arg0, arg1) {
|
|
1627
|
+
getObject(arg0).credentials = __wbindgen_enum_RequestCredentials[arg1];
|
|
1628
|
+
};
|
|
1629
|
+
imports.wbg.__wbg_set_headers_6926da238cd32ee4 = function(arg0, arg1) {
|
|
1630
|
+
getObject(arg0).headers = getObject(arg1);
|
|
1631
|
+
};
|
|
1632
|
+
imports.wbg.__wbg_set_method_c02d8cbbe204ac2d = function(arg0, arg1, arg2) {
|
|
1633
|
+
getObject(arg0).method = getStringFromWasm0(arg1, arg2);
|
|
1634
|
+
};
|
|
1635
|
+
imports.wbg.__wbg_set_mode_52ef73cfa79639cb = function(arg0, arg1) {
|
|
1636
|
+
getObject(arg0).mode = __wbindgen_enum_RequestMode[arg1];
|
|
1637
|
+
};
|
|
1638
|
+
imports.wbg.__wbg_set_signal_dda2cf7ccb6bee0f = function(arg0, arg1) {
|
|
1639
|
+
getObject(arg0).signal = getObject(arg1);
|
|
1640
|
+
};
|
|
1641
|
+
imports.wbg.__wbg_signal_4db5aa055bf9eb9a = function(arg0) {
|
|
1642
|
+
const ret = getObject(arg0).signal;
|
|
1643
|
+
return addHeapObject(ret);
|
|
1644
|
+
};
|
|
1645
|
+
imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
|
|
1646
|
+
const ret = getObject(arg1).stack;
|
|
1647
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1648
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1649
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1650
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1651
|
+
};
|
|
1652
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_89e1d9ac6a1b250e = function() {
|
|
1653
|
+
const ret = typeof global === "undefined" ? null : global;
|
|
1654
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
1655
|
+
};
|
|
1656
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_THIS_8b530f326a9e48ac = function() {
|
|
1657
|
+
const ret = typeof globalThis === "undefined" ? null : globalThis;
|
|
1658
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
1659
|
+
};
|
|
1660
|
+
imports.wbg.__wbg_static_accessor_SELF_6fdf4b64710cc91b = function() {
|
|
1661
|
+
const ret = typeof self === "undefined" ? null : self;
|
|
1662
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
1663
|
+
};
|
|
1664
|
+
imports.wbg.__wbg_static_accessor_WINDOW_b45bfc5a37f6cfa2 = function() {
|
|
1665
|
+
const ret = typeof window === "undefined" ? null : window;
|
|
1666
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
1667
|
+
};
|
|
1668
|
+
imports.wbg.__wbg_status_de7eed5a7a5bfd5d = function(arg0) {
|
|
1669
|
+
const ret = getObject(arg0).status;
|
|
1670
|
+
return ret;
|
|
1671
|
+
};
|
|
1672
|
+
imports.wbg.__wbg_stringify_b5fb28f6465d9c3e = function() {
|
|
1673
|
+
return handleError(function(arg0) {
|
|
1674
|
+
const ret = JSON.stringify(getObject(arg0));
|
|
1675
|
+
return addHeapObject(ret);
|
|
1676
|
+
}, arguments);
|
|
1677
|
+
};
|
|
1678
|
+
imports.wbg.__wbg_subarray_480600f3d6a9f26c = function(arg0, arg1, arg2) {
|
|
1679
|
+
const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
|
|
1680
|
+
return addHeapObject(ret);
|
|
1681
|
+
};
|
|
1682
|
+
imports.wbg.__wbg_text_dc33c15c17bdfb52 = function() {
|
|
1683
|
+
return handleError(function(arg0) {
|
|
1684
|
+
const ret = getObject(arg0).text();
|
|
1685
|
+
return addHeapObject(ret);
|
|
1686
|
+
}, arguments);
|
|
1687
|
+
};
|
|
1688
|
+
imports.wbg.__wbg_then_4f46f6544e6b4a28 = function(arg0, arg1) {
|
|
1689
|
+
const ret = getObject(arg0).then(getObject(arg1));
|
|
1690
|
+
return addHeapObject(ret);
|
|
1691
|
+
};
|
|
1692
|
+
imports.wbg.__wbg_then_70d05cf780a18d77 = function(arg0, arg1, arg2) {
|
|
1693
|
+
const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
|
|
1694
|
+
return addHeapObject(ret);
|
|
1695
|
+
};
|
|
1696
|
+
imports.wbg.__wbg_url_b36d2a5008eb056f = function(arg0, arg1) {
|
|
1697
|
+
const ret = getObject(arg1).url;
|
|
1698
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1699
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1700
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1701
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1702
|
+
};
|
|
1703
|
+
imports.wbg.__wbg_value_692627309814bb8c = function(arg0) {
|
|
1704
|
+
const ret = getObject(arg0).value;
|
|
1705
|
+
return addHeapObject(ret);
|
|
1706
|
+
};
|
|
1707
|
+
imports.wbg.__wbg_versions_c01dfd4722a88165 = function(arg0) {
|
|
1708
|
+
const ret = getObject(arg0).versions;
|
|
1709
|
+
return addHeapObject(ret);
|
|
1710
|
+
};
|
|
1711
|
+
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
1712
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
1713
|
+
return addHeapObject(ret);
|
|
1714
|
+
};
|
|
1715
|
+
imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
|
|
1716
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
1717
|
+
return addHeapObject(ret);
|
|
1718
|
+
};
|
|
1719
|
+
imports.wbg.__wbindgen_cast_91c43ecf1f8dafb8 = function(arg0, arg1) {
|
|
1720
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_596, __wasm_bindgen_func_elem_597);
|
|
1721
|
+
return addHeapObject(ret);
|
|
1722
|
+
};
|
|
1723
|
+
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
|
|
1724
|
+
const ret = arg0;
|
|
1725
|
+
return addHeapObject(ret);
|
|
1726
|
+
};
|
|
1727
|
+
imports.wbg.__wbindgen_cast_ab10518eebecf9a3 = function(arg0, arg1) {
|
|
1728
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_959, __wasm_bindgen_func_elem_960);
|
|
1729
|
+
return addHeapObject(ret);
|
|
1730
|
+
};
|
|
1731
|
+
imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
|
|
1732
|
+
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
1733
|
+
return addHeapObject(ret);
|
|
1734
|
+
};
|
|
1735
|
+
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
1736
|
+
const ret = arg0;
|
|
1737
|
+
return addHeapObject(ret);
|
|
1738
|
+
};
|
|
1739
|
+
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
|
|
1740
|
+
const ret = getObject(arg0);
|
|
1741
|
+
return addHeapObject(ret);
|
|
1742
|
+
};
|
|
1743
|
+
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
1744
|
+
takeObject(arg0);
|
|
1745
|
+
};
|
|
1746
|
+
return imports;
|
|
1747
|
+
}
|
|
1748
|
+
function __wbg_finalize_init(instance, module2) {
|
|
1749
|
+
wasm = instance.exports;
|
|
1750
|
+
__wbg_init.__wbindgen_wasm_module = module2;
|
|
1751
|
+
cachedDataViewMemory0 = null;
|
|
1752
|
+
cachedUint8ArrayMemory0 = null;
|
|
1753
|
+
wasm.__wbindgen_start();
|
|
1754
|
+
return wasm;
|
|
1755
|
+
}
|
|
1756
|
+
function initSync(module2) {
|
|
1757
|
+
if (wasm !== void 0) return wasm;
|
|
1758
|
+
if (typeof module2 !== "undefined") {
|
|
1759
|
+
if (Object.getPrototypeOf(module2) === Object.prototype) {
|
|
1760
|
+
({ module: module2 } = module2);
|
|
1761
|
+
} else {
|
|
1762
|
+
console.warn("using deprecated parameters for `initSync()`; pass a single object instead");
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
const imports = __wbg_get_imports();
|
|
1766
|
+
if (!(module2 instanceof WebAssembly.Module)) {
|
|
1767
|
+
module2 = new WebAssembly.Module(module2);
|
|
1768
|
+
}
|
|
1769
|
+
const instance = new WebAssembly.Instance(module2, imports);
|
|
1770
|
+
return __wbg_finalize_init(instance, module2);
|
|
1771
|
+
}
|
|
1772
|
+
async function __wbg_init(module_or_path) {
|
|
1773
|
+
if (wasm !== void 0) return wasm;
|
|
1774
|
+
if (typeof module_or_path !== "undefined") {
|
|
1775
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
1776
|
+
({ module_or_path } = module_or_path);
|
|
1777
|
+
} else {
|
|
1778
|
+
console.warn("using deprecated parameters for the initialization function; pass a single object instead");
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
if (typeof module_or_path === "undefined") {
|
|
1782
|
+
module_or_path = new URL("idkit_wasm_bg.wasm", import.meta.url);
|
|
1783
|
+
}
|
|
1784
|
+
const imports = __wbg_get_imports();
|
|
1785
|
+
if (typeof module_or_path === "string" || typeof Request === "function" && module_or_path instanceof Request || typeof URL === "function" && module_or_path instanceof URL) {
|
|
1786
|
+
module_or_path = fetch(module_or_path);
|
|
1787
|
+
}
|
|
1788
|
+
const { instance, module: module2 } = await __wbg_load(await module_or_path, imports);
|
|
1789
|
+
return __wbg_finalize_init(instance, module2);
|
|
1790
|
+
}
|
|
1791
|
+
var idkit_wasm_default = __wbg_init;
|
|
1792
|
+
|
|
1793
|
+
// src/lib/wasm.ts
|
|
1794
|
+
var wasmInitialized = false;
|
|
1795
|
+
var wasmInitPromise = null;
|
|
1796
|
+
async function initIDKit() {
|
|
1797
|
+
if (wasmInitialized) {
|
|
1798
|
+
return;
|
|
1799
|
+
}
|
|
1800
|
+
if (wasmInitPromise) {
|
|
1801
|
+
return wasmInitPromise;
|
|
1802
|
+
}
|
|
1803
|
+
wasmInitPromise = (async () => {
|
|
1804
|
+
try {
|
|
1805
|
+
await idkit_wasm_default();
|
|
1806
|
+
wasmInitialized = true;
|
|
1807
|
+
} catch (error) {
|
|
1808
|
+
wasmInitPromise = null;
|
|
1809
|
+
throw new Error(`Failed to initialize IDKit WASM: ${error}`);
|
|
1810
|
+
}
|
|
1811
|
+
})();
|
|
1812
|
+
return wasmInitPromise;
|
|
1813
|
+
}
|
|
1814
|
+
async function initIDKitServer() {
|
|
1815
|
+
if (wasmInitialized) {
|
|
1816
|
+
return;
|
|
1817
|
+
}
|
|
1818
|
+
if (wasmInitPromise) {
|
|
1819
|
+
return wasmInitPromise;
|
|
1820
|
+
}
|
|
1821
|
+
wasmInitPromise = (async () => {
|
|
1822
|
+
try {
|
|
1823
|
+
const { readFile } = await import('fs/promises');
|
|
1824
|
+
const { fileURLToPath } = await import('url');
|
|
1825
|
+
const wasmUrl = new URL("idkit_wasm_bg.wasm", import.meta.url);
|
|
1826
|
+
const wasmBuffer = await readFile(fileURLToPath(wasmUrl));
|
|
1827
|
+
await idkit_wasm_default({ module_or_path: wasmBuffer });
|
|
1828
|
+
wasmInitialized = true;
|
|
1829
|
+
} catch (error) {
|
|
1830
|
+
wasmInitPromise = null;
|
|
1831
|
+
throw new Error(`Failed to initialize IDKit WASM for server: ${error}`);
|
|
1832
|
+
}
|
|
1833
|
+
})();
|
|
1834
|
+
return wasmInitPromise;
|
|
1835
|
+
}
|
|
1836
|
+
|
|
1837
|
+
// src/request.ts
|
|
1838
|
+
var IDKitRequestImpl = class {
|
|
1839
|
+
constructor(wasmRequest) {
|
|
1840
|
+
this.wasmRequest = wasmRequest;
|
|
1841
|
+
this._connectorURI = wasmRequest.connectUrl();
|
|
1842
|
+
this._requestId = wasmRequest.requestId();
|
|
1843
|
+
}
|
|
1844
|
+
get connectorURI() {
|
|
1845
|
+
return this._connectorURI;
|
|
1846
|
+
}
|
|
1847
|
+
get requestId() {
|
|
1848
|
+
return this._requestId;
|
|
1849
|
+
}
|
|
1850
|
+
async pollOnce() {
|
|
1851
|
+
return await this.wasmRequest.pollForStatus();
|
|
1852
|
+
}
|
|
1853
|
+
async pollUntilCompletion(options) {
|
|
1854
|
+
const pollInterval = options?.pollInterval ?? 1e3;
|
|
1855
|
+
const timeout = options?.timeout ?? 3e5;
|
|
1856
|
+
const startTime = Date.now();
|
|
1857
|
+
while (true) {
|
|
1858
|
+
if (options?.signal?.aborted) {
|
|
1859
|
+
return { success: false, error: "cancelled" /* Cancelled */ };
|
|
1860
|
+
}
|
|
1861
|
+
if (Date.now() - startTime > timeout) {
|
|
1862
|
+
return { success: false, error: "timeout" /* Timeout */ };
|
|
1863
|
+
}
|
|
1864
|
+
const status = await this.pollOnce();
|
|
1865
|
+
if (status.type === "confirmed" && status.result) {
|
|
1866
|
+
return { success: true, result: status.result };
|
|
1867
|
+
}
|
|
1868
|
+
if (status.type === "failed") {
|
|
1869
|
+
return {
|
|
1870
|
+
success: false,
|
|
1871
|
+
error: status.error ?? "generic_error" /* GenericError */
|
|
1872
|
+
};
|
|
1873
|
+
}
|
|
1874
|
+
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
};
|
|
1878
|
+
function CredentialRequest(credential_type, options) {
|
|
1879
|
+
return {
|
|
1880
|
+
type: credential_type,
|
|
1881
|
+
signal: options?.signal,
|
|
1882
|
+
genesis_issued_at_min: options?.genesis_issued_at_min,
|
|
1883
|
+
expires_at_min: options?.expires_at_min
|
|
1884
|
+
};
|
|
1885
|
+
}
|
|
1886
|
+
function any(...nodes) {
|
|
1887
|
+
return { any: nodes };
|
|
1888
|
+
}
|
|
1889
|
+
function all(...nodes) {
|
|
1890
|
+
return { all: nodes };
|
|
1891
|
+
}
|
|
1892
|
+
function orbLegacy(opts = {}) {
|
|
1893
|
+
return { type: "OrbLegacy", signal: opts.signal };
|
|
1894
|
+
}
|
|
1895
|
+
function secureDocumentLegacy(opts = {}) {
|
|
1896
|
+
return { type: "SecureDocumentLegacy", signal: opts.signal };
|
|
1897
|
+
}
|
|
1898
|
+
function documentLegacy(opts = {}) {
|
|
1899
|
+
return { type: "DocumentLegacy", signal: opts.signal };
|
|
1900
|
+
}
|
|
1901
|
+
var IDKitBuilder2 = class {
|
|
1902
|
+
constructor(wasmBuilder) {
|
|
1903
|
+
this.wasmBuilder = wasmBuilder;
|
|
1904
|
+
}
|
|
1905
|
+
/**
|
|
1906
|
+
* Creates an IDKit request with the given constraints
|
|
1907
|
+
*
|
|
1908
|
+
* @param constraints - Constraint tree (CredentialRequest or any/all combinators)
|
|
1909
|
+
* @returns A new IDKitRequest instance
|
|
1910
|
+
*
|
|
1911
|
+
* @example
|
|
1912
|
+
* ```typescript
|
|
1913
|
+
* const builder = await IDKit.request({ app_id, action, rp_context });
|
|
1914
|
+
* const request = await builder.constraints(any(CredentialRequest('orb'), CredentialRequest('face')));
|
|
1915
|
+
* ```
|
|
1916
|
+
*/
|
|
1917
|
+
//TODO: re-enable once this is supported and World ID 4.0 is rolled out live
|
|
1918
|
+
// async constraints(constraints: ConstraintNode): Promise<IDKitRequest> {
|
|
1919
|
+
// await initIDKit();
|
|
1920
|
+
// const wasmRequest = (await this.wasmBuilder.constraints(
|
|
1921
|
+
// constraints,
|
|
1922
|
+
// )) as unknown as WasmModule.IDKitRequest;
|
|
1923
|
+
// return new IDKitRequestImpl(wasmRequest);
|
|
1924
|
+
// }
|
|
1925
|
+
/**
|
|
1926
|
+
* Creates an IDKit request from a preset (works for all request types)
|
|
1927
|
+
*
|
|
1928
|
+
* Presets provide a simplified way to create requests with predefined
|
|
1929
|
+
* credential configurations.
|
|
1930
|
+
*
|
|
1931
|
+
* @param preset - A preset object from orbLegacy()
|
|
1932
|
+
* @returns A new IDKitRequest instance
|
|
1933
|
+
*
|
|
1934
|
+
* @example
|
|
1935
|
+
* ```typescript
|
|
1936
|
+
* const builder = await IDKit.request({ app_id, action, rp_context });
|
|
1937
|
+
* const request = await builder.preset(orbLegacy({ signal: 'user-123' }));
|
|
1938
|
+
* ```
|
|
1939
|
+
*/
|
|
1940
|
+
async preset(preset) {
|
|
1941
|
+
await initIDKit();
|
|
1942
|
+
const wasmRequest = await this.wasmBuilder.preset(
|
|
1943
|
+
preset
|
|
1944
|
+
);
|
|
1945
|
+
return new IDKitRequestImpl(wasmRequest);
|
|
1946
|
+
}
|
|
1947
|
+
};
|
|
1948
|
+
function createRequest(config) {
|
|
1949
|
+
if (!config.app_id) {
|
|
1950
|
+
throw new Error("app_id is required");
|
|
1951
|
+
}
|
|
1952
|
+
if (!config.action) {
|
|
1953
|
+
throw new Error("action is required");
|
|
1954
|
+
}
|
|
1955
|
+
if (!config.rp_context) {
|
|
1956
|
+
throw new Error("rp_context is required");
|
|
1957
|
+
}
|
|
1958
|
+
if (typeof config.allow_legacy_proofs !== "boolean") {
|
|
1959
|
+
throw new Error(
|
|
1960
|
+
"allow_legacy_proofs is required. Set to true to accept v3 proofs during migration, or false to only accept v4 proofs."
|
|
1961
|
+
);
|
|
1962
|
+
}
|
|
1963
|
+
const rpContext = new idkit_wasm_exports.RpContextWasm(
|
|
1964
|
+
config.rp_context.rp_id,
|
|
1965
|
+
config.rp_context.nonce,
|
|
1966
|
+
BigInt(config.rp_context.created_at),
|
|
1967
|
+
BigInt(config.rp_context.expires_at),
|
|
1968
|
+
config.rp_context.signature
|
|
1969
|
+
);
|
|
1970
|
+
const wasmBuilder = idkit_wasm_exports.request(
|
|
1971
|
+
config.app_id,
|
|
1972
|
+
String(config.action),
|
|
1973
|
+
rpContext,
|
|
1974
|
+
config.action_description ?? null,
|
|
1975
|
+
config.bridge_url ?? null,
|
|
1976
|
+
config.allow_legacy_proofs,
|
|
1977
|
+
config.override_connect_base_url ?? null,
|
|
1978
|
+
config.environment ?? null
|
|
1979
|
+
);
|
|
1980
|
+
return new IDKitBuilder2(wasmBuilder);
|
|
1981
|
+
}
|
|
1982
|
+
function createSession2(config) {
|
|
1983
|
+
if (!config.app_id) {
|
|
1984
|
+
throw new Error("app_id is required");
|
|
1985
|
+
}
|
|
1986
|
+
if (!config.rp_context) {
|
|
1987
|
+
throw new Error("rp_context is required");
|
|
1988
|
+
}
|
|
1989
|
+
const rpContext = new idkit_wasm_exports.RpContextWasm(
|
|
1990
|
+
config.rp_context.rp_id,
|
|
1991
|
+
config.rp_context.nonce,
|
|
1992
|
+
BigInt(config.rp_context.created_at),
|
|
1993
|
+
BigInt(config.rp_context.expires_at),
|
|
1994
|
+
config.rp_context.signature
|
|
1995
|
+
);
|
|
1996
|
+
const wasmBuilder = idkit_wasm_exports.createSession(
|
|
1997
|
+
config.app_id,
|
|
1998
|
+
rpContext,
|
|
1999
|
+
config.action_description ?? null,
|
|
2000
|
+
config.bridge_url ?? null,
|
|
2001
|
+
config.override_connect_base_url ?? null,
|
|
2002
|
+
config.environment ?? null
|
|
2003
|
+
);
|
|
2004
|
+
return new IDKitBuilder2(wasmBuilder);
|
|
2005
|
+
}
|
|
2006
|
+
function proveSession2(sessionId, config) {
|
|
2007
|
+
if (!sessionId) {
|
|
2008
|
+
throw new Error("session_id is required");
|
|
2009
|
+
}
|
|
2010
|
+
if (!config.app_id) {
|
|
2011
|
+
throw new Error("app_id is required");
|
|
2012
|
+
}
|
|
2013
|
+
if (!config.rp_context) {
|
|
2014
|
+
throw new Error("rp_context is required");
|
|
2015
|
+
}
|
|
2016
|
+
const rpContext = new idkit_wasm_exports.RpContextWasm(
|
|
2017
|
+
config.rp_context.rp_id,
|
|
2018
|
+
config.rp_context.nonce,
|
|
2019
|
+
BigInt(config.rp_context.created_at),
|
|
2020
|
+
BigInt(config.rp_context.expires_at),
|
|
2021
|
+
config.rp_context.signature
|
|
2022
|
+
);
|
|
2023
|
+
const wasmBuilder = idkit_wasm_exports.proveSession(
|
|
2024
|
+
sessionId,
|
|
2025
|
+
config.app_id,
|
|
2026
|
+
rpContext,
|
|
2027
|
+
config.action_description ?? null,
|
|
2028
|
+
config.bridge_url ?? null,
|
|
2029
|
+
config.override_connect_base_url ?? null,
|
|
2030
|
+
config.environment ?? null
|
|
2031
|
+
);
|
|
2032
|
+
return new IDKitBuilder2(wasmBuilder);
|
|
2033
|
+
}
|
|
2034
|
+
var IDKit = {
|
|
2035
|
+
/** Initialize WASM for browser environments */
|
|
2036
|
+
init: initIDKit,
|
|
2037
|
+
/** Initialize WASM for Node.js/server environments */
|
|
2038
|
+
initServer: initIDKitServer,
|
|
2039
|
+
/** Create a new verification request */
|
|
2040
|
+
request: createRequest,
|
|
2041
|
+
/** Create a new session (no action, no existing session_id) */
|
|
2042
|
+
createSession: createSession2,
|
|
2043
|
+
/** Prove an existing session (no action, has session_id) */
|
|
2044
|
+
proveSession: proveSession2,
|
|
2045
|
+
/** Create a CredentialRequest for a credential type */
|
|
2046
|
+
CredentialRequest,
|
|
2047
|
+
/** Create an OR constraint - at least one child must be satisfied */
|
|
2048
|
+
any,
|
|
2049
|
+
/** Create an AND constraint - all children must be satisfied */
|
|
2050
|
+
all,
|
|
2051
|
+
/** Create an OrbLegacy preset for World ID 3.0 legacy support */
|
|
2052
|
+
orbLegacy,
|
|
2053
|
+
/** Create a SecureDocumentLegacy preset for World ID 3.0 legacy support */
|
|
2054
|
+
secureDocumentLegacy,
|
|
2055
|
+
/** Create a DocumentLegacy preset for World ID 3.0 legacy support */
|
|
2056
|
+
documentLegacy
|
|
2057
|
+
};
|
|
2058
|
+
|
|
2059
|
+
// src/lib/platform.ts
|
|
2060
|
+
var isReactNative = () => {
|
|
2061
|
+
return typeof navigator !== "undefined" && typeof navigator.product === "string" && navigator.product === "ReactNative";
|
|
2062
|
+
};
|
|
2063
|
+
var isWeb = () => {
|
|
2064
|
+
return typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
2065
|
+
};
|
|
2066
|
+
var isNode = () => {
|
|
2067
|
+
return typeof process !== "undefined" && typeof process.versions !== "undefined" && typeof process.versions.node !== "undefined";
|
|
2068
|
+
};
|
|
2069
|
+
var isServerEnvironment = () => {
|
|
2070
|
+
if (typeof process !== "undefined" && process.versions?.node) {
|
|
2071
|
+
return true;
|
|
2072
|
+
}
|
|
2073
|
+
if (typeof globalThis.Deno !== "undefined") {
|
|
2074
|
+
return true;
|
|
2075
|
+
}
|
|
2076
|
+
if (typeof globalThis.Bun !== "undefined") {
|
|
2077
|
+
return true;
|
|
2078
|
+
}
|
|
2079
|
+
return false;
|
|
2080
|
+
};
|
|
2081
|
+
|
|
2082
|
+
// src/lib/rp-signature.ts
|
|
2083
|
+
function signRequest2(action, signingKeyHex, ttlSeconds) {
|
|
2084
|
+
if (!isServerEnvironment()) {
|
|
2085
|
+
throw new Error(
|
|
2086
|
+
"signRequest can only be used in Node.js environments. This function requires access to signing keys and should never be called from browser/client-side code."
|
|
2087
|
+
);
|
|
2088
|
+
}
|
|
2089
|
+
const ttlBigInt = ttlSeconds !== void 0 ? BigInt(ttlSeconds) : void 0;
|
|
2090
|
+
return idkit_wasm_exports.signRequest(action, signingKeyHex, ttlBigInt);
|
|
2091
|
+
}
|
|
2092
|
+
|
|
2093
|
+
// src/lib/hashing.ts
|
|
2094
|
+
function hashSignal2(signal) {
|
|
2095
|
+
return idkit_wasm_exports.hashSignal(signal);
|
|
2096
|
+
}
|
|
2097
|
+
|
|
2098
|
+
export { CredentialRequest, IDKit, IDKitErrorCodes, all, any, documentLegacy, hashSignal2 as hashSignal, isNode, isReactNative, isWeb, orbLegacy, secureDocumentLegacy, signRequest2 as signRequest };
|