@spacesprotocol/libveritas 0.0.0-dev.20260318234945 → 0.0.0-dev.20260320120512
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 +22 -7
- package/libveritas.js +60 -14
- package/libveritas_bg.wasm +0 -0
- package/package.json +1 -1
package/libveritas.d.ts
CHANGED
|
@@ -44,6 +44,22 @@ export class Message {
|
|
|
44
44
|
export class MessageBuilder {
|
|
45
45
|
free(): void;
|
|
46
46
|
[Symbol.dispose](): void;
|
|
47
|
+
/**
|
|
48
|
+
* Add a single certificate.
|
|
49
|
+
*/
|
|
50
|
+
addCert(cert_bytes: Uint8Array): void;
|
|
51
|
+
/**
|
|
52
|
+
* Add all certificates from a .spacecert chain.
|
|
53
|
+
*/
|
|
54
|
+
addChain(chain_bytes: Uint8Array): void;
|
|
55
|
+
/**
|
|
56
|
+
* Add records for a handle.
|
|
57
|
+
*/
|
|
58
|
+
addRecords(handle: string, records_bytes: Uint8Array): void;
|
|
59
|
+
/**
|
|
60
|
+
* Add a full data update (records + optional delegate records).
|
|
61
|
+
*/
|
|
62
|
+
addUpdate(entry: any): void;
|
|
47
63
|
/**
|
|
48
64
|
* Build the message from a borsh-encoded ChainProof.
|
|
49
65
|
*
|
|
@@ -57,16 +73,15 @@ export class MessageBuilder {
|
|
|
57
73
|
*/
|
|
58
74
|
chain_proof_request(): any;
|
|
59
75
|
/**
|
|
60
|
-
* Create
|
|
76
|
+
* Create an empty builder.
|
|
61
77
|
*
|
|
62
78
|
* ```js
|
|
63
|
-
* let builder = new MessageBuilder(
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* ])
|
|
79
|
+
* let builder = new MessageBuilder()
|
|
80
|
+
* builder.addChain(chainBytes)
|
|
81
|
+
* builder.addRecords("alice@bitcoin", recordsBytes)
|
|
67
82
|
* ```
|
|
68
83
|
*/
|
|
69
|
-
constructor(
|
|
84
|
+
constructor();
|
|
70
85
|
}
|
|
71
86
|
|
|
72
87
|
/**
|
|
@@ -206,7 +221,7 @@ export class Veritas {
|
|
|
206
221
|
* Verify a message against a query context.
|
|
207
222
|
*/
|
|
208
223
|
verify_message(ctx: QueryContext, msg: Message): VerifiedMessage;
|
|
209
|
-
static
|
|
224
|
+
static withOptions(anchors: Anchors, expand_names: boolean, dev_mode: boolean): Veritas;
|
|
210
225
|
}
|
|
211
226
|
|
|
212
227
|
/**
|
package/libveritas.js
CHANGED
|
@@ -122,6 +122,55 @@ class MessageBuilder {
|
|
|
122
122
|
const ptr = this.__destroy_into_raw();
|
|
123
123
|
wasm.__wbg_messagebuilder_free(ptr, 0);
|
|
124
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* Add a single certificate.
|
|
127
|
+
* @param {Uint8Array} cert_bytes
|
|
128
|
+
*/
|
|
129
|
+
addCert(cert_bytes) {
|
|
130
|
+
const ptr0 = passArray8ToWasm0(cert_bytes, wasm.__wbindgen_malloc);
|
|
131
|
+
const len0 = WASM_VECTOR_LEN;
|
|
132
|
+
const ret = wasm.messagebuilder_addCert(this.__wbg_ptr, ptr0, len0);
|
|
133
|
+
if (ret[1]) {
|
|
134
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Add all certificates from a .spacecert chain.
|
|
139
|
+
* @param {Uint8Array} chain_bytes
|
|
140
|
+
*/
|
|
141
|
+
addChain(chain_bytes) {
|
|
142
|
+
const ptr0 = passArray8ToWasm0(chain_bytes, wasm.__wbindgen_malloc);
|
|
143
|
+
const len0 = WASM_VECTOR_LEN;
|
|
144
|
+
const ret = wasm.messagebuilder_addChain(this.__wbg_ptr, ptr0, len0);
|
|
145
|
+
if (ret[1]) {
|
|
146
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Add records for a handle.
|
|
151
|
+
* @param {string} handle
|
|
152
|
+
* @param {Uint8Array} records_bytes
|
|
153
|
+
*/
|
|
154
|
+
addRecords(handle, records_bytes) {
|
|
155
|
+
const ptr0 = passStringToWasm0(handle, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
156
|
+
const len0 = WASM_VECTOR_LEN;
|
|
157
|
+
const ptr1 = passArray8ToWasm0(records_bytes, wasm.__wbindgen_malloc);
|
|
158
|
+
const len1 = WASM_VECTOR_LEN;
|
|
159
|
+
const ret = wasm.messagebuilder_addRecords(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
160
|
+
if (ret[1]) {
|
|
161
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Add a full data update (records + optional delegate records).
|
|
166
|
+
* @param {any} entry
|
|
167
|
+
*/
|
|
168
|
+
addUpdate(entry) {
|
|
169
|
+
const ret = wasm.messagebuilder_addUpdate(this.__wbg_ptr, entry);
|
|
170
|
+
if (ret[1]) {
|
|
171
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
125
174
|
/**
|
|
126
175
|
* Build the message from a borsh-encoded ChainProof.
|
|
127
176
|
*
|
|
@@ -152,22 +201,17 @@ class MessageBuilder {
|
|
|
152
201
|
return takeFromExternrefTable0(ret[0]);
|
|
153
202
|
}
|
|
154
203
|
/**
|
|
155
|
-
* Create
|
|
204
|
+
* Create an empty builder.
|
|
156
205
|
*
|
|
157
206
|
* ```js
|
|
158
|
-
* let builder = new MessageBuilder(
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
* ])
|
|
207
|
+
* let builder = new MessageBuilder()
|
|
208
|
+
* builder.addChain(chainBytes)
|
|
209
|
+
* builder.addRecords("alice@bitcoin", recordsBytes)
|
|
162
210
|
* ```
|
|
163
|
-
* @param {any} requests
|
|
164
211
|
*/
|
|
165
|
-
constructor(
|
|
166
|
-
const ret = wasm.messagebuilder_new(
|
|
167
|
-
|
|
168
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
169
|
-
}
|
|
170
|
-
this.__wbg_ptr = ret[0] >>> 0;
|
|
212
|
+
constructor() {
|
|
213
|
+
const ret = wasm.messagebuilder_new();
|
|
214
|
+
this.__wbg_ptr = ret >>> 0;
|
|
171
215
|
MessageBuilderFinalization.register(this, this.__wbg_ptr, this);
|
|
172
216
|
return this;
|
|
173
217
|
}
|
|
@@ -606,11 +650,13 @@ class Veritas {
|
|
|
606
650
|
}
|
|
607
651
|
/**
|
|
608
652
|
* @param {Anchors} anchors
|
|
653
|
+
* @param {boolean} expand_names
|
|
654
|
+
* @param {boolean} dev_mode
|
|
609
655
|
* @returns {Veritas}
|
|
610
656
|
*/
|
|
611
|
-
static
|
|
657
|
+
static withOptions(anchors, expand_names, dev_mode) {
|
|
612
658
|
_assertClass(anchors, Anchors);
|
|
613
|
-
const ret = wasm.
|
|
659
|
+
const ret = wasm.veritas_withOptions(anchors.__wbg_ptr, expand_names, dev_mode);
|
|
614
660
|
if (ret[2]) {
|
|
615
661
|
throw takeFromExternrefTable0(ret[1]);
|
|
616
662
|
}
|
package/libveritas_bg.wasm
CHANGED
|
Binary file
|