@totemsdk/root-identity 1.0.6 → 1.0.8

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.
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "root-identity-wasm",
3
+ "type": "module",
4
+ "collaborators": [
5
+ "Totem SDK Contributors"
6
+ ],
7
+ "description": "Root identity ownership proof verification — canonical message reconstruction, WOTS signature verification, address derivation (Rust/WASM)",
8
+ "version": "0.1.0",
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/totem-sdk/totem-sdk"
13
+ },
14
+ "files": [
15
+ "root_identity_wasm_bg.wasm",
16
+ "root_identity_wasm.js",
17
+ "root_identity_wasm_bg.js",
18
+ "root_identity_wasm.d.ts"
19
+ ],
20
+ "main": "root_identity_wasm.js",
21
+ "homepage": "https://totem.ing",
22
+ "types": "root_identity_wasm.d.ts",
23
+ "sideEffects": [
24
+ "./root_identity_wasm.js",
25
+ "./snippets/*"
26
+ ]
27
+ }
@@ -0,0 +1,6 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ export function init(): void;
5
+
6
+ export function verify_ownership_proof_wasm(proof_js: any, verify_sig_js: any): any;
@@ -0,0 +1,9 @@
1
+ /* @ts-self-types="./root_identity_wasm.d.ts" */
2
+ import * as wasm from "./root_identity_wasm_bg.wasm";
3
+ import { __wbg_set_wasm } from "./root_identity_wasm_bg.js";
4
+
5
+ __wbg_set_wasm(wasm);
6
+ wasm.__wbindgen_start();
7
+ export {
8
+ init, verify_ownership_proof_wasm
9
+ } from "./root_identity_wasm_bg.js";
@@ -0,0 +1,393 @@
1
+ export function init() {
2
+ wasm.init();
3
+ }
4
+
5
+ /**
6
+ * @param {any} proof_js
7
+ * @param {any} verify_sig_js
8
+ * @returns {any}
9
+ */
10
+ export function verify_ownership_proof_wasm(proof_js, verify_sig_js) {
11
+ const ret = wasm.verify_ownership_proof_wasm(proof_js, verify_sig_js);
12
+ if (ret[2]) {
13
+ throw takeFromExternrefTable0(ret[1]);
14
+ }
15
+ return takeFromExternrefTable0(ret[0]);
16
+ }
17
+ export function __wbg_Error_92b29b0548f8b746(arg0, arg1) {
18
+ const ret = Error(getStringFromWasm0(arg0, arg1));
19
+ return ret;
20
+ }
21
+ export function __wbg_String_8564e559799eccda(arg0, arg1) {
22
+ const ret = String(arg1);
23
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
24
+ const len1 = WASM_VECTOR_LEN;
25
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
26
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
27
+ }
28
+ export function __wbg___wbindgen_boolean_get_fa956cfa2d1bd751(arg0) {
29
+ const v = arg0;
30
+ const ret = typeof(v) === 'boolean' ? v : undefined;
31
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
32
+ }
33
+ export function __wbg___wbindgen_debug_string_c25d447a39f5578f(arg0, arg1) {
34
+ const ret = debugString(arg1);
35
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
36
+ const len1 = WASM_VECTOR_LEN;
37
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
38
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
39
+ }
40
+ export function __wbg___wbindgen_in_aca499c5de7ff5e5(arg0, arg1) {
41
+ const ret = arg0 in arg1;
42
+ return ret;
43
+ }
44
+ export function __wbg___wbindgen_is_function_1ff95bcc5517c252(arg0) {
45
+ const ret = typeof(arg0) === 'function';
46
+ return ret;
47
+ }
48
+ export function __wbg___wbindgen_is_object_a27215656b807791(arg0) {
49
+ const val = arg0;
50
+ const ret = typeof(val) === 'object' && val !== null;
51
+ return ret;
52
+ }
53
+ export function __wbg___wbindgen_is_undefined_c05833b95a3cf397(arg0) {
54
+ const ret = arg0 === undefined;
55
+ return ret;
56
+ }
57
+ export function __wbg___wbindgen_jsval_loose_eq_db4c3b15f63fc170(arg0, arg1) {
58
+ const ret = arg0 == arg1;
59
+ return ret;
60
+ }
61
+ export function __wbg___wbindgen_number_get_394265ed1e1b84ee(arg0, arg1) {
62
+ const obj = arg1;
63
+ const ret = typeof(obj) === 'number' ? obj : undefined;
64
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
65
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
66
+ }
67
+ export function __wbg___wbindgen_string_get_b0ca35b86a603356(arg0, arg1) {
68
+ const obj = arg1;
69
+ const ret = typeof(obj) === 'string' ? obj : undefined;
70
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
71
+ var len1 = WASM_VECTOR_LEN;
72
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
73
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
74
+ }
75
+ export function __wbg___wbindgen_throw_344f42d3211c4765(arg0, arg1) {
76
+ throw new Error(getStringFromWasm0(arg0, arg1));
77
+ }
78
+ export function __wbg_call_8a2dd23819f8a60a() { return handleError(function (arg0, arg1) {
79
+ const ret = arg0.call(arg1);
80
+ return ret;
81
+ }, arguments); }
82
+ export function __wbg_call_a6e5c5dce5018821() { return handleError(function (arg0, arg1, arg2) {
83
+ const ret = arg0.call(arg1, arg2);
84
+ return ret;
85
+ }, arguments); }
86
+ export function __wbg_done_89b2b13e91a60321(arg0) {
87
+ const ret = arg0.done;
88
+ return ret;
89
+ }
90
+ export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
91
+ let deferred0_0;
92
+ let deferred0_1;
93
+ try {
94
+ deferred0_0 = arg0;
95
+ deferred0_1 = arg1;
96
+ console.error(getStringFromWasm0(arg0, arg1));
97
+ } finally {
98
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
99
+ }
100
+ }
101
+ export function __wbg_get_c7eb1f358a7654df() { return handleError(function (arg0, arg1) {
102
+ const ret = Reflect.get(arg0, arg1);
103
+ return ret;
104
+ }, arguments); }
105
+ export function __wbg_get_unchecked_6e0ad6d2a41b06f6(arg0, arg1) {
106
+ const ret = arg0[arg1 >>> 0];
107
+ return ret;
108
+ }
109
+ export function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {
110
+ const ret = arg0[arg1];
111
+ return ret;
112
+ }
113
+ export function __wbg_instanceof_ArrayBuffer_4480b9e0068a8adb(arg0) {
114
+ let result;
115
+ try {
116
+ result = arg0 instanceof ArrayBuffer;
117
+ } catch (_) {
118
+ result = false;
119
+ }
120
+ const ret = result;
121
+ return ret;
122
+ }
123
+ export function __wbg_instanceof_Uint8Array_309b927aaf7a3fc7(arg0) {
124
+ let result;
125
+ try {
126
+ result = arg0 instanceof Uint8Array;
127
+ } catch (_) {
128
+ result = false;
129
+ }
130
+ const ret = result;
131
+ return ret;
132
+ }
133
+ export function __wbg_isArray_0677c962b281d01a(arg0) {
134
+ const ret = Array.isArray(arg0);
135
+ return ret;
136
+ }
137
+ export function __wbg_iterator_6f722e4a93058b71() {
138
+ const ret = Symbol.iterator;
139
+ return ret;
140
+ }
141
+ export function __wbg_length_1f0964f4a5e2c6d8(arg0) {
142
+ const ret = arg0.length;
143
+ return ret;
144
+ }
145
+ export function __wbg_length_370319915dc99107(arg0) {
146
+ const ret = arg0.length;
147
+ return ret;
148
+ }
149
+ export function __wbg_new_227d7c05414eb861() {
150
+ const ret = new Error();
151
+ return ret;
152
+ }
153
+ export function __wbg_new_32b398fb48b6d94a() {
154
+ const ret = new Array();
155
+ return ret;
156
+ }
157
+ export function __wbg_new_cd45aabdf6073e84(arg0) {
158
+ const ret = new Uint8Array(arg0);
159
+ return ret;
160
+ }
161
+ export function __wbg_new_da52cf8fe3429cb2() {
162
+ const ret = new Object();
163
+ return ret;
164
+ }
165
+ export function __wbg_next_6dbf2c0ac8cde20f(arg0) {
166
+ const ret = arg0.next;
167
+ return ret;
168
+ }
169
+ export function __wbg_next_71f2aa1cb3d1e37e() { return handleError(function (arg0) {
170
+ const ret = arg0.next();
171
+ return ret;
172
+ }, arguments); }
173
+ export function __wbg_prototypesetcall_4770620bbe4688a0(arg0, arg1, arg2) {
174
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
175
+ }
176
+ export function __wbg_push_d2ae3af0c1217ae6(arg0, arg1) {
177
+ const ret = arg0.push(arg1);
178
+ return ret;
179
+ }
180
+ export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
181
+ arg0[arg1] = arg2;
182
+ }
183
+ export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
184
+ const ret = arg1.stack;
185
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
186
+ const len1 = WASM_VECTOR_LEN;
187
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
188
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
189
+ }
190
+ export function __wbg_value_a5d5488a9589444a(arg0) {
191
+ const ret = arg0.value;
192
+ return ret;
193
+ }
194
+ export function __wbindgen_cast_0000000000000001(arg0, arg1) {
195
+ // Cast intrinsic for `Ref(String) -> Externref`.
196
+ const ret = getStringFromWasm0(arg0, arg1);
197
+ return ret;
198
+ }
199
+ export function __wbindgen_init_externref_table() {
200
+ const table = wasm.__wbindgen_externrefs;
201
+ const offset = table.grow(4);
202
+ table.set(0, undefined);
203
+ table.set(offset + 0, undefined);
204
+ table.set(offset + 1, null);
205
+ table.set(offset + 2, true);
206
+ table.set(offset + 3, false);
207
+ }
208
+ function addToExternrefTable0(obj) {
209
+ const idx = wasm.__externref_table_alloc();
210
+ wasm.__wbindgen_externrefs.set(idx, obj);
211
+ return idx;
212
+ }
213
+
214
+ function debugString(val) {
215
+ // primitive types
216
+ const type = typeof val;
217
+ if (type == 'number' || type == 'boolean' || val == null) {
218
+ return `${val}`;
219
+ }
220
+ if (type == 'string') {
221
+ return `"${val}"`;
222
+ }
223
+ if (type == 'symbol') {
224
+ const description = val.description;
225
+ if (description == null) {
226
+ return 'Symbol';
227
+ } else {
228
+ return `Symbol(${description})`;
229
+ }
230
+ }
231
+ if (type == 'function') {
232
+ const name = val.name;
233
+ if (typeof name == 'string' && name.length > 0) {
234
+ return `Function(${name})`;
235
+ } else {
236
+ return 'Function';
237
+ }
238
+ }
239
+ // objects
240
+ if (Array.isArray(val)) {
241
+ const length = val.length;
242
+ let debug = '[';
243
+ if (length > 0) {
244
+ debug += debugString(val[0]);
245
+ }
246
+ for(let i = 1; i < length; i++) {
247
+ debug += ', ' + debugString(val[i]);
248
+ }
249
+ debug += ']';
250
+ return debug;
251
+ }
252
+ // Test for built-in
253
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
254
+ let className;
255
+ if (builtInMatches && builtInMatches.length > 1) {
256
+ className = builtInMatches[1];
257
+ } else {
258
+ // Failed to match the standard '[object ClassName]'
259
+ return toString.call(val);
260
+ }
261
+ if (className == 'Object') {
262
+ // we're a user defined class or Object
263
+ // JSON.stringify avoids problems with cycles, and is generally much
264
+ // easier than looping through ownProperties of `val`.
265
+ try {
266
+ return 'Object(' + JSON.stringify(val) + ')';
267
+ } catch (_) {
268
+ return 'Object';
269
+ }
270
+ }
271
+ // errors
272
+ if (val instanceof Error) {
273
+ return `${val.name}: ${val.message}\n${val.stack}`;
274
+ }
275
+ // TODO we could test for more things here, like `Set`s and `Map`s.
276
+ return className;
277
+ }
278
+
279
+ function getArrayU8FromWasm0(ptr, len) {
280
+ ptr = ptr >>> 0;
281
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
282
+ }
283
+
284
+ let cachedDataViewMemory0 = null;
285
+ function getDataViewMemory0() {
286
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
287
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
288
+ }
289
+ return cachedDataViewMemory0;
290
+ }
291
+
292
+ function getStringFromWasm0(ptr, len) {
293
+ return decodeText(ptr >>> 0, len);
294
+ }
295
+
296
+ let cachedUint8ArrayMemory0 = null;
297
+ function getUint8ArrayMemory0() {
298
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
299
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
300
+ }
301
+ return cachedUint8ArrayMemory0;
302
+ }
303
+
304
+ function handleError(f, args) {
305
+ try {
306
+ return f.apply(this, args);
307
+ } catch (e) {
308
+ const idx = addToExternrefTable0(e);
309
+ wasm.__wbindgen_exn_store(idx);
310
+ }
311
+ }
312
+
313
+ function isLikeNone(x) {
314
+ return x === undefined || x === null;
315
+ }
316
+
317
+ function passStringToWasm0(arg, malloc, realloc) {
318
+ if (realloc === undefined) {
319
+ const buf = cachedTextEncoder.encode(arg);
320
+ const ptr = malloc(buf.length, 1) >>> 0;
321
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
322
+ WASM_VECTOR_LEN = buf.length;
323
+ return ptr;
324
+ }
325
+
326
+ let len = arg.length;
327
+ let ptr = malloc(len, 1) >>> 0;
328
+
329
+ const mem = getUint8ArrayMemory0();
330
+
331
+ let offset = 0;
332
+
333
+ for (; offset < len; offset++) {
334
+ const code = arg.charCodeAt(offset);
335
+ if (code > 0x7F) break;
336
+ mem[ptr + offset] = code;
337
+ }
338
+ if (offset !== len) {
339
+ if (offset !== 0) {
340
+ arg = arg.slice(offset);
341
+ }
342
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
343
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
344
+ const ret = cachedTextEncoder.encodeInto(arg, view);
345
+
346
+ offset += ret.written;
347
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
348
+ }
349
+
350
+ WASM_VECTOR_LEN = offset;
351
+ return ptr;
352
+ }
353
+
354
+ function takeFromExternrefTable0(idx) {
355
+ const value = wasm.__wbindgen_externrefs.get(idx);
356
+ wasm.__externref_table_dealloc(idx);
357
+ return value;
358
+ }
359
+
360
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
361
+ cachedTextDecoder.decode();
362
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
363
+ let numBytesDecoded = 0;
364
+ function decodeText(ptr, len) {
365
+ numBytesDecoded += len;
366
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
367
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
368
+ cachedTextDecoder.decode();
369
+ numBytesDecoded = len;
370
+ }
371
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
372
+ }
373
+
374
+ const cachedTextEncoder = new TextEncoder();
375
+
376
+ if (!('encodeInto' in cachedTextEncoder)) {
377
+ cachedTextEncoder.encodeInto = function (arg, view) {
378
+ const buf = cachedTextEncoder.encode(arg);
379
+ view.set(buf);
380
+ return {
381
+ read: arg.length,
382
+ written: buf.length
383
+ };
384
+ };
385
+ }
386
+
387
+ let WASM_VECTOR_LEN = 0;
388
+
389
+
390
+ let wasm;
391
+ export function __wbg_set_wasm(val) {
392
+ wasm = val;
393
+ }
@@ -0,0 +1,13 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const init: () => void;
5
+ export const verify_ownership_proof_wasm: (a: any, b: any) => [number, number, number];
6
+ export const __wbindgen_malloc: (a: number, b: number) => number;
7
+ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
8
+ export const __wbindgen_exn_store: (a: number) => void;
9
+ export const __externref_table_alloc: () => number;
10
+ export const __wbindgen_externrefs: WebAssembly.Table;
11
+ export const __wbindgen_free: (a: number, b: number, c: number) => void;
12
+ export const __externref_table_dealloc: (a: number) => void;
13
+ export const __wbindgen_start: () => void;
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "root-identity-wasm",
3
+ "collaborators": [
4
+ "Totem SDK Contributors"
5
+ ],
6
+ "description": "Root identity ownership proof verification — canonical message reconstruction, WOTS signature verification, address derivation (Rust/WASM)",
7
+ "version": "0.1.0",
8
+ "license": "MIT",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/totem-sdk/totem-sdk"
12
+ },
13
+ "files": [
14
+ "root_identity_wasm_bg.wasm",
15
+ "root_identity_wasm.js",
16
+ "root_identity_wasm.d.ts"
17
+ ],
18
+ "main": "root_identity_wasm.js",
19
+ "homepage": "https://totem.ing",
20
+ "types": "root_identity_wasm.d.ts"
21
+ }
@@ -0,0 +1,6 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ export function init(): void;
5
+
6
+ export function verify_ownership_proof_wasm(proof_js: any, verify_sig_js: any): any;