@spacesprotocol/libveritas 0.0.0-dev.20260320153157 → 0.0.0-dev.20260322225540
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 +16 -3
- package/libveritas.js +55 -6
- package/libveritas_bg.wasm +0 -0
- package/package.json +1 -1
package/libveritas.d.ts
CHANGED
|
@@ -207,6 +207,12 @@ export class RecordSet {
|
|
|
207
207
|
unpack(): any;
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
+
export function VERIFY_DEFAULT(): number;
|
|
211
|
+
|
|
212
|
+
export function VERIFY_DEV_MODE(): number;
|
|
213
|
+
|
|
214
|
+
export function VERIFY_ENABLE_SNARK(): number;
|
|
215
|
+
|
|
210
216
|
/**
|
|
211
217
|
* Result of verifying a message.
|
|
212
218
|
*/
|
|
@@ -247,15 +253,22 @@ export class Veritas {
|
|
|
247
253
|
oldest_anchor(): number;
|
|
248
254
|
sovereignty_for(commitment_height: number): string;
|
|
249
255
|
/**
|
|
250
|
-
* Verify a message with default options
|
|
256
|
+
* Verify a message with default options.
|
|
251
257
|
*/
|
|
252
258
|
verify(ctx: QueryContext, msg: Message): VerifiedMessage;
|
|
253
259
|
/**
|
|
254
|
-
* Verify a message with
|
|
260
|
+
* Verify a message with option flags (combine with bitwise OR).
|
|
255
261
|
*/
|
|
256
|
-
verifyWithOptions(ctx: QueryContext, msg: Message,
|
|
262
|
+
verifyWithOptions(ctx: QueryContext, msg: Message, options: number): VerifiedMessage;
|
|
257
263
|
}
|
|
258
264
|
|
|
265
|
+
/**
|
|
266
|
+
* Create a .spacecert file from a subject name and certificate bytes.
|
|
267
|
+
*
|
|
268
|
+
* Collects certificates from multiple verified messages into a single chain.
|
|
269
|
+
*/
|
|
270
|
+
export function createCertificateChain(subject: string, cert_bytes_list: Uint8Array[]): Uint8Array;
|
|
271
|
+
|
|
259
272
|
/**
|
|
260
273
|
* Decode stored zone bytes to a plain JS object.
|
|
261
274
|
*/
|
package/libveritas.js
CHANGED
|
@@ -560,6 +560,33 @@ class RecordSet {
|
|
|
560
560
|
if (Symbol.dispose) RecordSet.prototype[Symbol.dispose] = RecordSet.prototype.free;
|
|
561
561
|
exports.RecordSet = RecordSet;
|
|
562
562
|
|
|
563
|
+
/**
|
|
564
|
+
* @returns {number}
|
|
565
|
+
*/
|
|
566
|
+
function VERIFY_DEFAULT() {
|
|
567
|
+
const ret = wasm.VERIFY_DEFAULT();
|
|
568
|
+
return ret >>> 0;
|
|
569
|
+
}
|
|
570
|
+
exports.VERIFY_DEFAULT = VERIFY_DEFAULT;
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* @returns {number}
|
|
574
|
+
*/
|
|
575
|
+
function VERIFY_DEV_MODE() {
|
|
576
|
+
const ret = wasm.VERIFY_DEV_MODE();
|
|
577
|
+
return ret >>> 0;
|
|
578
|
+
}
|
|
579
|
+
exports.VERIFY_DEV_MODE = VERIFY_DEV_MODE;
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* @returns {number}
|
|
583
|
+
*/
|
|
584
|
+
function VERIFY_ENABLE_SNARK() {
|
|
585
|
+
const ret = wasm.VERIFY_ENABLE_SNARK();
|
|
586
|
+
return ret >>> 0;
|
|
587
|
+
}
|
|
588
|
+
exports.VERIFY_ENABLE_SNARK = VERIFY_ENABLE_SNARK;
|
|
589
|
+
|
|
563
590
|
/**
|
|
564
591
|
* Result of verifying a message.
|
|
565
592
|
*/
|
|
@@ -712,7 +739,7 @@ class Veritas {
|
|
|
712
739
|
}
|
|
713
740
|
}
|
|
714
741
|
/**
|
|
715
|
-
* Verify a message with default options
|
|
742
|
+
* Verify a message with default options.
|
|
716
743
|
* @param {QueryContext} ctx
|
|
717
744
|
* @param {Message} msg
|
|
718
745
|
* @returns {VerifiedMessage}
|
|
@@ -727,17 +754,16 @@ class Veritas {
|
|
|
727
754
|
return VerifiedMessage.__wrap(ret[0]);
|
|
728
755
|
}
|
|
729
756
|
/**
|
|
730
|
-
* Verify a message with
|
|
757
|
+
* Verify a message with option flags (combine with bitwise OR).
|
|
731
758
|
* @param {QueryContext} ctx
|
|
732
759
|
* @param {Message} msg
|
|
733
|
-
* @param {
|
|
734
|
-
* @param {boolean} dev_mode
|
|
760
|
+
* @param {number} options
|
|
735
761
|
* @returns {VerifiedMessage}
|
|
736
762
|
*/
|
|
737
|
-
verifyWithOptions(ctx, msg,
|
|
763
|
+
verifyWithOptions(ctx, msg, options) {
|
|
738
764
|
_assertClass(ctx, QueryContext);
|
|
739
765
|
_assertClass(msg, Message);
|
|
740
|
-
const ret = wasm.veritas_verifyWithOptions(this.__wbg_ptr, ctx.__wbg_ptr, msg.__wbg_ptr,
|
|
766
|
+
const ret = wasm.veritas_verifyWithOptions(this.__wbg_ptr, ctx.__wbg_ptr, msg.__wbg_ptr, options);
|
|
741
767
|
if (ret[2]) {
|
|
742
768
|
throw takeFromExternrefTable0(ret[1]);
|
|
743
769
|
}
|
|
@@ -747,6 +773,29 @@ class Veritas {
|
|
|
747
773
|
if (Symbol.dispose) Veritas.prototype[Symbol.dispose] = Veritas.prototype.free;
|
|
748
774
|
exports.Veritas = Veritas;
|
|
749
775
|
|
|
776
|
+
/**
|
|
777
|
+
* Create a .spacecert file from a subject name and certificate bytes.
|
|
778
|
+
*
|
|
779
|
+
* Collects certificates from multiple verified messages into a single chain.
|
|
780
|
+
* @param {string} subject
|
|
781
|
+
* @param {Uint8Array[]} cert_bytes_list
|
|
782
|
+
* @returns {Uint8Array}
|
|
783
|
+
*/
|
|
784
|
+
function createCertificateChain(subject, cert_bytes_list) {
|
|
785
|
+
const ptr0 = passStringToWasm0(subject, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
786
|
+
const len0 = WASM_VECTOR_LEN;
|
|
787
|
+
const ptr1 = passArrayJsValueToWasm0(cert_bytes_list, wasm.__wbindgen_malloc);
|
|
788
|
+
const len1 = WASM_VECTOR_LEN;
|
|
789
|
+
const ret = wasm.createCertificateChain(ptr0, len0, ptr1, len1);
|
|
790
|
+
if (ret[3]) {
|
|
791
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
792
|
+
}
|
|
793
|
+
var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
794
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
795
|
+
return v3;
|
|
796
|
+
}
|
|
797
|
+
exports.createCertificateChain = createCertificateChain;
|
|
798
|
+
|
|
750
799
|
/**
|
|
751
800
|
* Decode stored zone bytes to a plain JS object.
|
|
752
801
|
* @param {Uint8Array} bytes
|
package/libveritas_bg.wasm
CHANGED
|
Binary file
|