@spacesprotocol/libveritas 0.0.0-dev.20260225143024 → 0.0.0-dev.20260306131110

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 ADDED
@@ -0,0 +1,98 @@
1
+ # @spacesprotocol/libveritas
2
+
3
+ JavaScript/WASM bindings for [libveritas](https://github.com/spacesprotocol/libveritas) — stateless verification for Bitcoin handles using the [Spaces protocol](https://spacesprotocol.org).
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @spacesprotocol/libveritas
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Verifying a message
14
+
15
+ ```javascript
16
+ import { Veritas, QueryContext } from "@spacesprotocol/libveritas";
17
+
18
+ // Load trust anchors
19
+ const veritas = new Veritas(anchors);
20
+
21
+ console.log(`Anchors: ${veritas.oldestAnchor()} .. ${veritas.newestAnchor()}`);
22
+
23
+ // Build query context (empty = verify all handles)
24
+ const ctx = new QueryContext();
25
+ ctx.addRequest("alice@bitcoin");
26
+
27
+ // Verify a message (binary data from relay)
28
+ const result = veritas.verifyMessage(ctx, messageBytes);
29
+
30
+ // Inspect verified zones
31
+ for (const zone of result.zones()) {
32
+ console.log(`${zone.handle()} -> ${zone.sovereignty()}`);
33
+
34
+ // Store zone for later comparison
35
+ const bytes = zone.toBytes();
36
+ }
37
+
38
+ // Compare zones
39
+ const better = newerZone.isBetterThan(olderZone);
40
+
41
+ // Get certificates
42
+ for (const cert of result.certificates()) {
43
+ console.log(cert);
44
+ }
45
+ ```
46
+
47
+ ### Building a message
48
+
49
+ ```javascript
50
+ import { MessageBuilder, RecordSet, OffchainData } from "@spacesprotocol/libveritas";
51
+
52
+ // Construct offchain data
53
+ let rs = new RecordSet(1, { nostr: "npub1...", ipv4: "127.0.0.1" });
54
+ let sig = wallet.signSchnorr(rs.id());
55
+ let offchainBytes = OffchainData.from(rs, sig);
56
+
57
+ // Build a message with certificates and offchain data
58
+ let builder = new MessageBuilder([
59
+ { name: "@bitcoin", cert: rootCertBytes },
60
+ { name: "alice@bitcoin", offchainData: offchainBytes, cert: leafCertBytes },
61
+ ]);
62
+
63
+ // Get the chain proof request to send to a provider
64
+ let request = builder.chainProofRequest();
65
+
66
+ // ... send request to provider, get chain proof back ...
67
+
68
+ let msg = builder.build(chainProofBytes);
69
+
70
+ // Serialize for transport
71
+ let bytes = msg.toBytes();
72
+ ```
73
+
74
+ ### Updating offchain data
75
+
76
+ ```javascript
77
+ // Update offchain data on a verified message (no cert changes)
78
+ let msg = result.message();
79
+
80
+ let rs = new RecordSet(2, { nostr: "npub1new..." });
81
+ let sig = wallet.signSchnorr(rs.id());
82
+ let offchainBytes = OffchainData.from(rs, sig);
83
+
84
+ msg.update([
85
+ { name: "alice@bitcoin", offchainData: offchainBytes },
86
+ ]);
87
+
88
+ let updatedBytes = msg.toBytes();
89
+ ```
90
+
91
+ ## Building from source
92
+
93
+ Requires [Rust](https://rustup.rs/) and [wasm-pack](https://rustwasm.github.io/wasm-pack/):
94
+
95
+ ```bash
96
+ cargo install wasm-pack
97
+ wasm-pack build bindings/wasm --target web
98
+ ```
package/libveritas.d.ts CHANGED
@@ -1,6 +1,82 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
 
4
+ /**
5
+ * A message containing chain proofs and handle data.
6
+ */
7
+ export class Message {
8
+ free(): void;
9
+ [Symbol.dispose](): void;
10
+ /**
11
+ * Decode a message from borsh bytes.
12
+ */
13
+ constructor(bytes: Uint8Array);
14
+ /**
15
+ * Serialize the message to borsh bytes.
16
+ */
17
+ to_bytes(): Uint8Array;
18
+ /**
19
+ * Update offchain data on this message.
20
+ *
21
+ * Accepts a JS array of data update entries:
22
+ * ```js
23
+ * msg.update([
24
+ * { name: "alice@bitcoin", offchain_data: Uint8Array },
25
+ * { name: "@bitcoin", delegate_offchain_data: Uint8Array }
26
+ * ])
27
+ * ```
28
+ *
29
+ * To update certificates, construct a new message instead.
30
+ */
31
+ update(updates: any): void;
32
+ }
33
+
34
+ /**
35
+ * Builder for constructing messages from update requests and chain proofs.
36
+ */
37
+ export class MessageBuilder {
38
+ free(): void;
39
+ [Symbol.dispose](): void;
40
+ /**
41
+ * Build the message from a borsh-encoded ChainProof.
42
+ *
43
+ * Consumes the builder — cannot be called twice.
44
+ */
45
+ build(chain_proof: Uint8Array): Message;
46
+ /**
47
+ * Returns the chain proof request as a JS object.
48
+ *
49
+ * Send this to the provider/fabric to get the chain proofs needed for `build()`.
50
+ */
51
+ chain_proof_request(): any;
52
+ /**
53
+ * Create a builder from a JS array of update requests.
54
+ *
55
+ * ```js
56
+ * let builder = new MessageBuilder([
57
+ * { name: "@bitcoin", offchain_data: Uint8Array, cert: Uint8Array },
58
+ * { name: "alice@bitcoin", offchain_data: Uint8Array, cert: Uint8Array }
59
+ * ])
60
+ * ```
61
+ */
62
+ constructor(requests: any);
63
+ }
64
+
65
+ /**
66
+ * Helpers for constructing OffchainData.
67
+ */
68
+ export class OffchainData {
69
+ private constructor();
70
+ free(): void;
71
+ [Symbol.dispose](): void;
72
+ /**
73
+ * Create borsh-encoded OffchainData from a RecordSet and a 64-byte Schnorr signature.
74
+ *
75
+ * Consumes the RecordSet.
76
+ */
77
+ static from(record_set: RecordSet, signature: Uint8Array): Uint8Array;
78
+ }
79
+
4
80
  export class QueryContext {
5
81
  free(): void;
6
82
  [Symbol.dispose](): void;
@@ -16,6 +92,28 @@ export class QueryContext {
16
92
  constructor();
17
93
  }
18
94
 
95
+ /**
96
+ * Serialized records ready to be signed.
97
+ *
98
+ * ```js
99
+ * let rs = new RecordSet(1, { nostr: "npub1...", ipv4: "127.0.0.1" });
100
+ * let sig = wallet.signSchnorr(rs.id());
101
+ * let offchainBytes = OffchainData.from(rs, sig);
102
+ * ```
103
+ */
104
+ export class RecordSet {
105
+ free(): void;
106
+ [Symbol.dispose](): void;
107
+ /**
108
+ * The 32-byte hash to sign.
109
+ */
110
+ id(): Uint8Array;
111
+ /**
112
+ * Create a record set from a sequence number and a JS object of key-value pairs.
113
+ */
114
+ constructor(seq: number, records: any);
115
+ }
116
+
19
117
  /**
20
118
  * Result of verifying a message.
21
119
  */
@@ -32,17 +130,25 @@ export class VerifiedMessage {
32
130
  * All certificates as a JS array.
33
131
  */
34
132
  certificates(): any;
133
+ /**
134
+ * Get the verified message for rebroadcasting or updating.
135
+ */
136
+ message(): Message;
137
+ /**
138
+ * Get the verified message as borsh bytes.
139
+ */
140
+ message_bytes(): Uint8Array;
35
141
  /**
36
142
  * All verified zones.
37
143
  */
38
- zones(): VeritasZone[];
144
+ zones(): Zone[];
39
145
  }
40
146
 
41
147
  export class Veritas {
42
148
  free(): void;
43
149
  [Symbol.dispose](): void;
44
150
  is_finalized(commitment_height: number): boolean;
45
- constructor(anchors: any, dev_mode: boolean);
151
+ constructor(anchors: any);
46
152
  newest_anchor(): number;
47
153
  oldest_anchor(): number;
48
154
  sovereignty_for(commitment_height: number): string;
@@ -50,15 +156,16 @@ export class Veritas {
50
156
  * Verify a message against a query context.
51
157
  */
52
158
  verify_message(ctx: QueryContext, msg: Uint8Array): VerifiedMessage;
159
+ static withDevMode(anchors: any): Veritas;
53
160
  }
54
161
 
55
- export class VeritasZone {
162
+ export class Zone {
56
163
  private constructor();
57
164
  free(): void;
58
165
  [Symbol.dispose](): void;
59
166
  anchor(): number;
60
167
  handle(): string;
61
- is_better_than(other: VeritasZone): boolean;
168
+ is_better_than(other: Zone): boolean;
62
169
  sovereignty(): string;
63
170
  to_bytes(): Uint8Array;
64
171
  /**
@@ -73,9 +180,9 @@ export class VeritasZone {
73
180
  export function decode_certificate(bytes: Uint8Array): any;
74
181
 
75
182
  /**
76
- * Decode stored zone bytes to a VeritasZone object.
183
+ * Decode stored zone bytes to a Zone object.
77
184
  */
78
- export function decode_zone(bytes: Uint8Array): VeritasZone;
185
+ export function decode_zone(bytes: Uint8Array): Zone;
79
186
 
80
187
  /**
81
188
  * Hash a message with the Spaces signed-message prefix (SHA256).
package/libveritas.js CHANGED
@@ -1,5 +1,180 @@
1
1
  /* @ts-self-types="./libveritas.d.ts" */
2
2
 
3
+ /**
4
+ * A message containing chain proofs and handle data.
5
+ */
6
+ class Message {
7
+ static __wrap(ptr) {
8
+ ptr = ptr >>> 0;
9
+ const obj = Object.create(Message.prototype);
10
+ obj.__wbg_ptr = ptr;
11
+ MessageFinalization.register(obj, obj.__wbg_ptr, obj);
12
+ return obj;
13
+ }
14
+ __destroy_into_raw() {
15
+ const ptr = this.__wbg_ptr;
16
+ this.__wbg_ptr = 0;
17
+ MessageFinalization.unregister(this);
18
+ return ptr;
19
+ }
20
+ free() {
21
+ const ptr = this.__destroy_into_raw();
22
+ wasm.__wbg_message_free(ptr, 0);
23
+ }
24
+ /**
25
+ * Decode a message from borsh bytes.
26
+ * @param {Uint8Array} bytes
27
+ */
28
+ constructor(bytes) {
29
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
30
+ const len0 = WASM_VECTOR_LEN;
31
+ const ret = wasm.message_from_bytes(ptr0, len0);
32
+ if (ret[2]) {
33
+ throw takeFromExternrefTable0(ret[1]);
34
+ }
35
+ this.__wbg_ptr = ret[0] >>> 0;
36
+ MessageFinalization.register(this, this.__wbg_ptr, this);
37
+ return this;
38
+ }
39
+ /**
40
+ * Serialize the message to borsh bytes.
41
+ * @returns {Uint8Array}
42
+ */
43
+ to_bytes() {
44
+ const ret = wasm.message_to_bytes(this.__wbg_ptr);
45
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
46
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
47
+ return v1;
48
+ }
49
+ /**
50
+ * Update offchain data on this message.
51
+ *
52
+ * Accepts a JS array of data update entries:
53
+ * ```js
54
+ * msg.update([
55
+ * { name: "alice@bitcoin", offchain_data: Uint8Array },
56
+ * { name: "@bitcoin", delegate_offchain_data: Uint8Array }
57
+ * ])
58
+ * ```
59
+ *
60
+ * To update certificates, construct a new message instead.
61
+ * @param {any} updates
62
+ */
63
+ update(updates) {
64
+ const ret = wasm.message_update(this.__wbg_ptr, updates);
65
+ if (ret[1]) {
66
+ throw takeFromExternrefTable0(ret[0]);
67
+ }
68
+ }
69
+ }
70
+ if (Symbol.dispose) Message.prototype[Symbol.dispose] = Message.prototype.free;
71
+ exports.Message = Message;
72
+
73
+ /**
74
+ * Builder for constructing messages from update requests and chain proofs.
75
+ */
76
+ class MessageBuilder {
77
+ __destroy_into_raw() {
78
+ const ptr = this.__wbg_ptr;
79
+ this.__wbg_ptr = 0;
80
+ MessageBuilderFinalization.unregister(this);
81
+ return ptr;
82
+ }
83
+ free() {
84
+ const ptr = this.__destroy_into_raw();
85
+ wasm.__wbg_messagebuilder_free(ptr, 0);
86
+ }
87
+ /**
88
+ * Build the message from a borsh-encoded ChainProof.
89
+ *
90
+ * Consumes the builder — cannot be called twice.
91
+ * @param {Uint8Array} chain_proof
92
+ * @returns {Message}
93
+ */
94
+ build(chain_proof) {
95
+ const ptr0 = passArray8ToWasm0(chain_proof, wasm.__wbindgen_malloc);
96
+ const len0 = WASM_VECTOR_LEN;
97
+ const ret = wasm.messagebuilder_build(this.__wbg_ptr, ptr0, len0);
98
+ if (ret[2]) {
99
+ throw takeFromExternrefTable0(ret[1]);
100
+ }
101
+ return Message.__wrap(ret[0]);
102
+ }
103
+ /**
104
+ * Returns the chain proof request as a JS object.
105
+ *
106
+ * Send this to the provider/fabric to get the chain proofs needed for `build()`.
107
+ * @returns {any}
108
+ */
109
+ chain_proof_request() {
110
+ const ret = wasm.messagebuilder_chain_proof_request(this.__wbg_ptr);
111
+ if (ret[2]) {
112
+ throw takeFromExternrefTable0(ret[1]);
113
+ }
114
+ return takeFromExternrefTable0(ret[0]);
115
+ }
116
+ /**
117
+ * Create a builder from a JS array of update requests.
118
+ *
119
+ * ```js
120
+ * let builder = new MessageBuilder([
121
+ * { name: "@bitcoin", offchain_data: Uint8Array, cert: Uint8Array },
122
+ * { name: "alice@bitcoin", offchain_data: Uint8Array, cert: Uint8Array }
123
+ * ])
124
+ * ```
125
+ * @param {any} requests
126
+ */
127
+ constructor(requests) {
128
+ const ret = wasm.messagebuilder_new(requests);
129
+ if (ret[2]) {
130
+ throw takeFromExternrefTable0(ret[1]);
131
+ }
132
+ this.__wbg_ptr = ret[0] >>> 0;
133
+ MessageBuilderFinalization.register(this, this.__wbg_ptr, this);
134
+ return this;
135
+ }
136
+ }
137
+ if (Symbol.dispose) MessageBuilder.prototype[Symbol.dispose] = MessageBuilder.prototype.free;
138
+ exports.MessageBuilder = MessageBuilder;
139
+
140
+ /**
141
+ * Helpers for constructing OffchainData.
142
+ */
143
+ class OffchainData {
144
+ __destroy_into_raw() {
145
+ const ptr = this.__wbg_ptr;
146
+ this.__wbg_ptr = 0;
147
+ OffchainDataFinalization.unregister(this);
148
+ return ptr;
149
+ }
150
+ free() {
151
+ const ptr = this.__destroy_into_raw();
152
+ wasm.__wbg_offchaindata_free(ptr, 0);
153
+ }
154
+ /**
155
+ * Create borsh-encoded OffchainData from a RecordSet and a 64-byte Schnorr signature.
156
+ *
157
+ * Consumes the RecordSet.
158
+ * @param {RecordSet} record_set
159
+ * @param {Uint8Array} signature
160
+ * @returns {Uint8Array}
161
+ */
162
+ static from(record_set, signature) {
163
+ _assertClass(record_set, RecordSet);
164
+ const ptr0 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
165
+ const len0 = WASM_VECTOR_LEN;
166
+ const ret = wasm.offchaindata_from(record_set.__wbg_ptr, ptr0, len0);
167
+ if (ret[3]) {
168
+ throw takeFromExternrefTable0(ret[2]);
169
+ }
170
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
171
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
172
+ return v2;
173
+ }
174
+ }
175
+ if (Symbol.dispose) OffchainData.prototype[Symbol.dispose] = OffchainData.prototype.free;
176
+ exports.OffchainData = OffchainData;
177
+
3
178
  class QueryContext {
4
179
  __destroy_into_raw() {
5
180
  const ptr = this.__wbg_ptr;
@@ -46,6 +221,57 @@ class QueryContext {
46
221
  if (Symbol.dispose) QueryContext.prototype[Symbol.dispose] = QueryContext.prototype.free;
47
222
  exports.QueryContext = QueryContext;
48
223
 
224
+ /**
225
+ * Serialized records ready to be signed.
226
+ *
227
+ * ```js
228
+ * let rs = new RecordSet(1, { nostr: "npub1...", ipv4: "127.0.0.1" });
229
+ * let sig = wallet.signSchnorr(rs.id());
230
+ * let offchainBytes = OffchainData.from(rs, sig);
231
+ * ```
232
+ */
233
+ class RecordSet {
234
+ __destroy_into_raw() {
235
+ const ptr = this.__wbg_ptr;
236
+ this.__wbg_ptr = 0;
237
+ RecordSetFinalization.unregister(this);
238
+ return ptr;
239
+ }
240
+ free() {
241
+ const ptr = this.__destroy_into_raw();
242
+ wasm.__wbg_recordset_free(ptr, 0);
243
+ }
244
+ /**
245
+ * The 32-byte hash to sign.
246
+ * @returns {Uint8Array}
247
+ */
248
+ id() {
249
+ const ret = wasm.recordset_id(this.__wbg_ptr);
250
+ if (ret[3]) {
251
+ throw takeFromExternrefTable0(ret[2]);
252
+ }
253
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
254
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
255
+ return v1;
256
+ }
257
+ /**
258
+ * Create a record set from a sequence number and a JS object of key-value pairs.
259
+ * @param {number} seq
260
+ * @param {any} records
261
+ */
262
+ constructor(seq, records) {
263
+ const ret = wasm.recordset_new(seq, records);
264
+ if (ret[2]) {
265
+ throw takeFromExternrefTable0(ret[1]);
266
+ }
267
+ this.__wbg_ptr = ret[0] >>> 0;
268
+ RecordSetFinalization.register(this, this.__wbg_ptr, this);
269
+ return this;
270
+ }
271
+ }
272
+ if (Symbol.dispose) RecordSet.prototype[Symbol.dispose] = RecordSet.prototype.free;
273
+ exports.RecordSet = RecordSet;
274
+
49
275
  /**
50
276
  * Result of verifying a message.
51
277
  */
@@ -93,9 +319,27 @@ class VerifiedMessage {
93
319
  }
94
320
  return takeFromExternrefTable0(ret[0]);
95
321
  }
322
+ /**
323
+ * Get the verified message for rebroadcasting or updating.
324
+ * @returns {Message}
325
+ */
326
+ message() {
327
+ const ret = wasm.verifiedmessage_message(this.__wbg_ptr);
328
+ return Message.__wrap(ret);
329
+ }
330
+ /**
331
+ * Get the verified message as borsh bytes.
332
+ * @returns {Uint8Array}
333
+ */
334
+ message_bytes() {
335
+ const ret = wasm.verifiedmessage_message_bytes(this.__wbg_ptr);
336
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
337
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
338
+ return v1;
339
+ }
96
340
  /**
97
341
  * All verified zones.
98
- * @returns {VeritasZone[]}
342
+ * @returns {Zone[]}
99
343
  */
100
344
  zones() {
101
345
  const ret = wasm.verifiedmessage_zones(this.__wbg_ptr);
@@ -108,6 +352,13 @@ if (Symbol.dispose) VerifiedMessage.prototype[Symbol.dispose] = VerifiedMessage.
108
352
  exports.VerifiedMessage = VerifiedMessage;
109
353
 
110
354
  class Veritas {
355
+ static __wrap(ptr) {
356
+ ptr = ptr >>> 0;
357
+ const obj = Object.create(Veritas.prototype);
358
+ obj.__wbg_ptr = ptr;
359
+ VeritasFinalization.register(obj, obj.__wbg_ptr, obj);
360
+ return obj;
361
+ }
111
362
  __destroy_into_raw() {
112
363
  const ptr = this.__wbg_ptr;
113
364
  this.__wbg_ptr = 0;
@@ -128,10 +379,9 @@ class Veritas {
128
379
  }
129
380
  /**
130
381
  * @param {any} anchors
131
- * @param {boolean} dev_mode
132
382
  */
133
- constructor(anchors, dev_mode) {
134
- const ret = wasm.veritas_new(anchors, dev_mode);
383
+ constructor(anchors) {
384
+ const ret = wasm.veritas_new(anchors);
135
385
  if (ret[2]) {
136
386
  throw takeFromExternrefTable0(ret[1]);
137
387
  }
@@ -185,33 +435,44 @@ class Veritas {
185
435
  }
186
436
  return VerifiedMessage.__wrap(ret[0]);
187
437
  }
438
+ /**
439
+ * @param {any} anchors
440
+ * @returns {Veritas}
441
+ */
442
+ static withDevMode(anchors) {
443
+ const ret = wasm.veritas_withDevMode(anchors);
444
+ if (ret[2]) {
445
+ throw takeFromExternrefTable0(ret[1]);
446
+ }
447
+ return Veritas.__wrap(ret[0]);
448
+ }
188
449
  }
189
450
  if (Symbol.dispose) Veritas.prototype[Symbol.dispose] = Veritas.prototype.free;
190
451
  exports.Veritas = Veritas;
191
452
 
192
- class VeritasZone {
453
+ class Zone {
193
454
  static __wrap(ptr) {
194
455
  ptr = ptr >>> 0;
195
- const obj = Object.create(VeritasZone.prototype);
456
+ const obj = Object.create(Zone.prototype);
196
457
  obj.__wbg_ptr = ptr;
197
- VeritasZoneFinalization.register(obj, obj.__wbg_ptr, obj);
458
+ ZoneFinalization.register(obj, obj.__wbg_ptr, obj);
198
459
  return obj;
199
460
  }
200
461
  __destroy_into_raw() {
201
462
  const ptr = this.__wbg_ptr;
202
463
  this.__wbg_ptr = 0;
203
- VeritasZoneFinalization.unregister(this);
464
+ ZoneFinalization.unregister(this);
204
465
  return ptr;
205
466
  }
206
467
  free() {
207
468
  const ptr = this.__destroy_into_raw();
208
- wasm.__wbg_veritaszone_free(ptr, 0);
469
+ wasm.__wbg_zone_free(ptr, 0);
209
470
  }
210
471
  /**
211
472
  * @returns {number}
212
473
  */
213
474
  anchor() {
214
- const ret = wasm.veritaszone_anchor(this.__wbg_ptr);
475
+ const ret = wasm.zone_anchor(this.__wbg_ptr);
215
476
  return ret >>> 0;
216
477
  }
217
478
  /**
@@ -221,7 +482,7 @@ class VeritasZone {
221
482
  let deferred1_0;
222
483
  let deferred1_1;
223
484
  try {
224
- const ret = wasm.veritaszone_handle(this.__wbg_ptr);
485
+ const ret = wasm.zone_handle(this.__wbg_ptr);
225
486
  deferred1_0 = ret[0];
226
487
  deferred1_1 = ret[1];
227
488
  return getStringFromWasm0(ret[0], ret[1]);
@@ -230,12 +491,12 @@ class VeritasZone {
230
491
  }
231
492
  }
232
493
  /**
233
- * @param {VeritasZone} other
494
+ * @param {Zone} other
234
495
  * @returns {boolean}
235
496
  */
236
497
  is_better_than(other) {
237
- _assertClass(other, VeritasZone);
238
- const ret = wasm.veritaszone_is_better_than(this.__wbg_ptr, other.__wbg_ptr);
498
+ _assertClass(other, Zone);
499
+ const ret = wasm.zone_is_better_than(this.__wbg_ptr, other.__wbg_ptr);
239
500
  if (ret[2]) {
240
501
  throw takeFromExternrefTable0(ret[1]);
241
502
  }
@@ -248,7 +509,7 @@ class VeritasZone {
248
509
  let deferred1_0;
249
510
  let deferred1_1;
250
511
  try {
251
- const ret = wasm.veritaszone_sovereignty(this.__wbg_ptr);
512
+ const ret = wasm.zone_sovereignty(this.__wbg_ptr);
252
513
  deferred1_0 = ret[0];
253
514
  deferred1_1 = ret[1];
254
515
  return getStringFromWasm0(ret[0], ret[1]);
@@ -260,7 +521,7 @@ class VeritasZone {
260
521
  * @returns {Uint8Array}
261
522
  */
262
523
  to_bytes() {
263
- const ret = wasm.veritaszone_to_bytes(this.__wbg_ptr);
524
+ const ret = wasm.zone_to_bytes(this.__wbg_ptr);
264
525
  var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
265
526
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
266
527
  return v1;
@@ -270,15 +531,15 @@ class VeritasZone {
270
531
  * @returns {any}
271
532
  */
272
533
  to_json() {
273
- const ret = wasm.veritaszone_to_json(this.__wbg_ptr);
534
+ const ret = wasm.zone_to_json(this.__wbg_ptr);
274
535
  if (ret[2]) {
275
536
  throw takeFromExternrefTable0(ret[1]);
276
537
  }
277
538
  return takeFromExternrefTable0(ret[0]);
278
539
  }
279
540
  }
280
- if (Symbol.dispose) VeritasZone.prototype[Symbol.dispose] = VeritasZone.prototype.free;
281
- exports.VeritasZone = VeritasZone;
541
+ if (Symbol.dispose) Zone.prototype[Symbol.dispose] = Zone.prototype.free;
542
+ exports.Zone = Zone;
282
543
 
283
544
  /**
284
545
  * Decode stored certificate bytes to a JS object.
@@ -297,9 +558,9 @@ function decode_certificate(bytes) {
297
558
  exports.decode_certificate = decode_certificate;
298
559
 
299
560
  /**
300
- * Decode stored zone bytes to a VeritasZone object.
561
+ * Decode stored zone bytes to a Zone object.
301
562
  * @param {Uint8Array} bytes
302
- * @returns {VeritasZone}
563
+ * @returns {Zone}
303
564
  */
304
565
  function decode_zone(bytes) {
305
566
  const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
@@ -308,7 +569,7 @@ function decode_zone(bytes) {
308
569
  if (ret[2]) {
309
570
  throw takeFromExternrefTable0(ret[1]);
310
571
  }
311
- return VeritasZone.__wrap(ret[0]);
572
+ return Zone.__wrap(ret[0]);
312
573
  }
313
574
  exports.decode_zone = decode_zone;
314
575
 
@@ -371,61 +632,65 @@ exports.verify_spaces_message = verify_spaces_message;
371
632
  function __wbg_get_imports() {
372
633
  const import0 = {
373
634
  __proto__: null,
374
- __wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
635
+ __wbg_Error_83742b46f01ce22d: function(arg0, arg1) {
375
636
  const ret = Error(getStringFromWasm0(arg0, arg1));
376
637
  return ret;
377
638
  },
378
- __wbg_Number_04624de7d0e8332d: function(arg0) {
639
+ __wbg_Number_a5a435bd7bbec835: function(arg0) {
379
640
  const ret = Number(arg0);
380
641
  return ret;
381
642
  },
382
- __wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) {
643
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
383
644
  const ret = String(arg1);
384
645
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
385
646
  const len1 = WASM_VECTOR_LEN;
386
647
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
387
648
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
388
649
  },
389
- __wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25: function(arg0) {
650
+ __wbg___wbindgen_boolean_get_c0f3f60bac5a78d1: function(arg0) {
390
651
  const v = arg0;
391
652
  const ret = typeof(v) === 'boolean' ? v : undefined;
392
653
  return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
393
654
  },
394
- __wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {
655
+ __wbg___wbindgen_debug_string_5398f5bb970e0daa: function(arg0, arg1) {
395
656
  const ret = debugString(arg1);
396
657
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
397
658
  const len1 = WASM_VECTOR_LEN;
398
659
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
399
660
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
400
661
  },
401
- __wbg___wbindgen_in_47fa6863be6f2f25: function(arg0, arg1) {
662
+ __wbg___wbindgen_in_41dbb8413020e076: function(arg0, arg1) {
402
663
  const ret = arg0 in arg1;
403
664
  return ret;
404
665
  },
405
- __wbg___wbindgen_is_function_0095a73b8b156f76: function(arg0) {
666
+ __wbg___wbindgen_is_function_3c846841762788c1: function(arg0) {
406
667
  const ret = typeof(arg0) === 'function';
407
668
  return ret;
408
669
  },
409
- __wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {
670
+ __wbg___wbindgen_is_null_0b605fc6b167c56f: function(arg0) {
671
+ const ret = arg0 === null;
672
+ return ret;
673
+ },
674
+ __wbg___wbindgen_is_object_781bc9f159099513: function(arg0) {
410
675
  const val = arg0;
411
676
  const ret = typeof(val) === 'object' && val !== null;
412
677
  return ret;
413
678
  },
414
- __wbg___wbindgen_is_undefined_9e4d92534c42d778: function(arg0) {
679
+ __wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
415
680
  const ret = arg0 === undefined;
416
681
  return ret;
417
682
  },
418
- __wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811: function(arg0, arg1) {
683
+ __wbg___wbindgen_jsval_loose_eq_5bcc3bed3c69e72b: function(arg0, arg1) {
419
684
  const ret = arg0 == arg1;
420
685
  return ret;
421
686
  },
422
- __wbg___wbindgen_number_get_8ff4255516ccad3e: function(arg0, arg1) {
687
+ __wbg___wbindgen_number_get_34bb9d9dcfa21373: function(arg0, arg1) {
423
688
  const obj = arg1;
424
689
  const ret = typeof(obj) === 'number' ? obj : undefined;
425
690
  getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
426
691
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
427
692
  },
428
- __wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {
693
+ __wbg___wbindgen_string_get_395e606bd0ee4427: function(arg0, arg1) {
429
694
  const obj = arg1;
430
695
  const ret = typeof(obj) === 'string' ? obj : undefined;
431
696
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -433,30 +698,46 @@ function __wbg_get_imports() {
433
698
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
434
699
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
435
700
  },
436
- __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
701
+ __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
437
702
  throw new Error(getStringFromWasm0(arg0, arg1));
438
703
  },
439
- __wbg_call_389efe28435a9388: function() { return handleError(function (arg0, arg1) {
704
+ __wbg_call_e133b57c9155d22c: function() { return handleError(function (arg0, arg1) {
440
705
  const ret = arg0.call(arg1);
441
706
  return ret;
442
707
  }, arguments); },
443
- __wbg_done_57b39ecd9addfe81: function(arg0) {
708
+ __wbg_done_08ce71ee07e3bd17: function(arg0) {
444
709
  const ret = arg0.done;
445
710
  return ret;
446
711
  },
447
- __wbg_get_9b94d73e6221f75c: function(arg0, arg1) {
448
- const ret = arg0[arg1 >>> 0];
712
+ __wbg_entries_e8a20ff8c9757101: function(arg0) {
713
+ const ret = Object.entries(arg0);
449
714
  return ret;
450
715
  },
451
- __wbg_get_b3ed3ad4be2bc8ac: function() { return handleError(function (arg0, arg1) {
716
+ __wbg_from_4bdf88943703fd48: function(arg0) {
717
+ const ret = Array.from(arg0);
718
+ return ret;
719
+ },
720
+ __wbg_get_326e41e095fb2575: function() { return handleError(function (arg0, arg1) {
721
+ const ret = Reflect.get(arg0, arg1);
722
+ return ret;
723
+ }, arguments); },
724
+ __wbg_get_3ef1eba1850ade27: function() { return handleError(function (arg0, arg1) {
452
725
  const ret = Reflect.get(arg0, arg1);
453
726
  return ret;
454
727
  }, arguments); },
455
- __wbg_get_with_ref_key_1dc361bd10053bfe: function(arg0, arg1) {
728
+ __wbg_get_a8ee5c45dabc1b3b: function(arg0, arg1) {
729
+ const ret = arg0[arg1 >>> 0];
730
+ return ret;
731
+ },
732
+ __wbg_get_unchecked_329cfe50afab7352: function(arg0, arg1) {
733
+ const ret = arg0[arg1 >>> 0];
734
+ return ret;
735
+ },
736
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
456
737
  const ret = arg0[arg1];
457
738
  return ret;
458
739
  },
459
- __wbg_instanceof_ArrayBuffer_c367199e2fa2aa04: function(arg0) {
740
+ __wbg_instanceof_ArrayBuffer_101e2bf31071a9f6: function(arg0) {
460
741
  let result;
461
742
  try {
462
743
  result = arg0 instanceof ArrayBuffer;
@@ -466,7 +747,7 @@ function __wbg_get_imports() {
466
747
  const ret = result;
467
748
  return ret;
468
749
  },
469
- __wbg_instanceof_Uint8Array_9b9075935c74707c: function(arg0) {
750
+ __wbg_instanceof_Uint8Array_740438561a5b956d: function(arg0) {
470
751
  let result;
471
752
  try {
472
753
  result = arg0 instanceof Uint8Array;
@@ -476,51 +757,51 @@ function __wbg_get_imports() {
476
757
  const ret = result;
477
758
  return ret;
478
759
  },
479
- __wbg_isArray_d314bb98fcf08331: function(arg0) {
760
+ __wbg_isArray_33b91feb269ff46e: function(arg0) {
480
761
  const ret = Array.isArray(arg0);
481
762
  return ret;
482
763
  },
483
- __wbg_isSafeInteger_bfbc7332a9768d2a: function(arg0) {
764
+ __wbg_isSafeInteger_ecd6a7f9c3e053cd: function(arg0) {
484
765
  const ret = Number.isSafeInteger(arg0);
485
766
  return ret;
486
767
  },
487
- __wbg_iterator_6ff6560ca1568e55: function() {
768
+ __wbg_iterator_d8f549ec8fb061b1: function() {
488
769
  const ret = Symbol.iterator;
489
770
  return ret;
490
771
  },
491
- __wbg_length_32ed9a279acd054c: function(arg0) {
772
+ __wbg_length_b3416cf66a5452c8: function(arg0) {
492
773
  const ret = arg0.length;
493
774
  return ret;
494
775
  },
495
- __wbg_length_35a7bace40f36eac: function(arg0) {
776
+ __wbg_length_ea16607d7b61445b: function(arg0) {
496
777
  const ret = arg0.length;
497
778
  return ret;
498
779
  },
499
- __wbg_new_dd2b680c8bf6ae29: function(arg0) {
780
+ __wbg_new_5f486cdf45a04d78: function(arg0) {
500
781
  const ret = new Uint8Array(arg0);
501
782
  return ret;
502
783
  },
503
- __wbg_next_3482f54c49e8af19: function() { return handleError(function (arg0) {
784
+ __wbg_next_11b99ee6237339e3: function() { return handleError(function (arg0) {
504
785
  const ret = arg0.next();
505
786
  return ret;
506
787
  }, arguments); },
507
- __wbg_next_418f80d8f5303233: function(arg0) {
788
+ __wbg_next_e01a967809d1aa68: function(arg0) {
508
789
  const ret = arg0.next;
509
790
  return ret;
510
791
  },
511
- __wbg_parse_708461a1feddfb38: function() { return handleError(function (arg0, arg1) {
792
+ __wbg_parse_e9eddd2a82c706eb: function() { return handleError(function (arg0, arg1) {
512
793
  const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
513
794
  return ret;
514
795
  }, arguments); },
515
- __wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
796
+ __wbg_prototypesetcall_d62e5099504357e6: function(arg0, arg1, arg2) {
516
797
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
517
798
  },
518
- __wbg_value_0546255b415e96c1: function(arg0) {
799
+ __wbg_value_21fc78aab0322612: function(arg0) {
519
800
  const ret = arg0.value;
520
801
  return ret;
521
802
  },
522
- __wbg_veritaszone_new: function(arg0) {
523
- const ret = VeritasZone.__wrap(arg0);
803
+ __wbg_zone_new: function(arg0) {
804
+ const ret = Zone.__wrap(arg0);
524
805
  return ret;
525
806
  },
526
807
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
@@ -544,18 +825,30 @@ function __wbg_get_imports() {
544
825
  };
545
826
  }
546
827
 
828
+ const MessageFinalization = (typeof FinalizationRegistry === 'undefined')
829
+ ? { register: () => {}, unregister: () => {} }
830
+ : new FinalizationRegistry(ptr => wasm.__wbg_message_free(ptr >>> 0, 1));
831
+ const MessageBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
832
+ ? { register: () => {}, unregister: () => {} }
833
+ : new FinalizationRegistry(ptr => wasm.__wbg_messagebuilder_free(ptr >>> 0, 1));
834
+ const OffchainDataFinalization = (typeof FinalizationRegistry === 'undefined')
835
+ ? { register: () => {}, unregister: () => {} }
836
+ : new FinalizationRegistry(ptr => wasm.__wbg_offchaindata_free(ptr >>> 0, 1));
547
837
  const QueryContextFinalization = (typeof FinalizationRegistry === 'undefined')
548
838
  ? { register: () => {}, unregister: () => {} }
549
839
  : new FinalizationRegistry(ptr => wasm.__wbg_querycontext_free(ptr >>> 0, 1));
840
+ const RecordSetFinalization = (typeof FinalizationRegistry === 'undefined')
841
+ ? { register: () => {}, unregister: () => {} }
842
+ : new FinalizationRegistry(ptr => wasm.__wbg_recordset_free(ptr >>> 0, 1));
550
843
  const VerifiedMessageFinalization = (typeof FinalizationRegistry === 'undefined')
551
844
  ? { register: () => {}, unregister: () => {} }
552
845
  : new FinalizationRegistry(ptr => wasm.__wbg_verifiedmessage_free(ptr >>> 0, 1));
553
846
  const VeritasFinalization = (typeof FinalizationRegistry === 'undefined')
554
847
  ? { register: () => {}, unregister: () => {} }
555
848
  : new FinalizationRegistry(ptr => wasm.__wbg_veritas_free(ptr >>> 0, 1));
556
- const VeritasZoneFinalization = (typeof FinalizationRegistry === 'undefined')
849
+ const ZoneFinalization = (typeof FinalizationRegistry === 'undefined')
557
850
  ? { register: () => {}, unregister: () => {} }
558
- : new FinalizationRegistry(ptr => wasm.__wbg_veritaszone_free(ptr >>> 0, 1));
851
+ : new FinalizationRegistry(ptr => wasm.__wbg_zone_free(ptr >>> 0, 1));
559
852
 
560
853
  function addToExternrefTable0(obj) {
561
854
  const idx = wasm.__externref_table_alloc();
@@ -758,5 +1051,5 @@ let WASM_VECTOR_LEN = 0;
758
1051
  const wasmPath = `${__dirname}/libveritas_bg.wasm`;
759
1052
  const wasmBytes = require('fs').readFileSync(wasmPath);
760
1053
  const wasmModule = new WebAssembly.Module(wasmBytes);
761
- const wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
1054
+ let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
762
1055
  wasm.__wbindgen_start();
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spacesprotocol/libveritas",
3
- "version": "0.0.0-dev.20260225143024",
3
+ "version": "0.0.0-dev.20260306131110",
4
4
  "files": [
5
5
  "libveritas_bg.wasm",
6
6
  "libveritas.js",