@spacesprotocol/libveritas 0.0.0-dev.20260225100845 → 0.0.0-dev.20260306102312

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, false);
20
+
21
+ console.log(`Anchors: ${veritas.oldest_anchor()} .. ${veritas.newest_anchor()}`);
22
+
23
+ // Build query context (empty = verify all handles)
24
+ const ctx = new QueryContext();
25
+ ctx.add_request("alice@bitcoin");
26
+
27
+ // Verify a message (binary data from relay)
28
+ const result = veritas.verify_message(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.to_bytes();
36
+ }
37
+
38
+ // Compare zones
39
+ const better = newerZone.is_better_than(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", offchain_data: offchainBytes, cert: leafCertBytes },
61
+ ]);
62
+
63
+ // Get the chain proof request to send to a provider
64
+ let request = builder.chain_proof_request();
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.to_bytes();
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", offchain_data: offchainBytes },
86
+ ]);
87
+
88
+ let updatedBytes = msg.to_bytes();
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,10 +130,18 @@ 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 {
@@ -52,13 +158,13 @@ export class Veritas {
52
158
  verify_message(ctx: QueryContext, msg: Uint8Array): VerifiedMessage;
53
159
  }
54
160
 
55
- export class VeritasZone {
161
+ export class Zone {
56
162
  private constructor();
57
163
  free(): void;
58
164
  [Symbol.dispose](): void;
59
165
  anchor(): number;
60
166
  handle(): string;
61
- is_better_than(other: VeritasZone): boolean;
167
+ is_better_than(other: Zone): boolean;
62
168
  sovereignty(): string;
63
169
  to_bytes(): Uint8Array;
64
170
  /**
@@ -73,9 +179,9 @@ export class VeritasZone {
73
179
  export function decode_certificate(bytes: Uint8Array): any;
74
180
 
75
181
  /**
76
- * Decode stored zone bytes to a VeritasZone object.
182
+ * Decode stored zone bytes to a Zone object.
77
183
  */
78
- export function decode_zone(bytes: Uint8Array): VeritasZone;
184
+ export function decode_zone(bytes: Uint8Array): Zone;
79
185
 
80
186
  /**
81
187
  * 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);
@@ -189,29 +433,29 @@ class Veritas {
189
433
  if (Symbol.dispose) Veritas.prototype[Symbol.dispose] = Veritas.prototype.free;
190
434
  exports.Veritas = Veritas;
191
435
 
192
- class VeritasZone {
436
+ class Zone {
193
437
  static __wrap(ptr) {
194
438
  ptr = ptr >>> 0;
195
- const obj = Object.create(VeritasZone.prototype);
439
+ const obj = Object.create(Zone.prototype);
196
440
  obj.__wbg_ptr = ptr;
197
- VeritasZoneFinalization.register(obj, obj.__wbg_ptr, obj);
441
+ ZoneFinalization.register(obj, obj.__wbg_ptr, obj);
198
442
  return obj;
199
443
  }
200
444
  __destroy_into_raw() {
201
445
  const ptr = this.__wbg_ptr;
202
446
  this.__wbg_ptr = 0;
203
- VeritasZoneFinalization.unregister(this);
447
+ ZoneFinalization.unregister(this);
204
448
  return ptr;
205
449
  }
206
450
  free() {
207
451
  const ptr = this.__destroy_into_raw();
208
- wasm.__wbg_veritaszone_free(ptr, 0);
452
+ wasm.__wbg_zone_free(ptr, 0);
209
453
  }
210
454
  /**
211
455
  * @returns {number}
212
456
  */
213
457
  anchor() {
214
- const ret = wasm.veritaszone_anchor(this.__wbg_ptr);
458
+ const ret = wasm.zone_anchor(this.__wbg_ptr);
215
459
  return ret >>> 0;
216
460
  }
217
461
  /**
@@ -221,7 +465,7 @@ class VeritasZone {
221
465
  let deferred1_0;
222
466
  let deferred1_1;
223
467
  try {
224
- const ret = wasm.veritaszone_handle(this.__wbg_ptr);
468
+ const ret = wasm.zone_handle(this.__wbg_ptr);
225
469
  deferred1_0 = ret[0];
226
470
  deferred1_1 = ret[1];
227
471
  return getStringFromWasm0(ret[0], ret[1]);
@@ -230,12 +474,12 @@ class VeritasZone {
230
474
  }
231
475
  }
232
476
  /**
233
- * @param {VeritasZone} other
477
+ * @param {Zone} other
234
478
  * @returns {boolean}
235
479
  */
236
480
  is_better_than(other) {
237
- _assertClass(other, VeritasZone);
238
- const ret = wasm.veritaszone_is_better_than(this.__wbg_ptr, other.__wbg_ptr);
481
+ _assertClass(other, Zone);
482
+ const ret = wasm.zone_is_better_than(this.__wbg_ptr, other.__wbg_ptr);
239
483
  if (ret[2]) {
240
484
  throw takeFromExternrefTable0(ret[1]);
241
485
  }
@@ -248,7 +492,7 @@ class VeritasZone {
248
492
  let deferred1_0;
249
493
  let deferred1_1;
250
494
  try {
251
- const ret = wasm.veritaszone_sovereignty(this.__wbg_ptr);
495
+ const ret = wasm.zone_sovereignty(this.__wbg_ptr);
252
496
  deferred1_0 = ret[0];
253
497
  deferred1_1 = ret[1];
254
498
  return getStringFromWasm0(ret[0], ret[1]);
@@ -260,7 +504,7 @@ class VeritasZone {
260
504
  * @returns {Uint8Array}
261
505
  */
262
506
  to_bytes() {
263
- const ret = wasm.veritaszone_to_bytes(this.__wbg_ptr);
507
+ const ret = wasm.zone_to_bytes(this.__wbg_ptr);
264
508
  var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
265
509
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
266
510
  return v1;
@@ -270,15 +514,15 @@ class VeritasZone {
270
514
  * @returns {any}
271
515
  */
272
516
  to_json() {
273
- const ret = wasm.veritaszone_to_json(this.__wbg_ptr);
517
+ const ret = wasm.zone_to_json(this.__wbg_ptr);
274
518
  if (ret[2]) {
275
519
  throw takeFromExternrefTable0(ret[1]);
276
520
  }
277
521
  return takeFromExternrefTable0(ret[0]);
278
522
  }
279
523
  }
280
- if (Symbol.dispose) VeritasZone.prototype[Symbol.dispose] = VeritasZone.prototype.free;
281
- exports.VeritasZone = VeritasZone;
524
+ if (Symbol.dispose) Zone.prototype[Symbol.dispose] = Zone.prototype.free;
525
+ exports.Zone = Zone;
282
526
 
283
527
  /**
284
528
  * Decode stored certificate bytes to a JS object.
@@ -297,9 +541,9 @@ function decode_certificate(bytes) {
297
541
  exports.decode_certificate = decode_certificate;
298
542
 
299
543
  /**
300
- * Decode stored zone bytes to a VeritasZone object.
544
+ * Decode stored zone bytes to a Zone object.
301
545
  * @param {Uint8Array} bytes
302
- * @returns {VeritasZone}
546
+ * @returns {Zone}
303
547
  */
304
548
  function decode_zone(bytes) {
305
549
  const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
@@ -308,7 +552,7 @@ function decode_zone(bytes) {
308
552
  if (ret[2]) {
309
553
  throw takeFromExternrefTable0(ret[1]);
310
554
  }
311
- return VeritasZone.__wrap(ret[0]);
555
+ return Zone.__wrap(ret[0]);
312
556
  }
313
557
  exports.decode_zone = decode_zone;
314
558
 
@@ -371,61 +615,65 @@ exports.verify_spaces_message = verify_spaces_message;
371
615
  function __wbg_get_imports() {
372
616
  const import0 = {
373
617
  __proto__: null,
374
- __wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
618
+ __wbg_Error_83742b46f01ce22d: function(arg0, arg1) {
375
619
  const ret = Error(getStringFromWasm0(arg0, arg1));
376
620
  return ret;
377
621
  },
378
- __wbg_Number_04624de7d0e8332d: function(arg0) {
622
+ __wbg_Number_a5a435bd7bbec835: function(arg0) {
379
623
  const ret = Number(arg0);
380
624
  return ret;
381
625
  },
382
- __wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) {
626
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
383
627
  const ret = String(arg1);
384
628
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
385
629
  const len1 = WASM_VECTOR_LEN;
386
630
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
387
631
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
388
632
  },
389
- __wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25: function(arg0) {
633
+ __wbg___wbindgen_boolean_get_c0f3f60bac5a78d1: function(arg0) {
390
634
  const v = arg0;
391
635
  const ret = typeof(v) === 'boolean' ? v : undefined;
392
636
  return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
393
637
  },
394
- __wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {
638
+ __wbg___wbindgen_debug_string_5398f5bb970e0daa: function(arg0, arg1) {
395
639
  const ret = debugString(arg1);
396
640
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
397
641
  const len1 = WASM_VECTOR_LEN;
398
642
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
399
643
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
400
644
  },
401
- __wbg___wbindgen_in_47fa6863be6f2f25: function(arg0, arg1) {
645
+ __wbg___wbindgen_in_41dbb8413020e076: function(arg0, arg1) {
402
646
  const ret = arg0 in arg1;
403
647
  return ret;
404
648
  },
405
- __wbg___wbindgen_is_function_0095a73b8b156f76: function(arg0) {
649
+ __wbg___wbindgen_is_function_3c846841762788c1: function(arg0) {
406
650
  const ret = typeof(arg0) === 'function';
407
651
  return ret;
408
652
  },
409
- __wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {
653
+ __wbg___wbindgen_is_null_0b605fc6b167c56f: function(arg0) {
654
+ const ret = arg0 === null;
655
+ return ret;
656
+ },
657
+ __wbg___wbindgen_is_object_781bc9f159099513: function(arg0) {
410
658
  const val = arg0;
411
659
  const ret = typeof(val) === 'object' && val !== null;
412
660
  return ret;
413
661
  },
414
- __wbg___wbindgen_is_undefined_9e4d92534c42d778: function(arg0) {
662
+ __wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
415
663
  const ret = arg0 === undefined;
416
664
  return ret;
417
665
  },
418
- __wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811: function(arg0, arg1) {
666
+ __wbg___wbindgen_jsval_loose_eq_5bcc3bed3c69e72b: function(arg0, arg1) {
419
667
  const ret = arg0 == arg1;
420
668
  return ret;
421
669
  },
422
- __wbg___wbindgen_number_get_8ff4255516ccad3e: function(arg0, arg1) {
670
+ __wbg___wbindgen_number_get_34bb9d9dcfa21373: function(arg0, arg1) {
423
671
  const obj = arg1;
424
672
  const ret = typeof(obj) === 'number' ? obj : undefined;
425
673
  getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
426
674
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
427
675
  },
428
- __wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {
676
+ __wbg___wbindgen_string_get_395e606bd0ee4427: function(arg0, arg1) {
429
677
  const obj = arg1;
430
678
  const ret = typeof(obj) === 'string' ? obj : undefined;
431
679
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -433,30 +681,46 @@ function __wbg_get_imports() {
433
681
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
434
682
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
435
683
  },
436
- __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
684
+ __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
437
685
  throw new Error(getStringFromWasm0(arg0, arg1));
438
686
  },
439
- __wbg_call_389efe28435a9388: function() { return handleError(function (arg0, arg1) {
687
+ __wbg_call_e133b57c9155d22c: function() { return handleError(function (arg0, arg1) {
440
688
  const ret = arg0.call(arg1);
441
689
  return ret;
442
690
  }, arguments); },
443
- __wbg_done_57b39ecd9addfe81: function(arg0) {
691
+ __wbg_done_08ce71ee07e3bd17: function(arg0) {
444
692
  const ret = arg0.done;
445
693
  return ret;
446
694
  },
447
- __wbg_get_9b94d73e6221f75c: function(arg0, arg1) {
448
- const ret = arg0[arg1 >>> 0];
695
+ __wbg_entries_e8a20ff8c9757101: function(arg0) {
696
+ const ret = Object.entries(arg0);
697
+ return ret;
698
+ },
699
+ __wbg_from_4bdf88943703fd48: function(arg0) {
700
+ const ret = Array.from(arg0);
449
701
  return ret;
450
702
  },
451
- __wbg_get_b3ed3ad4be2bc8ac: function() { return handleError(function (arg0, arg1) {
703
+ __wbg_get_326e41e095fb2575: function() { return handleError(function (arg0, arg1) {
452
704
  const ret = Reflect.get(arg0, arg1);
453
705
  return ret;
454
706
  }, arguments); },
455
- __wbg_get_with_ref_key_1dc361bd10053bfe: function(arg0, arg1) {
707
+ __wbg_get_3ef1eba1850ade27: function() { return handleError(function (arg0, arg1) {
708
+ const ret = Reflect.get(arg0, arg1);
709
+ return ret;
710
+ }, arguments); },
711
+ __wbg_get_a8ee5c45dabc1b3b: function(arg0, arg1) {
712
+ const ret = arg0[arg1 >>> 0];
713
+ return ret;
714
+ },
715
+ __wbg_get_unchecked_329cfe50afab7352: function(arg0, arg1) {
716
+ const ret = arg0[arg1 >>> 0];
717
+ return ret;
718
+ },
719
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
456
720
  const ret = arg0[arg1];
457
721
  return ret;
458
722
  },
459
- __wbg_instanceof_ArrayBuffer_c367199e2fa2aa04: function(arg0) {
723
+ __wbg_instanceof_ArrayBuffer_101e2bf31071a9f6: function(arg0) {
460
724
  let result;
461
725
  try {
462
726
  result = arg0 instanceof ArrayBuffer;
@@ -466,7 +730,7 @@ function __wbg_get_imports() {
466
730
  const ret = result;
467
731
  return ret;
468
732
  },
469
- __wbg_instanceof_Uint8Array_9b9075935c74707c: function(arg0) {
733
+ __wbg_instanceof_Uint8Array_740438561a5b956d: function(arg0) {
470
734
  let result;
471
735
  try {
472
736
  result = arg0 instanceof Uint8Array;
@@ -476,51 +740,51 @@ function __wbg_get_imports() {
476
740
  const ret = result;
477
741
  return ret;
478
742
  },
479
- __wbg_isArray_d314bb98fcf08331: function(arg0) {
743
+ __wbg_isArray_33b91feb269ff46e: function(arg0) {
480
744
  const ret = Array.isArray(arg0);
481
745
  return ret;
482
746
  },
483
- __wbg_isSafeInteger_bfbc7332a9768d2a: function(arg0) {
747
+ __wbg_isSafeInteger_ecd6a7f9c3e053cd: function(arg0) {
484
748
  const ret = Number.isSafeInteger(arg0);
485
749
  return ret;
486
750
  },
487
- __wbg_iterator_6ff6560ca1568e55: function() {
751
+ __wbg_iterator_d8f549ec8fb061b1: function() {
488
752
  const ret = Symbol.iterator;
489
753
  return ret;
490
754
  },
491
- __wbg_length_32ed9a279acd054c: function(arg0) {
755
+ __wbg_length_b3416cf66a5452c8: function(arg0) {
492
756
  const ret = arg0.length;
493
757
  return ret;
494
758
  },
495
- __wbg_length_35a7bace40f36eac: function(arg0) {
759
+ __wbg_length_ea16607d7b61445b: function(arg0) {
496
760
  const ret = arg0.length;
497
761
  return ret;
498
762
  },
499
- __wbg_new_dd2b680c8bf6ae29: function(arg0) {
763
+ __wbg_new_5f486cdf45a04d78: function(arg0) {
500
764
  const ret = new Uint8Array(arg0);
501
765
  return ret;
502
766
  },
503
- __wbg_next_3482f54c49e8af19: function() { return handleError(function (arg0) {
767
+ __wbg_next_11b99ee6237339e3: function() { return handleError(function (arg0) {
504
768
  const ret = arg0.next();
505
769
  return ret;
506
770
  }, arguments); },
507
- __wbg_next_418f80d8f5303233: function(arg0) {
771
+ __wbg_next_e01a967809d1aa68: function(arg0) {
508
772
  const ret = arg0.next;
509
773
  return ret;
510
774
  },
511
- __wbg_parse_708461a1feddfb38: function() { return handleError(function (arg0, arg1) {
775
+ __wbg_parse_e9eddd2a82c706eb: function() { return handleError(function (arg0, arg1) {
512
776
  const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
513
777
  return ret;
514
778
  }, arguments); },
515
- __wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
779
+ __wbg_prototypesetcall_d62e5099504357e6: function(arg0, arg1, arg2) {
516
780
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
517
781
  },
518
- __wbg_value_0546255b415e96c1: function(arg0) {
782
+ __wbg_value_21fc78aab0322612: function(arg0) {
519
783
  const ret = arg0.value;
520
784
  return ret;
521
785
  },
522
- __wbg_veritaszone_new: function(arg0) {
523
- const ret = VeritasZone.__wrap(arg0);
786
+ __wbg_zone_new: function(arg0) {
787
+ const ret = Zone.__wrap(arg0);
524
788
  return ret;
525
789
  },
526
790
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
@@ -544,18 +808,30 @@ function __wbg_get_imports() {
544
808
  };
545
809
  }
546
810
 
811
+ const MessageFinalization = (typeof FinalizationRegistry === 'undefined')
812
+ ? { register: () => {}, unregister: () => {} }
813
+ : new FinalizationRegistry(ptr => wasm.__wbg_message_free(ptr >>> 0, 1));
814
+ const MessageBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
815
+ ? { register: () => {}, unregister: () => {} }
816
+ : new FinalizationRegistry(ptr => wasm.__wbg_messagebuilder_free(ptr >>> 0, 1));
817
+ const OffchainDataFinalization = (typeof FinalizationRegistry === 'undefined')
818
+ ? { register: () => {}, unregister: () => {} }
819
+ : new FinalizationRegistry(ptr => wasm.__wbg_offchaindata_free(ptr >>> 0, 1));
547
820
  const QueryContextFinalization = (typeof FinalizationRegistry === 'undefined')
548
821
  ? { register: () => {}, unregister: () => {} }
549
822
  : new FinalizationRegistry(ptr => wasm.__wbg_querycontext_free(ptr >>> 0, 1));
823
+ const RecordSetFinalization = (typeof FinalizationRegistry === 'undefined')
824
+ ? { register: () => {}, unregister: () => {} }
825
+ : new FinalizationRegistry(ptr => wasm.__wbg_recordset_free(ptr >>> 0, 1));
550
826
  const VerifiedMessageFinalization = (typeof FinalizationRegistry === 'undefined')
551
827
  ? { register: () => {}, unregister: () => {} }
552
828
  : new FinalizationRegistry(ptr => wasm.__wbg_verifiedmessage_free(ptr >>> 0, 1));
553
829
  const VeritasFinalization = (typeof FinalizationRegistry === 'undefined')
554
830
  ? { register: () => {}, unregister: () => {} }
555
831
  : new FinalizationRegistry(ptr => wasm.__wbg_veritas_free(ptr >>> 0, 1));
556
- const VeritasZoneFinalization = (typeof FinalizationRegistry === 'undefined')
832
+ const ZoneFinalization = (typeof FinalizationRegistry === 'undefined')
557
833
  ? { register: () => {}, unregister: () => {} }
558
- : new FinalizationRegistry(ptr => wasm.__wbg_veritaszone_free(ptr >>> 0, 1));
834
+ : new FinalizationRegistry(ptr => wasm.__wbg_zone_free(ptr >>> 0, 1));
559
835
 
560
836
  function addToExternrefTable0(obj) {
561
837
  const idx = wasm.__externref_table_alloc();
@@ -758,5 +1034,5 @@ let WASM_VECTOR_LEN = 0;
758
1034
  const wasmPath = `${__dirname}/libveritas_bg.wasm`;
759
1035
  const wasmBytes = require('fs').readFileSync(wasmPath);
760
1036
  const wasmModule = new WebAssembly.Module(wasmBytes);
761
- const wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
1037
+ let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
762
1038
  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.20260225100845",
3
+ "version": "0.0.0-dev.20260306102312",
4
4
  "files": [
5
5
  "libveritas_bg.wasm",
6
6
  "libveritas.js",