@spacesprotocol/libveritas 0.0.0-dev.20260326194504 → 0.0.0-dev.20260327173817
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/libveritas.d.ts +153 -1
- package/libveritas.js +145 -48
- package/libveritas_bg.wasm +0 -0
- package/package.json +12 -2
package/libveritas.d.ts
CHANGED
|
@@ -152,7 +152,7 @@ export class QueryContext {
|
|
|
152
152
|
*
|
|
153
153
|
* ```js
|
|
154
154
|
* const rs = RecordSet.pack([
|
|
155
|
-
* Record.txt("btc", "bc1qtest"),
|
|
155
|
+
* Record.txt("btc", ["bc1qtest"]),
|
|
156
156
|
* Record.blob("avatar", pngBytes),
|
|
157
157
|
* Record.unknown(0x10, raw),
|
|
158
158
|
* ]);
|
|
@@ -165,6 +165,7 @@ export class Record {
|
|
|
165
165
|
static blob(key: string, value: Uint8Array): any;
|
|
166
166
|
static seq(version: bigint): any;
|
|
167
167
|
static txt(key: string, value: string): any;
|
|
168
|
+
static txts(key: string, value: any): any;
|
|
168
169
|
static unknown(rtype: number, rdata: Uint8Array): any;
|
|
169
170
|
}
|
|
170
171
|
|
|
@@ -303,3 +304,154 @@ export function zoneIsBetterThan(a: any, b: any): boolean;
|
|
|
303
304
|
* Serialize a zone JS object to borsh bytes for storage.
|
|
304
305
|
*/
|
|
305
306
|
export function zoneToBytes(zone: any): Uint8Array;
|
|
307
|
+
|
|
308
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
309
|
+
|
|
310
|
+
export interface InitOutput {
|
|
311
|
+
readonly memory: WebAssembly.Memory;
|
|
312
|
+
readonly VERIFY_DEFAULT: () => number;
|
|
313
|
+
readonly VERIFY_DEV_MODE: () => number;
|
|
314
|
+
readonly VERIFY_ENABLE_SNARK: () => number;
|
|
315
|
+
readonly __wbg_anchors_free: (a: number, b: number) => void;
|
|
316
|
+
readonly __wbg_lookup_free: (a: number, b: number) => void;
|
|
317
|
+
readonly __wbg_message_free: (a: number, b: number) => void;
|
|
318
|
+
readonly __wbg_messagebuilder_free: (a: number, b: number) => void;
|
|
319
|
+
readonly __wbg_offchainrecords_free: (a: number, b: number) => void;
|
|
320
|
+
readonly __wbg_querycontext_free: (a: number, b: number) => void;
|
|
321
|
+
readonly __wbg_recordset_free: (a: number, b: number) => void;
|
|
322
|
+
readonly __wbg_verifiedmessage_free: (a: number, b: number) => void;
|
|
323
|
+
readonly __wbg_veritas_free: (a: number, b: number) => void;
|
|
324
|
+
readonly anchors_computeTrustSet: (a: number) => [number, number, number];
|
|
325
|
+
readonly anchors_from_json: (a: number, b: number) => [number, number, number];
|
|
326
|
+
readonly createCertificateChain: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
327
|
+
readonly decodeZone: (a: number, b: number) => [number, number, number];
|
|
328
|
+
readonly decode_certificate: (a: number, b: number) => [number, number, number];
|
|
329
|
+
readonly hash_signable_message: (a: number, b: number) => [number, number];
|
|
330
|
+
readonly lookup_advance: (a: number, b: any) => [number, number, number, number];
|
|
331
|
+
readonly lookup_expandZones: (a: number, b: any) => [number, number, number];
|
|
332
|
+
readonly lookup_new: (a: number, b: number) => [number, number, number];
|
|
333
|
+
readonly lookup_start: (a: number) => [number, number];
|
|
334
|
+
readonly message_from_bytes: (a: number, b: number) => [number, number, number];
|
|
335
|
+
readonly message_to_bytes: (a: number) => [number, number];
|
|
336
|
+
readonly message_update: (a: number, b: any) => [number, number];
|
|
337
|
+
readonly messagebuilder_addCert: (a: number, b: number, c: number) => [number, number];
|
|
338
|
+
readonly messagebuilder_addChain: (a: number, b: number, c: number) => [number, number];
|
|
339
|
+
readonly messagebuilder_addHandle: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
340
|
+
readonly messagebuilder_addRecords: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
341
|
+
readonly messagebuilder_addUpdate: (a: number, b: any) => [number, number];
|
|
342
|
+
readonly messagebuilder_build: (a: number, b: number, c: number) => [number, number, number];
|
|
343
|
+
readonly messagebuilder_chain_proof_request: (a: number) => [number, number, number];
|
|
344
|
+
readonly messagebuilder_new: () => number;
|
|
345
|
+
readonly offchainrecords_from: (a: number, b: number, c: number) => [number, number, number, number];
|
|
346
|
+
readonly querycontext_add_request: (a: number, b: number, c: number) => [number, number];
|
|
347
|
+
readonly querycontext_add_zone: (a: number, b: number, c: number) => [number, number];
|
|
348
|
+
readonly querycontext_new: () => number;
|
|
349
|
+
readonly record_blob: (a: number, b: number, c: number, d: number) => any;
|
|
350
|
+
readonly record_seq: (a: bigint) => any;
|
|
351
|
+
readonly record_txt: (a: number, b: number, c: number, d: number) => any;
|
|
352
|
+
readonly record_txts: (a: number, b: number, c: any) => any;
|
|
353
|
+
readonly record_unknown: (a: number, b: number, c: number) => any;
|
|
354
|
+
readonly recordset_isEmpty: (a: number) => number;
|
|
355
|
+
readonly recordset_new: (a: number, b: number) => number;
|
|
356
|
+
readonly recordset_pack: (a: any) => [number, number, number];
|
|
357
|
+
readonly recordset_signingId: (a: number) => [number, number];
|
|
358
|
+
readonly recordset_toBytes: (a: number) => [number, number];
|
|
359
|
+
readonly recordset_unpack: (a: number) => [number, number, number];
|
|
360
|
+
readonly verifiedmessage_certificates: (a: number) => [number, number];
|
|
361
|
+
readonly verifiedmessage_message: (a: number) => number;
|
|
362
|
+
readonly verifiedmessage_message_bytes: (a: number) => [number, number];
|
|
363
|
+
readonly verifiedmessage_rootId: (a: number) => [number, number];
|
|
364
|
+
readonly verifiedmessage_zones: (a: number) => [number, number, number];
|
|
365
|
+
readonly verify_schnorr: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
366
|
+
readonly verify_spaces_message: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
367
|
+
readonly veritas_computeTrustSet: (a: number) => [number, number, number];
|
|
368
|
+
readonly veritas_is_finalized: (a: number, b: number) => number;
|
|
369
|
+
readonly veritas_new: (a: number) => [number, number, number];
|
|
370
|
+
readonly veritas_newest_anchor: (a: number) => number;
|
|
371
|
+
readonly veritas_oldest_anchor: (a: number) => number;
|
|
372
|
+
readonly veritas_sovereignty_for: (a: number, b: number) => [number, number];
|
|
373
|
+
readonly veritas_verify: (a: number, b: number, c: number) => [number, number, number];
|
|
374
|
+
readonly veritas_verifyWithOptions: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
375
|
+
readonly zoneIsBetterThan: (a: any, b: any) => [number, number, number];
|
|
376
|
+
readonly zoneToBytes: (a: any) => [number, number, number, number];
|
|
377
|
+
readonly sys_alloc_aligned: (a: number, b: number) => number;
|
|
378
|
+
readonly sys_alloc_words: (a: number) => number;
|
|
379
|
+
readonly sys_argc: () => number;
|
|
380
|
+
readonly sys_log: (a: number, b: number) => void;
|
|
381
|
+
readonly sys_argv: (a: number, b: number, c: number) => number;
|
|
382
|
+
readonly sys_bigint: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
383
|
+
readonly sys_bigint2_1: (a: number, b: number) => void;
|
|
384
|
+
readonly sys_bigint2_2: (a: number, b: number, c: number) => void;
|
|
385
|
+
readonly sys_bigint2_3: (a: number, b: number, c: number, d: number) => void;
|
|
386
|
+
readonly sys_bigint2_4: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
387
|
+
readonly sys_bigint2_5: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
388
|
+
readonly sys_bigint2_6: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
389
|
+
readonly sys_cycle_count: () => bigint;
|
|
390
|
+
readonly sys_exit: (a: number) => void;
|
|
391
|
+
readonly sys_fork: () => number;
|
|
392
|
+
readonly sys_getenv: (a: number, b: number, c: number, d: number) => number;
|
|
393
|
+
readonly sys_halt: (a: number, b: number) => void;
|
|
394
|
+
readonly sys_input: (a: number) => number;
|
|
395
|
+
readonly sys_keccak: (a: number, b: number) => number;
|
|
396
|
+
readonly sys_pause: (a: number, b: number) => void;
|
|
397
|
+
readonly sys_pipe: (a: number) => number;
|
|
398
|
+
readonly sys_poseidon2: (a: number, b: number, c: number, d: number) => void;
|
|
399
|
+
readonly sys_prove_keccak: (a: number, b: number) => void;
|
|
400
|
+
readonly sys_rand: (a: number, b: number) => void;
|
|
401
|
+
readonly sys_read: (a: number, b: number, c: number) => number;
|
|
402
|
+
readonly sys_sha_buffer: (a: number, b: number, c: number, d: number) => void;
|
|
403
|
+
readonly sys_sha_compress: (a: number, b: number, c: number, d: number) => void;
|
|
404
|
+
readonly sys_verify_integrity: (a: number, b: number) => void;
|
|
405
|
+
readonly sys_write: (a: number, b: number, c: number) => void;
|
|
406
|
+
readonly syscall_0: (a: number, b: number, c: number, d: number) => void;
|
|
407
|
+
readonly syscall_0_nr: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
408
|
+
readonly syscall_1: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
409
|
+
readonly syscall_1_nr: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
410
|
+
readonly syscall_2: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
411
|
+
readonly syscall_2_nr: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
412
|
+
readonly syscall_3: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
413
|
+
readonly syscall_3_nr: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
414
|
+
readonly syscall_4: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
415
|
+
readonly syscall_4_nr: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
416
|
+
readonly syscall_5: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
417
|
+
readonly syscall_5_nr: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
418
|
+
readonly rustsecp256k1_v0_10_0_context_create: (a: number) => number;
|
|
419
|
+
readonly rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
|
|
420
|
+
readonly rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
|
|
421
|
+
readonly rustsecp256k1_v0_10_0_default_illegal_callback_fn: (a: number, b: number) => void;
|
|
422
|
+
readonly sys_panic: (a: number, b: number) => void;
|
|
423
|
+
readonly sys_verify_integrity2: (a: number, b: number) => void;
|
|
424
|
+
readonly sys_read_words: (a: number, b: number, c: number) => number;
|
|
425
|
+
readonly __wbg_record_free: (a: number, b: number) => void;
|
|
426
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
427
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
428
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
429
|
+
readonly __externref_table_alloc: () => number;
|
|
430
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
431
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
432
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
433
|
+
readonly __externref_drop_slice: (a: number, b: number) => void;
|
|
434
|
+
readonly __wbindgen_start: () => void;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
441
|
+
* a precompiled `WebAssembly.Module`.
|
|
442
|
+
*
|
|
443
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
444
|
+
*
|
|
445
|
+
* @returns {InitOutput}
|
|
446
|
+
*/
|
|
447
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
451
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
452
|
+
*
|
|
453
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
454
|
+
*
|
|
455
|
+
* @returns {Promise<InitOutput>}
|
|
456
|
+
*/
|
|
457
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
package/libveritas.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* @ts-self-types="./libveritas.d.ts" */
|
|
2
2
|
|
|
3
|
-
class Anchors {
|
|
3
|
+
export class Anchors {
|
|
4
4
|
__destroy_into_raw() {
|
|
5
5
|
const ptr = this.__wbg_ptr;
|
|
6
6
|
this.__wbg_ptr = 0;
|
|
@@ -37,12 +37,11 @@ class Anchors {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
if (Symbol.dispose) Anchors.prototype[Symbol.dispose] = Anchors.prototype.free;
|
|
40
|
-
exports.Anchors = Anchors;
|
|
41
40
|
|
|
42
41
|
/**
|
|
43
42
|
* Batched iterative resolver for nested handle names.
|
|
44
43
|
*/
|
|
45
|
-
class Lookup {
|
|
44
|
+
export class Lookup {
|
|
46
45
|
__destroy_into_raw() {
|
|
47
46
|
const ptr = this.__wbg_ptr;
|
|
48
47
|
this.__wbg_ptr = 0;
|
|
@@ -107,12 +106,11 @@ class Lookup {
|
|
|
107
106
|
}
|
|
108
107
|
}
|
|
109
108
|
if (Symbol.dispose) Lookup.prototype[Symbol.dispose] = Lookup.prototype.free;
|
|
110
|
-
exports.Lookup = Lookup;
|
|
111
109
|
|
|
112
110
|
/**
|
|
113
111
|
* A message containing chain proofs and handle data.
|
|
114
112
|
*/
|
|
115
|
-
class Message {
|
|
113
|
+
export class Message {
|
|
116
114
|
static __wrap(ptr) {
|
|
117
115
|
ptr = ptr >>> 0;
|
|
118
116
|
const obj = Object.create(Message.prototype);
|
|
@@ -177,12 +175,11 @@ class Message {
|
|
|
177
175
|
}
|
|
178
176
|
}
|
|
179
177
|
if (Symbol.dispose) Message.prototype[Symbol.dispose] = Message.prototype.free;
|
|
180
|
-
exports.Message = Message;
|
|
181
178
|
|
|
182
179
|
/**
|
|
183
180
|
* Builder for constructing messages from update requests and chain proofs.
|
|
184
181
|
*/
|
|
185
|
-
class MessageBuilder {
|
|
182
|
+
export class MessageBuilder {
|
|
186
183
|
__destroy_into_raw() {
|
|
187
184
|
const ptr = this.__wbg_ptr;
|
|
188
185
|
this.__wbg_ptr = 0;
|
|
@@ -303,7 +300,6 @@ class MessageBuilder {
|
|
|
303
300
|
}
|
|
304
301
|
}
|
|
305
302
|
if (Symbol.dispose) MessageBuilder.prototype[Symbol.dispose] = MessageBuilder.prototype.free;
|
|
306
|
-
exports.MessageBuilder = MessageBuilder;
|
|
307
303
|
|
|
308
304
|
/**
|
|
309
305
|
* Helpers for constructing OffchainRecords (signed record sets).
|
|
@@ -314,7 +310,7 @@ exports.MessageBuilder = MessageBuilder;
|
|
|
314
310
|
* const bytes = OffchainRecords.from(rs, sig);
|
|
315
311
|
* ```
|
|
316
312
|
*/
|
|
317
|
-
class OffchainRecords {
|
|
313
|
+
export class OffchainRecords {
|
|
318
314
|
__destroy_into_raw() {
|
|
319
315
|
const ptr = this.__wbg_ptr;
|
|
320
316
|
this.__wbg_ptr = 0;
|
|
@@ -345,9 +341,8 @@ class OffchainRecords {
|
|
|
345
341
|
}
|
|
346
342
|
}
|
|
347
343
|
if (Symbol.dispose) OffchainRecords.prototype[Symbol.dispose] = OffchainRecords.prototype.free;
|
|
348
|
-
exports.OffchainRecords = OffchainRecords;
|
|
349
344
|
|
|
350
|
-
class QueryContext {
|
|
345
|
+
export class QueryContext {
|
|
351
346
|
__destroy_into_raw() {
|
|
352
347
|
const ptr = this.__wbg_ptr;
|
|
353
348
|
this.__wbg_ptr = 0;
|
|
@@ -391,20 +386,19 @@ class QueryContext {
|
|
|
391
386
|
}
|
|
392
387
|
}
|
|
393
388
|
if (Symbol.dispose) QueryContext.prototype[Symbol.dispose] = QueryContext.prototype.free;
|
|
394
|
-
exports.QueryContext = QueryContext;
|
|
395
389
|
|
|
396
390
|
/**
|
|
397
391
|
* Record constructors for building a RecordSet.
|
|
398
392
|
*
|
|
399
393
|
* ```js
|
|
400
394
|
* const rs = RecordSet.pack([
|
|
401
|
-
* Record.txt("btc", "bc1qtest"),
|
|
395
|
+
* Record.txt("btc", ["bc1qtest"]),
|
|
402
396
|
* Record.blob("avatar", pngBytes),
|
|
403
397
|
* Record.unknown(0x10, raw),
|
|
404
398
|
* ]);
|
|
405
399
|
* ```
|
|
406
400
|
*/
|
|
407
|
-
class Record {
|
|
401
|
+
export class Record {
|
|
408
402
|
__destroy_into_raw() {
|
|
409
403
|
const ptr = this.__wbg_ptr;
|
|
410
404
|
this.__wbg_ptr = 0;
|
|
@@ -449,6 +443,17 @@ class Record {
|
|
|
449
443
|
const ret = wasm.record_txt(ptr0, len0, ptr1, len1);
|
|
450
444
|
return ret;
|
|
451
445
|
}
|
|
446
|
+
/**
|
|
447
|
+
* @param {string} key
|
|
448
|
+
* @param {any} value
|
|
449
|
+
* @returns {any}
|
|
450
|
+
*/
|
|
451
|
+
static txts(key, value) {
|
|
452
|
+
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
453
|
+
const len0 = WASM_VECTOR_LEN;
|
|
454
|
+
const ret = wasm.record_txts(ptr0, len0, value);
|
|
455
|
+
return ret;
|
|
456
|
+
}
|
|
452
457
|
/**
|
|
453
458
|
* @param {number} rtype
|
|
454
459
|
* @param {Uint8Array} rdata
|
|
@@ -462,7 +467,6 @@ class Record {
|
|
|
462
467
|
}
|
|
463
468
|
}
|
|
464
469
|
if (Symbol.dispose) Record.prototype[Symbol.dispose] = Record.prototype.free;
|
|
465
|
-
exports.Record = Record;
|
|
466
470
|
|
|
467
471
|
/**
|
|
468
472
|
* SIP-7 record set — wire-format encoded records.
|
|
@@ -477,7 +481,7 @@ exports.Record = Record;
|
|
|
477
481
|
* for (const r of rs.unpack()) { ... }
|
|
478
482
|
* ```
|
|
479
483
|
*/
|
|
480
|
-
class RecordSet {
|
|
484
|
+
export class RecordSet {
|
|
481
485
|
static __wrap(ptr) {
|
|
482
486
|
ptr = ptr >>> 0;
|
|
483
487
|
const obj = Object.create(RecordSet.prototype);
|
|
@@ -559,39 +563,35 @@ class RecordSet {
|
|
|
559
563
|
}
|
|
560
564
|
}
|
|
561
565
|
if (Symbol.dispose) RecordSet.prototype[Symbol.dispose] = RecordSet.prototype.free;
|
|
562
|
-
exports.RecordSet = RecordSet;
|
|
563
566
|
|
|
564
567
|
/**
|
|
565
568
|
* @returns {number}
|
|
566
569
|
*/
|
|
567
|
-
function VERIFY_DEFAULT() {
|
|
570
|
+
export function VERIFY_DEFAULT() {
|
|
568
571
|
const ret = wasm.VERIFY_DEFAULT();
|
|
569
572
|
return ret >>> 0;
|
|
570
573
|
}
|
|
571
|
-
exports.VERIFY_DEFAULT = VERIFY_DEFAULT;
|
|
572
574
|
|
|
573
575
|
/**
|
|
574
576
|
* @returns {number}
|
|
575
577
|
*/
|
|
576
|
-
function VERIFY_DEV_MODE() {
|
|
578
|
+
export function VERIFY_DEV_MODE() {
|
|
577
579
|
const ret = wasm.VERIFY_DEV_MODE();
|
|
578
580
|
return ret >>> 0;
|
|
579
581
|
}
|
|
580
|
-
exports.VERIFY_DEV_MODE = VERIFY_DEV_MODE;
|
|
581
582
|
|
|
582
583
|
/**
|
|
583
584
|
* @returns {number}
|
|
584
585
|
*/
|
|
585
|
-
function VERIFY_ENABLE_SNARK() {
|
|
586
|
+
export function VERIFY_ENABLE_SNARK() {
|
|
586
587
|
const ret = wasm.VERIFY_ENABLE_SNARK();
|
|
587
588
|
return ret >>> 0;
|
|
588
589
|
}
|
|
589
|
-
exports.VERIFY_ENABLE_SNARK = VERIFY_ENABLE_SNARK;
|
|
590
590
|
|
|
591
591
|
/**
|
|
592
592
|
* Result of verifying a message.
|
|
593
593
|
*/
|
|
594
|
-
class VerifiedMessage {
|
|
594
|
+
export class VerifiedMessage {
|
|
595
595
|
static __wrap(ptr) {
|
|
596
596
|
ptr = ptr >>> 0;
|
|
597
597
|
const obj = Object.create(VerifiedMessage.prototype);
|
|
@@ -660,9 +660,8 @@ class VerifiedMessage {
|
|
|
660
660
|
}
|
|
661
661
|
}
|
|
662
662
|
if (Symbol.dispose) VerifiedMessage.prototype[Symbol.dispose] = VerifiedMessage.prototype.free;
|
|
663
|
-
exports.VerifiedMessage = VerifiedMessage;
|
|
664
663
|
|
|
665
|
-
class Veritas {
|
|
664
|
+
export class Veritas {
|
|
666
665
|
__destroy_into_raw() {
|
|
667
666
|
const ptr = this.__wbg_ptr;
|
|
668
667
|
this.__wbg_ptr = 0;
|
|
@@ -767,7 +766,6 @@ class Veritas {
|
|
|
767
766
|
}
|
|
768
767
|
}
|
|
769
768
|
if (Symbol.dispose) Veritas.prototype[Symbol.dispose] = Veritas.prototype.free;
|
|
770
|
-
exports.Veritas = Veritas;
|
|
771
769
|
|
|
772
770
|
/**
|
|
773
771
|
* Create a .spacecert file from a subject name and certificate bytes.
|
|
@@ -777,7 +775,7 @@ exports.Veritas = Veritas;
|
|
|
777
775
|
* @param {Uint8Array[]} cert_bytes_list
|
|
778
776
|
* @returns {Uint8Array}
|
|
779
777
|
*/
|
|
780
|
-
function createCertificateChain(subject, cert_bytes_list) {
|
|
778
|
+
export function createCertificateChain(subject, cert_bytes_list) {
|
|
781
779
|
const ptr0 = passStringToWasm0(subject, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
782
780
|
const len0 = WASM_VECTOR_LEN;
|
|
783
781
|
const ptr1 = passArrayJsValueToWasm0(cert_bytes_list, wasm.__wbindgen_malloc);
|
|
@@ -790,14 +788,13 @@ function createCertificateChain(subject, cert_bytes_list) {
|
|
|
790
788
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
791
789
|
return v3;
|
|
792
790
|
}
|
|
793
|
-
exports.createCertificateChain = createCertificateChain;
|
|
794
791
|
|
|
795
792
|
/**
|
|
796
793
|
* Decode stored zone bytes to a plain JS object.
|
|
797
794
|
* @param {Uint8Array} bytes
|
|
798
795
|
* @returns {any}
|
|
799
796
|
*/
|
|
800
|
-
function decodeZone(bytes) {
|
|
797
|
+
export function decodeZone(bytes) {
|
|
801
798
|
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
802
799
|
const len0 = WASM_VECTOR_LEN;
|
|
803
800
|
const ret = wasm.decodeZone(ptr0, len0);
|
|
@@ -806,14 +803,13 @@ function decodeZone(bytes) {
|
|
|
806
803
|
}
|
|
807
804
|
return takeFromExternrefTable0(ret[0]);
|
|
808
805
|
}
|
|
809
|
-
exports.decodeZone = decodeZone;
|
|
810
806
|
|
|
811
807
|
/**
|
|
812
808
|
* Decode stored certificate bytes to a JS object.
|
|
813
809
|
* @param {Uint8Array} bytes
|
|
814
810
|
* @returns {any}
|
|
815
811
|
*/
|
|
816
|
-
function decode_certificate(bytes) {
|
|
812
|
+
export function decode_certificate(bytes) {
|
|
817
813
|
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
818
814
|
const len0 = WASM_VECTOR_LEN;
|
|
819
815
|
const ret = wasm.decode_certificate(ptr0, len0);
|
|
@@ -822,7 +818,6 @@ function decode_certificate(bytes) {
|
|
|
822
818
|
}
|
|
823
819
|
return takeFromExternrefTable0(ret[0]);
|
|
824
820
|
}
|
|
825
|
-
exports.decode_certificate = decode_certificate;
|
|
826
821
|
|
|
827
822
|
/**
|
|
828
823
|
* Hash a message with the Spaces signed-message prefix (SHA256).
|
|
@@ -830,7 +825,7 @@ exports.decode_certificate = decode_certificate;
|
|
|
830
825
|
* @param {Uint8Array} msg
|
|
831
826
|
* @returns {Uint8Array}
|
|
832
827
|
*/
|
|
833
|
-
function hash_signable_message(msg) {
|
|
828
|
+
export function hash_signable_message(msg) {
|
|
834
829
|
const ptr0 = passArray8ToWasm0(msg, wasm.__wbindgen_malloc);
|
|
835
830
|
const len0 = WASM_VECTOR_LEN;
|
|
836
831
|
const ret = wasm.hash_signable_message(ptr0, len0);
|
|
@@ -838,7 +833,6 @@ function hash_signable_message(msg) {
|
|
|
838
833
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
839
834
|
return v2;
|
|
840
835
|
}
|
|
841
|
-
exports.hash_signable_message = hash_signable_message;
|
|
842
836
|
|
|
843
837
|
/**
|
|
844
838
|
* Verify a raw Schnorr signature (no prefix, caller provides the 32-byte message hash).
|
|
@@ -846,7 +840,7 @@ exports.hash_signable_message = hash_signable_message;
|
|
|
846
840
|
* @param {Uint8Array} signature
|
|
847
841
|
* @param {Uint8Array} pubkey
|
|
848
842
|
*/
|
|
849
|
-
function verify_schnorr(msg_hash, signature, pubkey) {
|
|
843
|
+
export function verify_schnorr(msg_hash, signature, pubkey) {
|
|
850
844
|
const ptr0 = passArray8ToWasm0(msg_hash, wasm.__wbindgen_malloc);
|
|
851
845
|
const len0 = WASM_VECTOR_LEN;
|
|
852
846
|
const ptr1 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
@@ -858,7 +852,6 @@ function verify_schnorr(msg_hash, signature, pubkey) {
|
|
|
858
852
|
throw takeFromExternrefTable0(ret[0]);
|
|
859
853
|
}
|
|
860
854
|
}
|
|
861
|
-
exports.verify_schnorr = verify_schnorr;
|
|
862
855
|
|
|
863
856
|
/**
|
|
864
857
|
* Verify a Schnorr signature over a message using the Spaces signed-message prefix.
|
|
@@ -866,7 +859,7 @@ exports.verify_schnorr = verify_schnorr;
|
|
|
866
859
|
* @param {Uint8Array} signature
|
|
867
860
|
* @param {Uint8Array} pubkey
|
|
868
861
|
*/
|
|
869
|
-
function verify_spaces_message(msg, signature, pubkey) {
|
|
862
|
+
export function verify_spaces_message(msg, signature, pubkey) {
|
|
870
863
|
const ptr0 = passArray8ToWasm0(msg, wasm.__wbindgen_malloc);
|
|
871
864
|
const len0 = WASM_VECTOR_LEN;
|
|
872
865
|
const ptr1 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
@@ -878,7 +871,6 @@ function verify_spaces_message(msg, signature, pubkey) {
|
|
|
878
871
|
throw takeFromExternrefTable0(ret[0]);
|
|
879
872
|
}
|
|
880
873
|
}
|
|
881
|
-
exports.verify_spaces_message = verify_spaces_message;
|
|
882
874
|
|
|
883
875
|
/**
|
|
884
876
|
* Compare two zones — returns true if `a` is fresher/better than `b`.
|
|
@@ -886,21 +878,20 @@ exports.verify_spaces_message = verify_spaces_message;
|
|
|
886
878
|
* @param {any} b
|
|
887
879
|
* @returns {boolean}
|
|
888
880
|
*/
|
|
889
|
-
function zoneIsBetterThan(a, b) {
|
|
881
|
+
export function zoneIsBetterThan(a, b) {
|
|
890
882
|
const ret = wasm.zoneIsBetterThan(a, b);
|
|
891
883
|
if (ret[2]) {
|
|
892
884
|
throw takeFromExternrefTable0(ret[1]);
|
|
893
885
|
}
|
|
894
886
|
return ret[0] !== 0;
|
|
895
887
|
}
|
|
896
|
-
exports.zoneIsBetterThan = zoneIsBetterThan;
|
|
897
888
|
|
|
898
889
|
/**
|
|
899
890
|
* Serialize a zone JS object to borsh bytes for storage.
|
|
900
891
|
* @param {any} zone
|
|
901
892
|
* @returns {Uint8Array}
|
|
902
893
|
*/
|
|
903
|
-
function zoneToBytes(zone) {
|
|
894
|
+
export function zoneToBytes(zone) {
|
|
904
895
|
const ret = wasm.zoneToBytes(zone);
|
|
905
896
|
if (ret[3]) {
|
|
906
897
|
throw takeFromExternrefTable0(ret[2]);
|
|
@@ -909,7 +900,6 @@ function zoneToBytes(zone) {
|
|
|
909
900
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
910
901
|
return v1;
|
|
911
902
|
}
|
|
912
|
-
exports.zoneToBytes = zoneToBytes;
|
|
913
903
|
|
|
914
904
|
function __wbg_get_imports() {
|
|
915
905
|
const import0 = {
|
|
@@ -929,6 +919,10 @@ function __wbg_get_imports() {
|
|
|
929
919
|
const ret = arg0 === null;
|
|
930
920
|
return ret;
|
|
931
921
|
},
|
|
922
|
+
__wbg___wbindgen_is_string_7ef6b97b02428fae: function(arg0) {
|
|
923
|
+
const ret = typeof(arg0) === 'string';
|
|
924
|
+
return ret;
|
|
925
|
+
},
|
|
932
926
|
__wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
|
|
933
927
|
const ret = arg0 === undefined;
|
|
934
928
|
return ret;
|
|
@@ -962,6 +956,10 @@ function __wbg_get_imports() {
|
|
|
962
956
|
const ret = arg0[arg1 >>> 0];
|
|
963
957
|
return ret;
|
|
964
958
|
},
|
|
959
|
+
__wbg_isArray_33b91feb269ff46e: function(arg0) {
|
|
960
|
+
const ret = Array.isArray(arg0);
|
|
961
|
+
return ret;
|
|
962
|
+
},
|
|
965
963
|
__wbg_length_b3416cf66a5452c8: function(arg0) {
|
|
966
964
|
const ret = arg0.length;
|
|
967
965
|
return ret;
|
|
@@ -986,6 +984,10 @@ function __wbg_get_imports() {
|
|
|
986
984
|
const ret = new Uint8Array(arg0 >>> 0);
|
|
987
985
|
return ret;
|
|
988
986
|
},
|
|
987
|
+
__wbg_of_8bf7ed3eca00ea43: function(arg0) {
|
|
988
|
+
const ret = Array.of(arg0);
|
|
989
|
+
return ret;
|
|
990
|
+
},
|
|
989
991
|
__wbg_parse_e9eddd2a82c706eb: function() { return handleError(function (arg0, arg1) {
|
|
990
992
|
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
991
993
|
return ret;
|
|
@@ -1259,7 +1261,15 @@ function takeFromExternrefTable0(idx) {
|
|
|
1259
1261
|
|
|
1260
1262
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
1261
1263
|
cachedTextDecoder.decode();
|
|
1264
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
1265
|
+
let numBytesDecoded = 0;
|
|
1262
1266
|
function decodeText(ptr, len) {
|
|
1267
|
+
numBytesDecoded += len;
|
|
1268
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
1269
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
1270
|
+
cachedTextDecoder.decode();
|
|
1271
|
+
numBytesDecoded = len;
|
|
1272
|
+
}
|
|
1263
1273
|
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
1264
1274
|
}
|
|
1265
1275
|
|
|
@@ -1278,8 +1288,95 @@ if (!('encodeInto' in cachedTextEncoder)) {
|
|
|
1278
1288
|
|
|
1279
1289
|
let WASM_VECTOR_LEN = 0;
|
|
1280
1290
|
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1291
|
+
let wasmModule, wasm;
|
|
1292
|
+
function __wbg_finalize_init(instance, module) {
|
|
1293
|
+
wasm = instance.exports;
|
|
1294
|
+
wasmModule = module;
|
|
1295
|
+
cachedDataViewMemory0 = null;
|
|
1296
|
+
cachedUint8ArrayMemory0 = null;
|
|
1297
|
+
wasm.__wbindgen_start();
|
|
1298
|
+
return wasm;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
async function __wbg_load(module, imports) {
|
|
1302
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
1303
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
1304
|
+
try {
|
|
1305
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
1306
|
+
} catch (e) {
|
|
1307
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
1308
|
+
|
|
1309
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
1310
|
+
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);
|
|
1311
|
+
|
|
1312
|
+
} else { throw e; }
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
const bytes = await module.arrayBuffer();
|
|
1317
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
1318
|
+
} else {
|
|
1319
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
1320
|
+
|
|
1321
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
1322
|
+
return { instance, module };
|
|
1323
|
+
} else {
|
|
1324
|
+
return instance;
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
function expectedResponseType(type) {
|
|
1329
|
+
switch (type) {
|
|
1330
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
1331
|
+
}
|
|
1332
|
+
return false;
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
function initSync(module) {
|
|
1337
|
+
if (wasm !== undefined) return wasm;
|
|
1338
|
+
|
|
1339
|
+
|
|
1340
|
+
if (module !== undefined) {
|
|
1341
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
1342
|
+
({module} = module)
|
|
1343
|
+
} else {
|
|
1344
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
const imports = __wbg_get_imports();
|
|
1349
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
1350
|
+
module = new WebAssembly.Module(module);
|
|
1351
|
+
}
|
|
1352
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
1353
|
+
return __wbg_finalize_init(instance, module);
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
async function __wbg_init(module_or_path) {
|
|
1357
|
+
if (wasm !== undefined) return wasm;
|
|
1358
|
+
|
|
1359
|
+
|
|
1360
|
+
if (module_or_path !== undefined) {
|
|
1361
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
1362
|
+
({module_or_path} = module_or_path)
|
|
1363
|
+
} else {
|
|
1364
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
if (module_or_path === undefined) {
|
|
1369
|
+
module_or_path = new URL('libveritas_bg.wasm', import.meta.url);
|
|
1370
|
+
}
|
|
1371
|
+
const imports = __wbg_get_imports();
|
|
1372
|
+
|
|
1373
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
1374
|
+
module_or_path = fetch(module_or_path);
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
1378
|
+
|
|
1379
|
+
return __wbg_finalize_init(instance, module);
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
export { initSync, __wbg_init as default };
|
package/libveritas_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spacesprotocol/libveritas",
|
|
3
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.0-dev.20260327173817",
|
|
4
5
|
"files": [
|
|
5
6
|
"libveritas_bg.wasm",
|
|
6
7
|
"libveritas.js",
|
|
7
8
|
"libveritas.d.ts"
|
|
8
9
|
],
|
|
9
10
|
"main": "libveritas.js",
|
|
10
|
-
"types": "libveritas.d.ts"
|
|
11
|
+
"types": "libveritas.d.ts",
|
|
12
|
+
"sideEffects": [
|
|
13
|
+
"./snippets/*"
|
|
14
|
+
],
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"node": "./node.js",
|
|
18
|
+
"default": "./libveritas.js"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
11
21
|
}
|