@spacesprotocol/libveritas 0.0.0-dev.20260318034313 → 0.0.0-dev.20260318155541
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 -22
- package/libveritas.js +44 -136
- package/libveritas_bg.wasm +0 -0
- package/package.json +1 -1
package/libveritas.d.ts
CHANGED
|
@@ -181,9 +181,9 @@ export class VerifiedMessage {
|
|
|
181
181
|
*/
|
|
182
182
|
message_bytes(): Uint8Array;
|
|
183
183
|
/**
|
|
184
|
-
* All verified zones.
|
|
184
|
+
* All verified zones as plain JS objects.
|
|
185
185
|
*/
|
|
186
|
-
zones():
|
|
186
|
+
zones(): any;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
export class Veritas {
|
|
@@ -202,31 +202,15 @@ export class Veritas {
|
|
|
202
202
|
static withDevMode(anchors: any): Veritas;
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
export class Zone {
|
|
206
|
-
private constructor();
|
|
207
|
-
free(): void;
|
|
208
|
-
[Symbol.dispose](): void;
|
|
209
|
-
alias(): string | undefined;
|
|
210
|
-
anchor(): number;
|
|
211
|
-
handle(): string;
|
|
212
|
-
is_better_than(other: Zone): boolean;
|
|
213
|
-
sovereignty(): string;
|
|
214
|
-
to_bytes(): Uint8Array;
|
|
215
|
-
/**
|
|
216
|
-
* Returns the full zone as a JS object.
|
|
217
|
-
*/
|
|
218
|
-
to_json(): any;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
205
|
/**
|
|
222
|
-
* Decode stored
|
|
206
|
+
* Decode stored zone bytes to a plain JS object.
|
|
223
207
|
*/
|
|
224
|
-
export function
|
|
208
|
+
export function decodeZone(bytes: Uint8Array): any;
|
|
225
209
|
|
|
226
210
|
/**
|
|
227
|
-
* Decode stored
|
|
211
|
+
* Decode stored certificate bytes to a JS object.
|
|
228
212
|
*/
|
|
229
|
-
export function
|
|
213
|
+
export function decode_certificate(bytes: Uint8Array): any;
|
|
230
214
|
|
|
231
215
|
/**
|
|
232
216
|
* Hash a message with the Spaces signed-message prefix (SHA256).
|
|
@@ -243,3 +227,13 @@ export function verify_schnorr(msg_hash: Uint8Array, signature: Uint8Array, pubk
|
|
|
243
227
|
* Verify a Schnorr signature over a message using the Spaces signed-message prefix.
|
|
244
228
|
*/
|
|
245
229
|
export function verify_spaces_message(msg: Uint8Array, signature: Uint8Array, pubkey: Uint8Array): void;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Compare two zones — returns true if `a` is fresher/better than `b`.
|
|
233
|
+
*/
|
|
234
|
+
export function zoneIsBetterThan(a: any, b: any): boolean;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Serialize a zone JS object to borsh bytes for storage.
|
|
238
|
+
*/
|
|
239
|
+
export function zoneToBytes(zone: any): Uint8Array;
|
package/libveritas.js
CHANGED
|
@@ -459,14 +459,12 @@ class VerifiedMessage {
|
|
|
459
459
|
return v1;
|
|
460
460
|
}
|
|
461
461
|
/**
|
|
462
|
-
* All verified zones.
|
|
463
|
-
* @returns {
|
|
462
|
+
* All verified zones as plain JS objects.
|
|
463
|
+
* @returns {any}
|
|
464
464
|
*/
|
|
465
465
|
zones() {
|
|
466
466
|
const ret = wasm.verifiedmessage_zones(this.__wbg_ptr);
|
|
467
|
-
|
|
468
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
469
|
-
return v1;
|
|
467
|
+
return ret;
|
|
470
468
|
}
|
|
471
469
|
}
|
|
472
470
|
if (Symbol.dispose) VerifiedMessage.prototype[Symbol.dispose] = VerifiedMessage.prototype.free;
|
|
@@ -579,140 +577,37 @@ class Veritas {
|
|
|
579
577
|
if (Symbol.dispose) Veritas.prototype[Symbol.dispose] = Veritas.prototype.free;
|
|
580
578
|
exports.Veritas = Veritas;
|
|
581
579
|
|
|
582
|
-
class Zone {
|
|
583
|
-
static __wrap(ptr) {
|
|
584
|
-
ptr = ptr >>> 0;
|
|
585
|
-
const obj = Object.create(Zone.prototype);
|
|
586
|
-
obj.__wbg_ptr = ptr;
|
|
587
|
-
ZoneFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
588
|
-
return obj;
|
|
589
|
-
}
|
|
590
|
-
__destroy_into_raw() {
|
|
591
|
-
const ptr = this.__wbg_ptr;
|
|
592
|
-
this.__wbg_ptr = 0;
|
|
593
|
-
ZoneFinalization.unregister(this);
|
|
594
|
-
return ptr;
|
|
595
|
-
}
|
|
596
|
-
free() {
|
|
597
|
-
const ptr = this.__destroy_into_raw();
|
|
598
|
-
wasm.__wbg_zone_free(ptr, 0);
|
|
599
|
-
}
|
|
600
|
-
/**
|
|
601
|
-
* @returns {string | undefined}
|
|
602
|
-
*/
|
|
603
|
-
alias() {
|
|
604
|
-
const ret = wasm.zone_alias(this.__wbg_ptr);
|
|
605
|
-
let v1;
|
|
606
|
-
if (ret[0] !== 0) {
|
|
607
|
-
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
608
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
609
|
-
}
|
|
610
|
-
return v1;
|
|
611
|
-
}
|
|
612
|
-
/**
|
|
613
|
-
* @returns {number}
|
|
614
|
-
*/
|
|
615
|
-
anchor() {
|
|
616
|
-
const ret = wasm.zone_anchor(this.__wbg_ptr);
|
|
617
|
-
return ret >>> 0;
|
|
618
|
-
}
|
|
619
|
-
/**
|
|
620
|
-
* @returns {string}
|
|
621
|
-
*/
|
|
622
|
-
handle() {
|
|
623
|
-
let deferred1_0;
|
|
624
|
-
let deferred1_1;
|
|
625
|
-
try {
|
|
626
|
-
const ret = wasm.zone_handle(this.__wbg_ptr);
|
|
627
|
-
deferred1_0 = ret[0];
|
|
628
|
-
deferred1_1 = ret[1];
|
|
629
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
630
|
-
} finally {
|
|
631
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
/**
|
|
635
|
-
* @param {Zone} other
|
|
636
|
-
* @returns {boolean}
|
|
637
|
-
*/
|
|
638
|
-
is_better_than(other) {
|
|
639
|
-
_assertClass(other, Zone);
|
|
640
|
-
const ret = wasm.zone_is_better_than(this.__wbg_ptr, other.__wbg_ptr);
|
|
641
|
-
if (ret[2]) {
|
|
642
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
643
|
-
}
|
|
644
|
-
return ret[0] !== 0;
|
|
645
|
-
}
|
|
646
|
-
/**
|
|
647
|
-
* @returns {string}
|
|
648
|
-
*/
|
|
649
|
-
sovereignty() {
|
|
650
|
-
let deferred1_0;
|
|
651
|
-
let deferred1_1;
|
|
652
|
-
try {
|
|
653
|
-
const ret = wasm.zone_sovereignty(this.__wbg_ptr);
|
|
654
|
-
deferred1_0 = ret[0];
|
|
655
|
-
deferred1_1 = ret[1];
|
|
656
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
657
|
-
} finally {
|
|
658
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
/**
|
|
662
|
-
* @returns {Uint8Array}
|
|
663
|
-
*/
|
|
664
|
-
to_bytes() {
|
|
665
|
-
const ret = wasm.zone_to_bytes(this.__wbg_ptr);
|
|
666
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
667
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
668
|
-
return v1;
|
|
669
|
-
}
|
|
670
|
-
/**
|
|
671
|
-
* Returns the full zone as a JS object.
|
|
672
|
-
* @returns {any}
|
|
673
|
-
*/
|
|
674
|
-
to_json() {
|
|
675
|
-
const ret = wasm.zone_to_json(this.__wbg_ptr);
|
|
676
|
-
if (ret[2]) {
|
|
677
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
678
|
-
}
|
|
679
|
-
return takeFromExternrefTable0(ret[0]);
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
if (Symbol.dispose) Zone.prototype[Symbol.dispose] = Zone.prototype.free;
|
|
683
|
-
exports.Zone = Zone;
|
|
684
|
-
|
|
685
580
|
/**
|
|
686
|
-
* Decode stored
|
|
581
|
+
* Decode stored zone bytes to a plain JS object.
|
|
687
582
|
* @param {Uint8Array} bytes
|
|
688
583
|
* @returns {any}
|
|
689
584
|
*/
|
|
690
|
-
function
|
|
585
|
+
function decodeZone(bytes) {
|
|
691
586
|
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
692
587
|
const len0 = WASM_VECTOR_LEN;
|
|
693
|
-
const ret = wasm.
|
|
588
|
+
const ret = wasm.decodeZone(ptr0, len0);
|
|
694
589
|
if (ret[2]) {
|
|
695
590
|
throw takeFromExternrefTable0(ret[1]);
|
|
696
591
|
}
|
|
697
592
|
return takeFromExternrefTable0(ret[0]);
|
|
698
593
|
}
|
|
699
|
-
exports.
|
|
594
|
+
exports.decodeZone = decodeZone;
|
|
700
595
|
|
|
701
596
|
/**
|
|
702
|
-
* Decode stored
|
|
597
|
+
* Decode stored certificate bytes to a JS object.
|
|
703
598
|
* @param {Uint8Array} bytes
|
|
704
|
-
* @returns {
|
|
599
|
+
* @returns {any}
|
|
705
600
|
*/
|
|
706
|
-
function
|
|
601
|
+
function decode_certificate(bytes) {
|
|
707
602
|
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
708
603
|
const len0 = WASM_VECTOR_LEN;
|
|
709
|
-
const ret = wasm.
|
|
604
|
+
const ret = wasm.decode_certificate(ptr0, len0);
|
|
710
605
|
if (ret[2]) {
|
|
711
606
|
throw takeFromExternrefTable0(ret[1]);
|
|
712
607
|
}
|
|
713
|
-
return
|
|
608
|
+
return takeFromExternrefTable0(ret[0]);
|
|
714
609
|
}
|
|
715
|
-
exports.
|
|
610
|
+
exports.decode_certificate = decode_certificate;
|
|
716
611
|
|
|
717
612
|
/**
|
|
718
613
|
* Hash a message with the Spaces signed-message prefix (SHA256).
|
|
@@ -770,6 +665,37 @@ function verify_spaces_message(msg, signature, pubkey) {
|
|
|
770
665
|
}
|
|
771
666
|
exports.verify_spaces_message = verify_spaces_message;
|
|
772
667
|
|
|
668
|
+
/**
|
|
669
|
+
* Compare two zones — returns true if `a` is fresher/better than `b`.
|
|
670
|
+
* @param {any} a
|
|
671
|
+
* @param {any} b
|
|
672
|
+
* @returns {boolean}
|
|
673
|
+
*/
|
|
674
|
+
function zoneIsBetterThan(a, b) {
|
|
675
|
+
const ret = wasm.zoneIsBetterThan(a, b);
|
|
676
|
+
if (ret[2]) {
|
|
677
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
678
|
+
}
|
|
679
|
+
return ret[0] !== 0;
|
|
680
|
+
}
|
|
681
|
+
exports.zoneIsBetterThan = zoneIsBetterThan;
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* Serialize a zone JS object to borsh bytes for storage.
|
|
685
|
+
* @param {any} zone
|
|
686
|
+
* @returns {Uint8Array}
|
|
687
|
+
*/
|
|
688
|
+
function zoneToBytes(zone) {
|
|
689
|
+
const ret = wasm.zoneToBytes(zone);
|
|
690
|
+
if (ret[3]) {
|
|
691
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
692
|
+
}
|
|
693
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
694
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
695
|
+
return v1;
|
|
696
|
+
}
|
|
697
|
+
exports.zoneToBytes = zoneToBytes;
|
|
698
|
+
|
|
773
699
|
function __wbg_get_imports() {
|
|
774
700
|
const import0 = {
|
|
775
701
|
__proto__: null,
|
|
@@ -957,10 +883,6 @@ function __wbg_get_imports() {
|
|
|
957
883
|
const ret = arg0.value;
|
|
958
884
|
return ret;
|
|
959
885
|
},
|
|
960
|
-
__wbg_zone_new: function(arg0) {
|
|
961
|
-
const ret = Zone.__wrap(arg0);
|
|
962
|
-
return ret;
|
|
963
|
-
},
|
|
964
886
|
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
965
887
|
// Cast intrinsic for `F64 -> Externref`.
|
|
966
888
|
const ret = arg0;
|
|
@@ -1016,9 +938,6 @@ const VerifiedMessageFinalization = (typeof FinalizationRegistry === 'undefined'
|
|
|
1016
938
|
const VeritasFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1017
939
|
? { register: () => {}, unregister: () => {} }
|
|
1018
940
|
: new FinalizationRegistry(ptr => wasm.__wbg_veritas_free(ptr >>> 0, 1));
|
|
1019
|
-
const ZoneFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1020
|
-
? { register: () => {}, unregister: () => {} }
|
|
1021
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_zone_free(ptr >>> 0, 1));
|
|
1022
941
|
|
|
1023
942
|
function addToExternrefTable0(obj) {
|
|
1024
943
|
const idx = wasm.__externref_table_alloc();
|
|
@@ -1097,17 +1016,6 @@ function debugString(val) {
|
|
|
1097
1016
|
return className;
|
|
1098
1017
|
}
|
|
1099
1018
|
|
|
1100
|
-
function getArrayJsValueFromWasm0(ptr, len) {
|
|
1101
|
-
ptr = ptr >>> 0;
|
|
1102
|
-
const mem = getDataViewMemory0();
|
|
1103
|
-
const result = [];
|
|
1104
|
-
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
1105
|
-
result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
|
|
1106
|
-
}
|
|
1107
|
-
wasm.__externref_drop_slice(ptr, len);
|
|
1108
|
-
return result;
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1111
1019
|
function getArrayU8FromWasm0(ptr, len) {
|
|
1112
1020
|
ptr = ptr >>> 0;
|
|
1113
1021
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
package/libveritas_bg.wasm
CHANGED
|
Binary file
|