@spacesprotocol/libveritas 0.0.0-dev.20260225100845

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.
@@ -0,0 +1,94 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ export class QueryContext {
5
+ free(): void;
6
+ [Symbol.dispose](): void;
7
+ /**
8
+ * Add a handle to verify (e.g. "alice@bitcoin").
9
+ * If no requests are added, all handles in the message are verified.
10
+ */
11
+ add_request(handle: string): void;
12
+ /**
13
+ * Add a known zone from stored bytes (from a previous verification).
14
+ */
15
+ add_zone(zone_bytes: Uint8Array): void;
16
+ constructor();
17
+ }
18
+
19
+ /**
20
+ * Result of verifying a message.
21
+ */
22
+ export class VerifiedMessage {
23
+ private constructor();
24
+ free(): void;
25
+ [Symbol.dispose](): void;
26
+ /**
27
+ * Get certificate for a specific handle (e.g. "alice@bitcoin").
28
+ * Returns null if the handle was not verified.
29
+ */
30
+ certificate(handle: string): any;
31
+ /**
32
+ * All certificates as a JS array.
33
+ */
34
+ certificates(): any;
35
+ /**
36
+ * All verified zones.
37
+ */
38
+ zones(): VeritasZone[];
39
+ }
40
+
41
+ export class Veritas {
42
+ free(): void;
43
+ [Symbol.dispose](): void;
44
+ is_finalized(commitment_height: number): boolean;
45
+ constructor(anchors: any, dev_mode: boolean);
46
+ newest_anchor(): number;
47
+ oldest_anchor(): number;
48
+ sovereignty_for(commitment_height: number): string;
49
+ /**
50
+ * Verify a message against a query context.
51
+ */
52
+ verify_message(ctx: QueryContext, msg: Uint8Array): VerifiedMessage;
53
+ }
54
+
55
+ export class VeritasZone {
56
+ private constructor();
57
+ free(): void;
58
+ [Symbol.dispose](): void;
59
+ anchor(): number;
60
+ handle(): string;
61
+ is_better_than(other: VeritasZone): boolean;
62
+ sovereignty(): string;
63
+ to_bytes(): Uint8Array;
64
+ /**
65
+ * Returns the full zone as a JS object.
66
+ */
67
+ to_json(): any;
68
+ }
69
+
70
+ /**
71
+ * Decode stored certificate bytes to a JS object.
72
+ */
73
+ export function decode_certificate(bytes: Uint8Array): any;
74
+
75
+ /**
76
+ * Decode stored zone bytes to a VeritasZone object.
77
+ */
78
+ export function decode_zone(bytes: Uint8Array): VeritasZone;
79
+
80
+ /**
81
+ * Hash a message with the Spaces signed-message prefix (SHA256).
82
+ * Returns the 32-byte digest suitable for Schnorr signing/verification.
83
+ */
84
+ export function hash_signable_message(msg: Uint8Array): Uint8Array;
85
+
86
+ /**
87
+ * Verify a raw Schnorr signature (no prefix, caller provides the 32-byte message hash).
88
+ */
89
+ export function verify_schnorr(msg_hash: Uint8Array, signature: Uint8Array, pubkey: Uint8Array): void;
90
+
91
+ /**
92
+ * Verify a Schnorr signature over a message using the Spaces signed-message prefix.
93
+ */
94
+ export function verify_spaces_message(msg: Uint8Array, signature: Uint8Array, pubkey: Uint8Array): void;
package/libveritas.js ADDED
@@ -0,0 +1,762 @@
1
+ /* @ts-self-types="./libveritas.d.ts" */
2
+
3
+ class QueryContext {
4
+ __destroy_into_raw() {
5
+ const ptr = this.__wbg_ptr;
6
+ this.__wbg_ptr = 0;
7
+ QueryContextFinalization.unregister(this);
8
+ return ptr;
9
+ }
10
+ free() {
11
+ const ptr = this.__destroy_into_raw();
12
+ wasm.__wbg_querycontext_free(ptr, 0);
13
+ }
14
+ /**
15
+ * Add a handle to verify (e.g. "alice@bitcoin").
16
+ * If no requests are added, all handles in the message are verified.
17
+ * @param {string} handle
18
+ */
19
+ add_request(handle) {
20
+ const ptr0 = passStringToWasm0(handle, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
21
+ const len0 = WASM_VECTOR_LEN;
22
+ const ret = wasm.querycontext_add_request(this.__wbg_ptr, ptr0, len0);
23
+ if (ret[1]) {
24
+ throw takeFromExternrefTable0(ret[0]);
25
+ }
26
+ }
27
+ /**
28
+ * Add a known zone from stored bytes (from a previous verification).
29
+ * @param {Uint8Array} zone_bytes
30
+ */
31
+ add_zone(zone_bytes) {
32
+ const ptr0 = passArray8ToWasm0(zone_bytes, wasm.__wbindgen_malloc);
33
+ const len0 = WASM_VECTOR_LEN;
34
+ const ret = wasm.querycontext_add_zone(this.__wbg_ptr, ptr0, len0);
35
+ if (ret[1]) {
36
+ throw takeFromExternrefTable0(ret[0]);
37
+ }
38
+ }
39
+ constructor() {
40
+ const ret = wasm.querycontext_new();
41
+ this.__wbg_ptr = ret >>> 0;
42
+ QueryContextFinalization.register(this, this.__wbg_ptr, this);
43
+ return this;
44
+ }
45
+ }
46
+ if (Symbol.dispose) QueryContext.prototype[Symbol.dispose] = QueryContext.prototype.free;
47
+ exports.QueryContext = QueryContext;
48
+
49
+ /**
50
+ * Result of verifying a message.
51
+ */
52
+ class VerifiedMessage {
53
+ static __wrap(ptr) {
54
+ ptr = ptr >>> 0;
55
+ const obj = Object.create(VerifiedMessage.prototype);
56
+ obj.__wbg_ptr = ptr;
57
+ VerifiedMessageFinalization.register(obj, obj.__wbg_ptr, obj);
58
+ return obj;
59
+ }
60
+ __destroy_into_raw() {
61
+ const ptr = this.__wbg_ptr;
62
+ this.__wbg_ptr = 0;
63
+ VerifiedMessageFinalization.unregister(this);
64
+ return ptr;
65
+ }
66
+ free() {
67
+ const ptr = this.__destroy_into_raw();
68
+ wasm.__wbg_verifiedmessage_free(ptr, 0);
69
+ }
70
+ /**
71
+ * Get certificate for a specific handle (e.g. "alice@bitcoin").
72
+ * Returns null if the handle was not verified.
73
+ * @param {string} handle
74
+ * @returns {any}
75
+ */
76
+ certificate(handle) {
77
+ const ptr0 = passStringToWasm0(handle, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
78
+ const len0 = WASM_VECTOR_LEN;
79
+ const ret = wasm.verifiedmessage_certificate(this.__wbg_ptr, ptr0, len0);
80
+ if (ret[2]) {
81
+ throw takeFromExternrefTable0(ret[1]);
82
+ }
83
+ return takeFromExternrefTable0(ret[0]);
84
+ }
85
+ /**
86
+ * All certificates as a JS array.
87
+ * @returns {any}
88
+ */
89
+ certificates() {
90
+ const ret = wasm.verifiedmessage_certificates(this.__wbg_ptr);
91
+ if (ret[2]) {
92
+ throw takeFromExternrefTable0(ret[1]);
93
+ }
94
+ return takeFromExternrefTable0(ret[0]);
95
+ }
96
+ /**
97
+ * All verified zones.
98
+ * @returns {VeritasZone[]}
99
+ */
100
+ zones() {
101
+ const ret = wasm.verifiedmessage_zones(this.__wbg_ptr);
102
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
103
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
104
+ return v1;
105
+ }
106
+ }
107
+ if (Symbol.dispose) VerifiedMessage.prototype[Symbol.dispose] = VerifiedMessage.prototype.free;
108
+ exports.VerifiedMessage = VerifiedMessage;
109
+
110
+ class Veritas {
111
+ __destroy_into_raw() {
112
+ const ptr = this.__wbg_ptr;
113
+ this.__wbg_ptr = 0;
114
+ VeritasFinalization.unregister(this);
115
+ return ptr;
116
+ }
117
+ free() {
118
+ const ptr = this.__destroy_into_raw();
119
+ wasm.__wbg_veritas_free(ptr, 0);
120
+ }
121
+ /**
122
+ * @param {number} commitment_height
123
+ * @returns {boolean}
124
+ */
125
+ is_finalized(commitment_height) {
126
+ const ret = wasm.veritas_is_finalized(this.__wbg_ptr, commitment_height);
127
+ return ret !== 0;
128
+ }
129
+ /**
130
+ * @param {any} anchors
131
+ * @param {boolean} dev_mode
132
+ */
133
+ constructor(anchors, dev_mode) {
134
+ const ret = wasm.veritas_new(anchors, dev_mode);
135
+ if (ret[2]) {
136
+ throw takeFromExternrefTable0(ret[1]);
137
+ }
138
+ this.__wbg_ptr = ret[0] >>> 0;
139
+ VeritasFinalization.register(this, this.__wbg_ptr, this);
140
+ return this;
141
+ }
142
+ /**
143
+ * @returns {number}
144
+ */
145
+ newest_anchor() {
146
+ const ret = wasm.veritas_newest_anchor(this.__wbg_ptr);
147
+ return ret >>> 0;
148
+ }
149
+ /**
150
+ * @returns {number}
151
+ */
152
+ oldest_anchor() {
153
+ const ret = wasm.veritas_oldest_anchor(this.__wbg_ptr);
154
+ return ret >>> 0;
155
+ }
156
+ /**
157
+ * @param {number} commitment_height
158
+ * @returns {string}
159
+ */
160
+ sovereignty_for(commitment_height) {
161
+ let deferred1_0;
162
+ let deferred1_1;
163
+ try {
164
+ const ret = wasm.veritas_sovereignty_for(this.__wbg_ptr, commitment_height);
165
+ deferred1_0 = ret[0];
166
+ deferred1_1 = ret[1];
167
+ return getStringFromWasm0(ret[0], ret[1]);
168
+ } finally {
169
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
170
+ }
171
+ }
172
+ /**
173
+ * Verify a message against a query context.
174
+ * @param {QueryContext} ctx
175
+ * @param {Uint8Array} msg
176
+ * @returns {VerifiedMessage}
177
+ */
178
+ verify_message(ctx, msg) {
179
+ _assertClass(ctx, QueryContext);
180
+ const ptr0 = passArray8ToWasm0(msg, wasm.__wbindgen_malloc);
181
+ const len0 = WASM_VECTOR_LEN;
182
+ const ret = wasm.veritas_verify_message(this.__wbg_ptr, ctx.__wbg_ptr, ptr0, len0);
183
+ if (ret[2]) {
184
+ throw takeFromExternrefTable0(ret[1]);
185
+ }
186
+ return VerifiedMessage.__wrap(ret[0]);
187
+ }
188
+ }
189
+ if (Symbol.dispose) Veritas.prototype[Symbol.dispose] = Veritas.prototype.free;
190
+ exports.Veritas = Veritas;
191
+
192
+ class VeritasZone {
193
+ static __wrap(ptr) {
194
+ ptr = ptr >>> 0;
195
+ const obj = Object.create(VeritasZone.prototype);
196
+ obj.__wbg_ptr = ptr;
197
+ VeritasZoneFinalization.register(obj, obj.__wbg_ptr, obj);
198
+ return obj;
199
+ }
200
+ __destroy_into_raw() {
201
+ const ptr = this.__wbg_ptr;
202
+ this.__wbg_ptr = 0;
203
+ VeritasZoneFinalization.unregister(this);
204
+ return ptr;
205
+ }
206
+ free() {
207
+ const ptr = this.__destroy_into_raw();
208
+ wasm.__wbg_veritaszone_free(ptr, 0);
209
+ }
210
+ /**
211
+ * @returns {number}
212
+ */
213
+ anchor() {
214
+ const ret = wasm.veritaszone_anchor(this.__wbg_ptr);
215
+ return ret >>> 0;
216
+ }
217
+ /**
218
+ * @returns {string}
219
+ */
220
+ handle() {
221
+ let deferred1_0;
222
+ let deferred1_1;
223
+ try {
224
+ const ret = wasm.veritaszone_handle(this.__wbg_ptr);
225
+ deferred1_0 = ret[0];
226
+ deferred1_1 = ret[1];
227
+ return getStringFromWasm0(ret[0], ret[1]);
228
+ } finally {
229
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
230
+ }
231
+ }
232
+ /**
233
+ * @param {VeritasZone} other
234
+ * @returns {boolean}
235
+ */
236
+ is_better_than(other) {
237
+ _assertClass(other, VeritasZone);
238
+ const ret = wasm.veritaszone_is_better_than(this.__wbg_ptr, other.__wbg_ptr);
239
+ if (ret[2]) {
240
+ throw takeFromExternrefTable0(ret[1]);
241
+ }
242
+ return ret[0] !== 0;
243
+ }
244
+ /**
245
+ * @returns {string}
246
+ */
247
+ sovereignty() {
248
+ let deferred1_0;
249
+ let deferred1_1;
250
+ try {
251
+ const ret = wasm.veritaszone_sovereignty(this.__wbg_ptr);
252
+ deferred1_0 = ret[0];
253
+ deferred1_1 = ret[1];
254
+ return getStringFromWasm0(ret[0], ret[1]);
255
+ } finally {
256
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
257
+ }
258
+ }
259
+ /**
260
+ * @returns {Uint8Array}
261
+ */
262
+ to_bytes() {
263
+ const ret = wasm.veritaszone_to_bytes(this.__wbg_ptr);
264
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
265
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
266
+ return v1;
267
+ }
268
+ /**
269
+ * Returns the full zone as a JS object.
270
+ * @returns {any}
271
+ */
272
+ to_json() {
273
+ const ret = wasm.veritaszone_to_json(this.__wbg_ptr);
274
+ if (ret[2]) {
275
+ throw takeFromExternrefTable0(ret[1]);
276
+ }
277
+ return takeFromExternrefTable0(ret[0]);
278
+ }
279
+ }
280
+ if (Symbol.dispose) VeritasZone.prototype[Symbol.dispose] = VeritasZone.prototype.free;
281
+ exports.VeritasZone = VeritasZone;
282
+
283
+ /**
284
+ * Decode stored certificate bytes to a JS object.
285
+ * @param {Uint8Array} bytes
286
+ * @returns {any}
287
+ */
288
+ function decode_certificate(bytes) {
289
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
290
+ const len0 = WASM_VECTOR_LEN;
291
+ const ret = wasm.decode_certificate(ptr0, len0);
292
+ if (ret[2]) {
293
+ throw takeFromExternrefTable0(ret[1]);
294
+ }
295
+ return takeFromExternrefTable0(ret[0]);
296
+ }
297
+ exports.decode_certificate = decode_certificate;
298
+
299
+ /**
300
+ * Decode stored zone bytes to a VeritasZone object.
301
+ * @param {Uint8Array} bytes
302
+ * @returns {VeritasZone}
303
+ */
304
+ function decode_zone(bytes) {
305
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
306
+ const len0 = WASM_VECTOR_LEN;
307
+ const ret = wasm.decode_zone(ptr0, len0);
308
+ if (ret[2]) {
309
+ throw takeFromExternrefTable0(ret[1]);
310
+ }
311
+ return VeritasZone.__wrap(ret[0]);
312
+ }
313
+ exports.decode_zone = decode_zone;
314
+
315
+ /**
316
+ * Hash a message with the Spaces signed-message prefix (SHA256).
317
+ * Returns the 32-byte digest suitable for Schnorr signing/verification.
318
+ * @param {Uint8Array} msg
319
+ * @returns {Uint8Array}
320
+ */
321
+ function hash_signable_message(msg) {
322
+ const ptr0 = passArray8ToWasm0(msg, wasm.__wbindgen_malloc);
323
+ const len0 = WASM_VECTOR_LEN;
324
+ const ret = wasm.hash_signable_message(ptr0, len0);
325
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
326
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
327
+ return v2;
328
+ }
329
+ exports.hash_signable_message = hash_signable_message;
330
+
331
+ /**
332
+ * Verify a raw Schnorr signature (no prefix, caller provides the 32-byte message hash).
333
+ * @param {Uint8Array} msg_hash
334
+ * @param {Uint8Array} signature
335
+ * @param {Uint8Array} pubkey
336
+ */
337
+ function verify_schnorr(msg_hash, signature, pubkey) {
338
+ const ptr0 = passArray8ToWasm0(msg_hash, wasm.__wbindgen_malloc);
339
+ const len0 = WASM_VECTOR_LEN;
340
+ const ptr1 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
341
+ const len1 = WASM_VECTOR_LEN;
342
+ const ptr2 = passArray8ToWasm0(pubkey, wasm.__wbindgen_malloc);
343
+ const len2 = WASM_VECTOR_LEN;
344
+ const ret = wasm.verify_schnorr(ptr0, len0, ptr1, len1, ptr2, len2);
345
+ if (ret[1]) {
346
+ throw takeFromExternrefTable0(ret[0]);
347
+ }
348
+ }
349
+ exports.verify_schnorr = verify_schnorr;
350
+
351
+ /**
352
+ * Verify a Schnorr signature over a message using the Spaces signed-message prefix.
353
+ * @param {Uint8Array} msg
354
+ * @param {Uint8Array} signature
355
+ * @param {Uint8Array} pubkey
356
+ */
357
+ function verify_spaces_message(msg, signature, pubkey) {
358
+ const ptr0 = passArray8ToWasm0(msg, wasm.__wbindgen_malloc);
359
+ const len0 = WASM_VECTOR_LEN;
360
+ const ptr1 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
361
+ const len1 = WASM_VECTOR_LEN;
362
+ const ptr2 = passArray8ToWasm0(pubkey, wasm.__wbindgen_malloc);
363
+ const len2 = WASM_VECTOR_LEN;
364
+ const ret = wasm.verify_spaces_message(ptr0, len0, ptr1, len1, ptr2, len2);
365
+ if (ret[1]) {
366
+ throw takeFromExternrefTable0(ret[0]);
367
+ }
368
+ }
369
+ exports.verify_spaces_message = verify_spaces_message;
370
+
371
+ function __wbg_get_imports() {
372
+ const import0 = {
373
+ __proto__: null,
374
+ __wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
375
+ const ret = Error(getStringFromWasm0(arg0, arg1));
376
+ return ret;
377
+ },
378
+ __wbg_Number_04624de7d0e8332d: function(arg0) {
379
+ const ret = Number(arg0);
380
+ return ret;
381
+ },
382
+ __wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) {
383
+ const ret = String(arg1);
384
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
385
+ const len1 = WASM_VECTOR_LEN;
386
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
387
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
388
+ },
389
+ __wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25: function(arg0) {
390
+ const v = arg0;
391
+ const ret = typeof(v) === 'boolean' ? v : undefined;
392
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
393
+ },
394
+ __wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {
395
+ const ret = debugString(arg1);
396
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
397
+ const len1 = WASM_VECTOR_LEN;
398
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
399
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
400
+ },
401
+ __wbg___wbindgen_in_47fa6863be6f2f25: function(arg0, arg1) {
402
+ const ret = arg0 in arg1;
403
+ return ret;
404
+ },
405
+ __wbg___wbindgen_is_function_0095a73b8b156f76: function(arg0) {
406
+ const ret = typeof(arg0) === 'function';
407
+ return ret;
408
+ },
409
+ __wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {
410
+ const val = arg0;
411
+ const ret = typeof(val) === 'object' && val !== null;
412
+ return ret;
413
+ },
414
+ __wbg___wbindgen_is_undefined_9e4d92534c42d778: function(arg0) {
415
+ const ret = arg0 === undefined;
416
+ return ret;
417
+ },
418
+ __wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811: function(arg0, arg1) {
419
+ const ret = arg0 == arg1;
420
+ return ret;
421
+ },
422
+ __wbg___wbindgen_number_get_8ff4255516ccad3e: function(arg0, arg1) {
423
+ const obj = arg1;
424
+ const ret = typeof(obj) === 'number' ? obj : undefined;
425
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
426
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
427
+ },
428
+ __wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {
429
+ const obj = arg1;
430
+ const ret = typeof(obj) === 'string' ? obj : undefined;
431
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
432
+ var len1 = WASM_VECTOR_LEN;
433
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
434
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
435
+ },
436
+ __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
437
+ throw new Error(getStringFromWasm0(arg0, arg1));
438
+ },
439
+ __wbg_call_389efe28435a9388: function() { return handleError(function (arg0, arg1) {
440
+ const ret = arg0.call(arg1);
441
+ return ret;
442
+ }, arguments); },
443
+ __wbg_done_57b39ecd9addfe81: function(arg0) {
444
+ const ret = arg0.done;
445
+ return ret;
446
+ },
447
+ __wbg_get_9b94d73e6221f75c: function(arg0, arg1) {
448
+ const ret = arg0[arg1 >>> 0];
449
+ return ret;
450
+ },
451
+ __wbg_get_b3ed3ad4be2bc8ac: function() { return handleError(function (arg0, arg1) {
452
+ const ret = Reflect.get(arg0, arg1);
453
+ return ret;
454
+ }, arguments); },
455
+ __wbg_get_with_ref_key_1dc361bd10053bfe: function(arg0, arg1) {
456
+ const ret = arg0[arg1];
457
+ return ret;
458
+ },
459
+ __wbg_instanceof_ArrayBuffer_c367199e2fa2aa04: function(arg0) {
460
+ let result;
461
+ try {
462
+ result = arg0 instanceof ArrayBuffer;
463
+ } catch (_) {
464
+ result = false;
465
+ }
466
+ const ret = result;
467
+ return ret;
468
+ },
469
+ __wbg_instanceof_Uint8Array_9b9075935c74707c: function(arg0) {
470
+ let result;
471
+ try {
472
+ result = arg0 instanceof Uint8Array;
473
+ } catch (_) {
474
+ result = false;
475
+ }
476
+ const ret = result;
477
+ return ret;
478
+ },
479
+ __wbg_isArray_d314bb98fcf08331: function(arg0) {
480
+ const ret = Array.isArray(arg0);
481
+ return ret;
482
+ },
483
+ __wbg_isSafeInteger_bfbc7332a9768d2a: function(arg0) {
484
+ const ret = Number.isSafeInteger(arg0);
485
+ return ret;
486
+ },
487
+ __wbg_iterator_6ff6560ca1568e55: function() {
488
+ const ret = Symbol.iterator;
489
+ return ret;
490
+ },
491
+ __wbg_length_32ed9a279acd054c: function(arg0) {
492
+ const ret = arg0.length;
493
+ return ret;
494
+ },
495
+ __wbg_length_35a7bace40f36eac: function(arg0) {
496
+ const ret = arg0.length;
497
+ return ret;
498
+ },
499
+ __wbg_new_dd2b680c8bf6ae29: function(arg0) {
500
+ const ret = new Uint8Array(arg0);
501
+ return ret;
502
+ },
503
+ __wbg_next_3482f54c49e8af19: function() { return handleError(function (arg0) {
504
+ const ret = arg0.next();
505
+ return ret;
506
+ }, arguments); },
507
+ __wbg_next_418f80d8f5303233: function(arg0) {
508
+ const ret = arg0.next;
509
+ return ret;
510
+ },
511
+ __wbg_parse_708461a1feddfb38: function() { return handleError(function (arg0, arg1) {
512
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
513
+ return ret;
514
+ }, arguments); },
515
+ __wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
516
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
517
+ },
518
+ __wbg_value_0546255b415e96c1: function(arg0) {
519
+ const ret = arg0.value;
520
+ return ret;
521
+ },
522
+ __wbg_veritaszone_new: function(arg0) {
523
+ const ret = VeritasZone.__wrap(arg0);
524
+ return ret;
525
+ },
526
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
527
+ // Cast intrinsic for `Ref(String) -> Externref`.
528
+ const ret = getStringFromWasm0(arg0, arg1);
529
+ return ret;
530
+ },
531
+ __wbindgen_init_externref_table: function() {
532
+ const table = wasm.__wbindgen_externrefs;
533
+ const offset = table.grow(4);
534
+ table.set(0, undefined);
535
+ table.set(offset + 0, undefined);
536
+ table.set(offset + 1, null);
537
+ table.set(offset + 2, true);
538
+ table.set(offset + 3, false);
539
+ },
540
+ };
541
+ return {
542
+ __proto__: null,
543
+ "./libveritas_bg.js": import0,
544
+ };
545
+ }
546
+
547
+ const QueryContextFinalization = (typeof FinalizationRegistry === 'undefined')
548
+ ? { register: () => {}, unregister: () => {} }
549
+ : new FinalizationRegistry(ptr => wasm.__wbg_querycontext_free(ptr >>> 0, 1));
550
+ const VerifiedMessageFinalization = (typeof FinalizationRegistry === 'undefined')
551
+ ? { register: () => {}, unregister: () => {} }
552
+ : new FinalizationRegistry(ptr => wasm.__wbg_verifiedmessage_free(ptr >>> 0, 1));
553
+ const VeritasFinalization = (typeof FinalizationRegistry === 'undefined')
554
+ ? { register: () => {}, unregister: () => {} }
555
+ : new FinalizationRegistry(ptr => wasm.__wbg_veritas_free(ptr >>> 0, 1));
556
+ const VeritasZoneFinalization = (typeof FinalizationRegistry === 'undefined')
557
+ ? { register: () => {}, unregister: () => {} }
558
+ : new FinalizationRegistry(ptr => wasm.__wbg_veritaszone_free(ptr >>> 0, 1));
559
+
560
+ function addToExternrefTable0(obj) {
561
+ const idx = wasm.__externref_table_alloc();
562
+ wasm.__wbindgen_externrefs.set(idx, obj);
563
+ return idx;
564
+ }
565
+
566
+ function _assertClass(instance, klass) {
567
+ if (!(instance instanceof klass)) {
568
+ throw new Error(`expected instance of ${klass.name}`);
569
+ }
570
+ }
571
+
572
+ function debugString(val) {
573
+ // primitive types
574
+ const type = typeof val;
575
+ if (type == 'number' || type == 'boolean' || val == null) {
576
+ return `${val}`;
577
+ }
578
+ if (type == 'string') {
579
+ return `"${val}"`;
580
+ }
581
+ if (type == 'symbol') {
582
+ const description = val.description;
583
+ if (description == null) {
584
+ return 'Symbol';
585
+ } else {
586
+ return `Symbol(${description})`;
587
+ }
588
+ }
589
+ if (type == 'function') {
590
+ const name = val.name;
591
+ if (typeof name == 'string' && name.length > 0) {
592
+ return `Function(${name})`;
593
+ } else {
594
+ return 'Function';
595
+ }
596
+ }
597
+ // objects
598
+ if (Array.isArray(val)) {
599
+ const length = val.length;
600
+ let debug = '[';
601
+ if (length > 0) {
602
+ debug += debugString(val[0]);
603
+ }
604
+ for(let i = 1; i < length; i++) {
605
+ debug += ', ' + debugString(val[i]);
606
+ }
607
+ debug += ']';
608
+ return debug;
609
+ }
610
+ // Test for built-in
611
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
612
+ let className;
613
+ if (builtInMatches && builtInMatches.length > 1) {
614
+ className = builtInMatches[1];
615
+ } else {
616
+ // Failed to match the standard '[object ClassName]'
617
+ return toString.call(val);
618
+ }
619
+ if (className == 'Object') {
620
+ // we're a user defined class or Object
621
+ // JSON.stringify avoids problems with cycles, and is generally much
622
+ // easier than looping through ownProperties of `val`.
623
+ try {
624
+ return 'Object(' + JSON.stringify(val) + ')';
625
+ } catch (_) {
626
+ return 'Object';
627
+ }
628
+ }
629
+ // errors
630
+ if (val instanceof Error) {
631
+ return `${val.name}: ${val.message}\n${val.stack}`;
632
+ }
633
+ // TODO we could test for more things here, like `Set`s and `Map`s.
634
+ return className;
635
+ }
636
+
637
+ function getArrayJsValueFromWasm0(ptr, len) {
638
+ ptr = ptr >>> 0;
639
+ const mem = getDataViewMemory0();
640
+ const result = [];
641
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
642
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
643
+ }
644
+ wasm.__externref_drop_slice(ptr, len);
645
+ return result;
646
+ }
647
+
648
+ function getArrayU8FromWasm0(ptr, len) {
649
+ ptr = ptr >>> 0;
650
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
651
+ }
652
+
653
+ let cachedDataViewMemory0 = null;
654
+ function getDataViewMemory0() {
655
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
656
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
657
+ }
658
+ return cachedDataViewMemory0;
659
+ }
660
+
661
+ function getStringFromWasm0(ptr, len) {
662
+ ptr = ptr >>> 0;
663
+ return decodeText(ptr, len);
664
+ }
665
+
666
+ let cachedUint8ArrayMemory0 = null;
667
+ function getUint8ArrayMemory0() {
668
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
669
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
670
+ }
671
+ return cachedUint8ArrayMemory0;
672
+ }
673
+
674
+ function handleError(f, args) {
675
+ try {
676
+ return f.apply(this, args);
677
+ } catch (e) {
678
+ const idx = addToExternrefTable0(e);
679
+ wasm.__wbindgen_exn_store(idx);
680
+ }
681
+ }
682
+
683
+ function isLikeNone(x) {
684
+ return x === undefined || x === null;
685
+ }
686
+
687
+ function passArray8ToWasm0(arg, malloc) {
688
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
689
+ getUint8ArrayMemory0().set(arg, ptr / 1);
690
+ WASM_VECTOR_LEN = arg.length;
691
+ return ptr;
692
+ }
693
+
694
+ function passStringToWasm0(arg, malloc, realloc) {
695
+ if (realloc === undefined) {
696
+ const buf = cachedTextEncoder.encode(arg);
697
+ const ptr = malloc(buf.length, 1) >>> 0;
698
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
699
+ WASM_VECTOR_LEN = buf.length;
700
+ return ptr;
701
+ }
702
+
703
+ let len = arg.length;
704
+ let ptr = malloc(len, 1) >>> 0;
705
+
706
+ const mem = getUint8ArrayMemory0();
707
+
708
+ let offset = 0;
709
+
710
+ for (; offset < len; offset++) {
711
+ const code = arg.charCodeAt(offset);
712
+ if (code > 0x7F) break;
713
+ mem[ptr + offset] = code;
714
+ }
715
+ if (offset !== len) {
716
+ if (offset !== 0) {
717
+ arg = arg.slice(offset);
718
+ }
719
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
720
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
721
+ const ret = cachedTextEncoder.encodeInto(arg, view);
722
+
723
+ offset += ret.written;
724
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
725
+ }
726
+
727
+ WASM_VECTOR_LEN = offset;
728
+ return ptr;
729
+ }
730
+
731
+ function takeFromExternrefTable0(idx) {
732
+ const value = wasm.__wbindgen_externrefs.get(idx);
733
+ wasm.__externref_table_dealloc(idx);
734
+ return value;
735
+ }
736
+
737
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
738
+ cachedTextDecoder.decode();
739
+ function decodeText(ptr, len) {
740
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
741
+ }
742
+
743
+ const cachedTextEncoder = new TextEncoder();
744
+
745
+ if (!('encodeInto' in cachedTextEncoder)) {
746
+ cachedTextEncoder.encodeInto = function (arg, view) {
747
+ const buf = cachedTextEncoder.encode(arg);
748
+ view.set(buf);
749
+ return {
750
+ read: arg.length,
751
+ written: buf.length
752
+ };
753
+ };
754
+ }
755
+
756
+ let WASM_VECTOR_LEN = 0;
757
+
758
+ const wasmPath = `${__dirname}/libveritas_bg.wasm`;
759
+ const wasmBytes = require('fs').readFileSync(wasmPath);
760
+ const wasmModule = new WebAssembly.Module(wasmBytes);
761
+ const wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
762
+ wasm.__wbindgen_start();
Binary file
package/package.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "@spacesprotocol/libveritas",
3
+ "version": "0.0.0-dev.20260225100845",
4
+ "files": [
5
+ "libveritas_bg.wasm",
6
+ "libveritas.js",
7
+ "libveritas.d.ts"
8
+ ],
9
+ "main": "libveritas.js",
10
+ "types": "libveritas.d.ts"
11
+ }