@spacesprotocol/libveritas 0.0.0-dev.20260306131110 → 0.0.0-dev.20260306225014
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 +3 -2
- package/libveritas.d.ts +5 -5
- package/libveritas.js +7 -8
- package/libveritas_bg.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ npm install @spacesprotocol/libveritas
|
|
|
13
13
|
### Verifying a message
|
|
14
14
|
|
|
15
15
|
```javascript
|
|
16
|
-
import { Veritas, QueryContext } from "@spacesprotocol/libveritas";
|
|
16
|
+
import { Veritas, QueryContext, Message } from "@spacesprotocol/libveritas";
|
|
17
17
|
|
|
18
18
|
// Load trust anchors
|
|
19
19
|
const veritas = new Veritas(anchors);
|
|
@@ -25,7 +25,8 @@ const ctx = new QueryContext();
|
|
|
25
25
|
ctx.addRequest("alice@bitcoin");
|
|
26
26
|
|
|
27
27
|
// Verify a message (binary data from relay)
|
|
28
|
-
const
|
|
28
|
+
const msg = new Message(messageBytes);
|
|
29
|
+
const result = veritas.verifyMessage(ctx, msg);
|
|
29
30
|
|
|
30
31
|
// Inspect verified zones
|
|
31
32
|
for (const zone of result.zones()) {
|
package/libveritas.d.ts
CHANGED
|
@@ -21,8 +21,8 @@ export class Message {
|
|
|
21
21
|
* Accepts a JS array of data update entries:
|
|
22
22
|
* ```js
|
|
23
23
|
* msg.update([
|
|
24
|
-
* { name: "alice@bitcoin",
|
|
25
|
-
* { name: "@bitcoin",
|
|
24
|
+
* { name: "alice@bitcoin", offchainData: Uint8Array },
|
|
25
|
+
* { name: "@bitcoin", delegateOffchainData: Uint8Array }
|
|
26
26
|
* ])
|
|
27
27
|
* ```
|
|
28
28
|
*
|
|
@@ -54,8 +54,8 @@ export class MessageBuilder {
|
|
|
54
54
|
*
|
|
55
55
|
* ```js
|
|
56
56
|
* let builder = new MessageBuilder([
|
|
57
|
-
* { name: "@bitcoin",
|
|
58
|
-
* { name: "alice@bitcoin",
|
|
57
|
+
* { name: "@bitcoin", offchainData: Uint8Array, cert: Uint8Array },
|
|
58
|
+
* { name: "alice@bitcoin", offchainData: Uint8Array, cert: Uint8Array }
|
|
59
59
|
* ])
|
|
60
60
|
* ```
|
|
61
61
|
*/
|
|
@@ -155,7 +155,7 @@ export class Veritas {
|
|
|
155
155
|
/**
|
|
156
156
|
* Verify a message against a query context.
|
|
157
157
|
*/
|
|
158
|
-
verify_message(ctx: QueryContext, msg:
|
|
158
|
+
verify_message(ctx: QueryContext, msg: Message): VerifiedMessage;
|
|
159
159
|
static withDevMode(anchors: any): Veritas;
|
|
160
160
|
}
|
|
161
161
|
|
package/libveritas.js
CHANGED
|
@@ -52,8 +52,8 @@ class Message {
|
|
|
52
52
|
* Accepts a JS array of data update entries:
|
|
53
53
|
* ```js
|
|
54
54
|
* msg.update([
|
|
55
|
-
* { name: "alice@bitcoin",
|
|
56
|
-
* { name: "@bitcoin",
|
|
55
|
+
* { name: "alice@bitcoin", offchainData: Uint8Array },
|
|
56
|
+
* { name: "@bitcoin", delegateOffchainData: Uint8Array }
|
|
57
57
|
* ])
|
|
58
58
|
* ```
|
|
59
59
|
*
|
|
@@ -118,8 +118,8 @@ class MessageBuilder {
|
|
|
118
118
|
*
|
|
119
119
|
* ```js
|
|
120
120
|
* let builder = new MessageBuilder([
|
|
121
|
-
* { name: "@bitcoin",
|
|
122
|
-
* { name: "alice@bitcoin",
|
|
121
|
+
* { name: "@bitcoin", offchainData: Uint8Array, cert: Uint8Array },
|
|
122
|
+
* { name: "alice@bitcoin", offchainData: Uint8Array, cert: Uint8Array }
|
|
123
123
|
* ])
|
|
124
124
|
* ```
|
|
125
125
|
* @param {any} requests
|
|
@@ -422,14 +422,13 @@ class Veritas {
|
|
|
422
422
|
/**
|
|
423
423
|
* Verify a message against a query context.
|
|
424
424
|
* @param {QueryContext} ctx
|
|
425
|
-
* @param {
|
|
425
|
+
* @param {Message} msg
|
|
426
426
|
* @returns {VerifiedMessage}
|
|
427
427
|
*/
|
|
428
428
|
verify_message(ctx, msg) {
|
|
429
429
|
_assertClass(ctx, QueryContext);
|
|
430
|
-
|
|
431
|
-
const
|
|
432
|
-
const ret = wasm.veritas_verify_message(this.__wbg_ptr, ctx.__wbg_ptr, ptr0, len0);
|
|
430
|
+
_assertClass(msg, Message);
|
|
431
|
+
const ret = wasm.veritas_verify_message(this.__wbg_ptr, ctx.__wbg_ptr, msg.__wbg_ptr);
|
|
433
432
|
if (ret[2]) {
|
|
434
433
|
throw takeFromExternrefTable0(ret[1]);
|
|
435
434
|
}
|
package/libveritas_bg.wasm
CHANGED
|
Binary file
|