@totemsdk/root-identity 1.0.7 → 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.
- package/dist/UnifiedIdentityWallet.js +15 -15
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/package.json +17 -20
- package/rust/pkg/package.json +27 -0
- package/rust/pkg/root_identity_wasm.d.ts +6 -0
- package/rust/pkg/root_identity_wasm.js +9 -0
- package/rust/pkg/root_identity_wasm_bg.js +393 -0
- package/rust/pkg/root_identity_wasm_bg.wasm +0 -0
- package/rust/pkg/root_identity_wasm_bg.wasm.d.ts +13 -0
- package/rust/pkg-node/package.json +21 -0
- package/rust/pkg-node/root_identity_wasm.d.ts +6 -0
- package/rust/pkg-node/root_identity_wasm.js +400 -0
- package/rust/pkg-node/root_identity_wasm_bg.wasm +0 -0
- package/rust/pkg-node/root_identity_wasm_bg.wasm.d.ts +13 -0
|
@@ -30,19 +30,19 @@
|
|
|
30
30
|
*/
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
32
|
exports.UnifiedIdentityWallet = exports.MAX_CHILD_COUNT = void 0;
|
|
33
|
-
const sha3_js_1 = require("@noble/hashes/sha3.js");
|
|
34
33
|
const core_1 = require("@totemsdk/core");
|
|
34
|
+
const core_2 = require("@totemsdk/core");
|
|
35
35
|
exports.MAX_CHILD_COUNT = 64;
|
|
36
36
|
const OWNERSHIP_OP = 'TOTEM_OWNERSHIP_PROOF_V1';
|
|
37
37
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
38
38
|
// Helpers
|
|
39
39
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
40
40
|
function hashMessage(message) {
|
|
41
|
-
return (0,
|
|
41
|
+
return (0, core_1.sha3_256)(new TextEncoder().encode(message));
|
|
42
42
|
}
|
|
43
43
|
function addressFromPublicKeyBytes(pkBytes) {
|
|
44
|
-
const script = (0,
|
|
45
|
-
return (0,
|
|
44
|
+
const script = (0, core_2.scriptFromWotsPk)(pkBytes);
|
|
45
|
+
return (0, core_2.scriptToAddress)(script);
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
48
|
* Build the deterministic ownership-proof message that the root key signs.
|
|
@@ -87,15 +87,15 @@ class UnifiedIdentityWallet {
|
|
|
87
87
|
}
|
|
88
88
|
/** Create a wallet from a Minima-compatible BIP39 seed phrase. */
|
|
89
89
|
static fromPhrase(phrase, childCount = exports.MAX_CHILD_COUNT) {
|
|
90
|
-
return new UnifiedIdentityWallet((0,
|
|
90
|
+
return new UnifiedIdentityWallet((0, core_2.phraseToSeed)(phrase), childCount);
|
|
91
91
|
}
|
|
92
92
|
/** Generate a new random Minima-compatible 24-word seed phrase. */
|
|
93
93
|
static generatePhrase() {
|
|
94
|
-
return (0,
|
|
94
|
+
return (0, core_2.generateSeedPhrase)();
|
|
95
95
|
}
|
|
96
96
|
/** Validate a Minima-compatible seed phrase. */
|
|
97
97
|
static validatePhrase(phrase) {
|
|
98
|
-
return (0,
|
|
98
|
+
return (0, core_2.validatePhrase)(phrase);
|
|
99
99
|
}
|
|
100
100
|
// ── Address accessors ────────────────────────────────────────────────────────
|
|
101
101
|
/** Minima address for the root key. NEVER use this address for spending. */
|
|
@@ -158,7 +158,7 @@ class UnifiedIdentityWallet {
|
|
|
158
158
|
return {
|
|
159
159
|
address: this.getRootAddress(),
|
|
160
160
|
publicKey: this.getRootPublicKey(),
|
|
161
|
-
signature: (0,
|
|
161
|
+
signature: (0, core_2.bytesToHex)((0, core_2.serializeTreeSignature)(sig)),
|
|
162
162
|
message,
|
|
163
163
|
};
|
|
164
164
|
}
|
|
@@ -177,7 +177,7 @@ class UnifiedIdentityWallet {
|
|
|
177
177
|
return {
|
|
178
178
|
address: this.getChildAddress(index),
|
|
179
179
|
publicKey: this.getChildPublicKey(index),
|
|
180
|
-
signature: (0,
|
|
180
|
+
signature: (0, core_2.bytesToHex)((0, core_2.serializeTreeSignature)(sig)),
|
|
181
181
|
message,
|
|
182
182
|
};
|
|
183
183
|
}
|
|
@@ -240,11 +240,11 @@ class UnifiedIdentityWallet {
|
|
|
240
240
|
const canonicalMessage = buildOwnershipMessage(rootAddress, childPublicKeys, timestamp);
|
|
241
241
|
if (rootProof.message !== canonicalMessage)
|
|
242
242
|
return false;
|
|
243
|
-
const sigResult = (0,
|
|
243
|
+
const sigResult = (0, core_2.verifySignatureDetailed)(rootAddress, canonicalMessage, rootProof.signature, rootPublicKey);
|
|
244
244
|
if (!sigResult.valid)
|
|
245
245
|
return false;
|
|
246
246
|
for (let i = 0; i < childPublicKeys.length; i++) {
|
|
247
|
-
const pkBytes = (0,
|
|
247
|
+
const pkBytes = (0, core_2.hexToBytes)(childPublicKeys[i]);
|
|
248
248
|
const derivedAddress = addressFromPublicKeyBytes(pkBytes);
|
|
249
249
|
if (derivedAddress.toLowerCase() !== childAddresses[i].toLowerCase())
|
|
250
250
|
return false;
|
|
@@ -273,7 +273,7 @@ class UnifiedIdentityWallet {
|
|
|
273
273
|
*/
|
|
274
274
|
getRootTreeKey() {
|
|
275
275
|
if (!this.cachedRootTreeKey) {
|
|
276
|
-
this.cachedRootTreeKey = (0,
|
|
276
|
+
this.cachedRootTreeKey = (0, core_2.createUnifiedRootTreeKey)(this.baseSeed);
|
|
277
277
|
}
|
|
278
278
|
return this.cachedRootTreeKey;
|
|
279
279
|
}
|
|
@@ -343,17 +343,17 @@ class UnifiedIdentityWallet {
|
|
|
343
343
|
}
|
|
344
344
|
populateRootCache() {
|
|
345
345
|
const pkBytes = this.getRootTreeKey().getPublicKey();
|
|
346
|
-
this.cachedRootPublicKey = (0,
|
|
346
|
+
this.cachedRootPublicKey = (0, core_2.bytesToHex)(pkBytes);
|
|
347
347
|
this.cachedRootAddress = addressFromPublicKeyBytes(pkBytes);
|
|
348
348
|
}
|
|
349
349
|
getOrCreateChildTreeKey(index) {
|
|
350
350
|
const cached = this.childTreeKeyCache.get(index);
|
|
351
351
|
if (cached)
|
|
352
352
|
return cached;
|
|
353
|
-
const treeKey = (0,
|
|
353
|
+
const treeKey = (0, core_2.createUnifiedChildTreeKey)(this.baseSeed, index);
|
|
354
354
|
this.childTreeKeyCache.set(index, treeKey);
|
|
355
355
|
const pkBytes = treeKey.getPublicKey();
|
|
356
|
-
this.childPubKeyCache.set(index, (0,
|
|
356
|
+
this.childPubKeyCache.set(index, (0, core_2.bytesToHex)(pkBytes));
|
|
357
357
|
this.childAddressCache.set(index, addressFromPublicKeyBytes(pkBytes));
|
|
358
358
|
return treeKey;
|
|
359
359
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -17,4 +17,5 @@
|
|
|
17
17
|
* - NFT / token ownership linking
|
|
18
18
|
*/
|
|
19
19
|
export { UnifiedIdentityWallet, MAX_CHILD_COUNT } from './UnifiedIdentityWallet.js';
|
|
20
|
+
export { UnifiedIdentityWallet as RootIdentityWallet } from './UnifiedIdentityWallet.js';
|
|
20
21
|
export type { WotsProof, OwnershipProof } from './types.js';
|
package/dist/index.js
CHANGED
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
* - NFT / token ownership linking
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.MAX_CHILD_COUNT = exports.UnifiedIdentityWallet = void 0;
|
|
21
|
+
exports.RootIdentityWallet = exports.MAX_CHILD_COUNT = exports.UnifiedIdentityWallet = void 0;
|
|
22
22
|
var UnifiedIdentityWallet_js_1 = require("./UnifiedIdentityWallet.js");
|
|
23
23
|
Object.defineProperty(exports, "UnifiedIdentityWallet", { enumerable: true, get: function () { return UnifiedIdentityWallet_js_1.UnifiedIdentityWallet; } });
|
|
24
24
|
Object.defineProperty(exports, "MAX_CHILD_COUNT", { enumerable: true, get: function () { return UnifiedIdentityWallet_js_1.MAX_CHILD_COUNT; } });
|
|
25
|
+
var UnifiedIdentityWallet_js_2 = require("./UnifiedIdentityWallet.js");
|
|
26
|
+
Object.defineProperty(exports, "RootIdentityWallet", { enumerable: true, get: function () { return UnifiedIdentityWallet_js_2.UnifiedIdentityWallet; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@totemsdk/root-identity",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Single root identity controlling up to 64 on-chain addresses — all cryptographically linked via full independent 3-level TreeKeys",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -10,22 +10,20 @@
|
|
|
10
10
|
"bare": "./dist/index.js",
|
|
11
11
|
"browser": "./dist/index.js",
|
|
12
12
|
"import": "./dist/index.js",
|
|
13
|
-
"require": "./dist/index.
|
|
13
|
+
"require": "./dist/index.js"
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"dist",
|
|
18
|
+
"rust/pkg/",
|
|
19
|
+
"rust/pkg-node/",
|
|
18
20
|
"README.md",
|
|
19
21
|
"LICENSE"
|
|
20
22
|
],
|
|
21
23
|
"peerDependencies": {
|
|
22
|
-
"@
|
|
23
|
-
"@totemsdk/core": ">=1.0.1"
|
|
24
|
+
"@totemsdk/core": "^1.2.8"
|
|
24
25
|
},
|
|
25
26
|
"peerDependenciesMeta": {
|
|
26
|
-
"@noble/hashes": {
|
|
27
|
-
"optional": false
|
|
28
|
-
},
|
|
29
27
|
"@totemsdk/core": {
|
|
30
28
|
"optional": false
|
|
31
29
|
}
|
|
@@ -38,13 +36,12 @@
|
|
|
38
36
|
"access": "public"
|
|
39
37
|
},
|
|
40
38
|
"devDependencies": {
|
|
41
|
-
"@
|
|
42
|
-
"@totemsdk/core": "1.1.0",
|
|
43
|
-
"@types/jest": "^29.0.0",
|
|
39
|
+
"@types/jest": "^30.0.0",
|
|
44
40
|
"@types/node": "^20.0.0",
|
|
45
|
-
"jest": "^
|
|
41
|
+
"jest": "^30.4.2",
|
|
46
42
|
"ts-jest": "^29.0.0",
|
|
47
|
-
"typescript": "^
|
|
43
|
+
"typescript": "^7.0.2",
|
|
44
|
+
"@totemsdk/core": "^1.2.8"
|
|
48
45
|
},
|
|
49
46
|
"keywords": [
|
|
50
47
|
"totem",
|
|
@@ -53,7 +50,6 @@
|
|
|
53
50
|
"blockchain",
|
|
54
51
|
"quantum-resistant",
|
|
55
52
|
"wots",
|
|
56
|
-
"kissvm",
|
|
57
53
|
"utxo",
|
|
58
54
|
"identity",
|
|
59
55
|
"did",
|
|
@@ -63,19 +59,20 @@
|
|
|
63
59
|
],
|
|
64
60
|
"author": "Totem SDK",
|
|
65
61
|
"license": "MIT",
|
|
66
|
-
"homepage": "https://
|
|
62
|
+
"homepage": "https://totem.ing",
|
|
67
63
|
"bugs": {
|
|
68
|
-
"url": "https://github.com/
|
|
64
|
+
"url": "https://github.com/totem-sdk/totem-sdk/issues"
|
|
69
65
|
},
|
|
70
66
|
"repository": {
|
|
71
67
|
"type": "git",
|
|
72
|
-
"url": "git+https://github.com/
|
|
73
|
-
"directory": "packages/
|
|
68
|
+
"url": "git+https://github.com/totem-sdk/totem-sdk.git",
|
|
69
|
+
"directory": "packages/root-identity"
|
|
74
70
|
},
|
|
75
71
|
"scripts": {
|
|
76
|
-
"build": "tsc",
|
|
77
|
-
"clean": "rm -rf dist",
|
|
72
|
+
"build": "npm run build:wasm && tsc && node ../../scripts/clean-wasm-output-ignores.mjs",
|
|
73
|
+
"clean": "rm -rf dist rust/pkg rust/pkg-node rust/target",
|
|
78
74
|
"pretest": "cd ../core && npm run build",
|
|
79
|
-
"test": "
|
|
75
|
+
"test": "jest",
|
|
76
|
+
"build:wasm": "cd rust && wasm-pack build --target bundler --out-dir pkg && wasm-pack build --target nodejs --out-dir pkg-node"
|
|
80
77
|
}
|
|
81
78
|
}
|
|
@@ -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,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
|
+
}
|
|
Binary file
|
|
@@ -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,400 @@
|
|
|
1
|
+
/* @ts-self-types="./root_identity_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
function init() {
|
|
4
|
+
wasm.init();
|
|
5
|
+
}
|
|
6
|
+
exports.init = init;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @param {any} proof_js
|
|
10
|
+
* @param {any} verify_sig_js
|
|
11
|
+
* @returns {any}
|
|
12
|
+
*/
|
|
13
|
+
function verify_ownership_proof_wasm(proof_js, verify_sig_js) {
|
|
14
|
+
const ret = wasm.verify_ownership_proof_wasm(proof_js, verify_sig_js);
|
|
15
|
+
if (ret[2]) {
|
|
16
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
17
|
+
}
|
|
18
|
+
return takeFromExternrefTable0(ret[0]);
|
|
19
|
+
}
|
|
20
|
+
exports.verify_ownership_proof_wasm = verify_ownership_proof_wasm;
|
|
21
|
+
function __wbg_get_imports() {
|
|
22
|
+
const import0 = {
|
|
23
|
+
__proto__: null,
|
|
24
|
+
__wbg_Error_92b29b0548f8b746: function(arg0, arg1) {
|
|
25
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
26
|
+
return ret;
|
|
27
|
+
},
|
|
28
|
+
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
29
|
+
const ret = String(arg1);
|
|
30
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
31
|
+
const len1 = WASM_VECTOR_LEN;
|
|
32
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
33
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
34
|
+
},
|
|
35
|
+
__wbg___wbindgen_boolean_get_fa956cfa2d1bd751: function(arg0) {
|
|
36
|
+
const v = arg0;
|
|
37
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
38
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
39
|
+
},
|
|
40
|
+
__wbg___wbindgen_debug_string_c25d447a39f5578f: function(arg0, arg1) {
|
|
41
|
+
const ret = debugString(arg1);
|
|
42
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
43
|
+
const len1 = WASM_VECTOR_LEN;
|
|
44
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
45
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
46
|
+
},
|
|
47
|
+
__wbg___wbindgen_in_aca499c5de7ff5e5: function(arg0, arg1) {
|
|
48
|
+
const ret = arg0 in arg1;
|
|
49
|
+
return ret;
|
|
50
|
+
},
|
|
51
|
+
__wbg___wbindgen_is_function_1ff95bcc5517c252: function(arg0) {
|
|
52
|
+
const ret = typeof(arg0) === 'function';
|
|
53
|
+
return ret;
|
|
54
|
+
},
|
|
55
|
+
__wbg___wbindgen_is_object_a27215656b807791: function(arg0) {
|
|
56
|
+
const val = arg0;
|
|
57
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
58
|
+
return ret;
|
|
59
|
+
},
|
|
60
|
+
__wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {
|
|
61
|
+
const ret = arg0 === undefined;
|
|
62
|
+
return ret;
|
|
63
|
+
},
|
|
64
|
+
__wbg___wbindgen_jsval_loose_eq_db4c3b15f63fc170: function(arg0, arg1) {
|
|
65
|
+
const ret = arg0 == arg1;
|
|
66
|
+
return ret;
|
|
67
|
+
},
|
|
68
|
+
__wbg___wbindgen_number_get_394265ed1e1b84ee: function(arg0, arg1) {
|
|
69
|
+
const obj = arg1;
|
|
70
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
71
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
72
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
73
|
+
},
|
|
74
|
+
__wbg___wbindgen_string_get_b0ca35b86a603356: function(arg0, arg1) {
|
|
75
|
+
const obj = arg1;
|
|
76
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
77
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
78
|
+
var len1 = WASM_VECTOR_LEN;
|
|
79
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
80
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
81
|
+
},
|
|
82
|
+
__wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
|
|
83
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
84
|
+
},
|
|
85
|
+
__wbg_call_8a2dd23819f8a60a: function() { return handleError(function (arg0, arg1) {
|
|
86
|
+
const ret = arg0.call(arg1);
|
|
87
|
+
return ret;
|
|
88
|
+
}, arguments); },
|
|
89
|
+
__wbg_call_a6e5c5dce5018821: function() { return handleError(function (arg0, arg1, arg2) {
|
|
90
|
+
const ret = arg0.call(arg1, arg2);
|
|
91
|
+
return ret;
|
|
92
|
+
}, arguments); },
|
|
93
|
+
__wbg_done_89b2b13e91a60321: function(arg0) {
|
|
94
|
+
const ret = arg0.done;
|
|
95
|
+
return ret;
|
|
96
|
+
},
|
|
97
|
+
__wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
|
|
98
|
+
let deferred0_0;
|
|
99
|
+
let deferred0_1;
|
|
100
|
+
try {
|
|
101
|
+
deferred0_0 = arg0;
|
|
102
|
+
deferred0_1 = arg1;
|
|
103
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
104
|
+
} finally {
|
|
105
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
__wbg_get_c7eb1f358a7654df: function() { return handleError(function (arg0, arg1) {
|
|
109
|
+
const ret = Reflect.get(arg0, arg1);
|
|
110
|
+
return ret;
|
|
111
|
+
}, arguments); },
|
|
112
|
+
__wbg_get_unchecked_6e0ad6d2a41b06f6: function(arg0, arg1) {
|
|
113
|
+
const ret = arg0[arg1 >>> 0];
|
|
114
|
+
return ret;
|
|
115
|
+
},
|
|
116
|
+
__wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
|
|
117
|
+
const ret = arg0[arg1];
|
|
118
|
+
return ret;
|
|
119
|
+
},
|
|
120
|
+
__wbg_instanceof_ArrayBuffer_4480b9e0068a8adb: function(arg0) {
|
|
121
|
+
let result;
|
|
122
|
+
try {
|
|
123
|
+
result = arg0 instanceof ArrayBuffer;
|
|
124
|
+
} catch (_) {
|
|
125
|
+
result = false;
|
|
126
|
+
}
|
|
127
|
+
const ret = result;
|
|
128
|
+
return ret;
|
|
129
|
+
},
|
|
130
|
+
__wbg_instanceof_Uint8Array_309b927aaf7a3fc7: function(arg0) {
|
|
131
|
+
let result;
|
|
132
|
+
try {
|
|
133
|
+
result = arg0 instanceof Uint8Array;
|
|
134
|
+
} catch (_) {
|
|
135
|
+
result = false;
|
|
136
|
+
}
|
|
137
|
+
const ret = result;
|
|
138
|
+
return ret;
|
|
139
|
+
},
|
|
140
|
+
__wbg_isArray_0677c962b281d01a: function(arg0) {
|
|
141
|
+
const ret = Array.isArray(arg0);
|
|
142
|
+
return ret;
|
|
143
|
+
},
|
|
144
|
+
__wbg_iterator_6f722e4a93058b71: function() {
|
|
145
|
+
const ret = Symbol.iterator;
|
|
146
|
+
return ret;
|
|
147
|
+
},
|
|
148
|
+
__wbg_length_1f0964f4a5e2c6d8: function(arg0) {
|
|
149
|
+
const ret = arg0.length;
|
|
150
|
+
return ret;
|
|
151
|
+
},
|
|
152
|
+
__wbg_length_370319915dc99107: function(arg0) {
|
|
153
|
+
const ret = arg0.length;
|
|
154
|
+
return ret;
|
|
155
|
+
},
|
|
156
|
+
__wbg_new_227d7c05414eb861: function() {
|
|
157
|
+
const ret = new Error();
|
|
158
|
+
return ret;
|
|
159
|
+
},
|
|
160
|
+
__wbg_new_32b398fb48b6d94a: function() {
|
|
161
|
+
const ret = new Array();
|
|
162
|
+
return ret;
|
|
163
|
+
},
|
|
164
|
+
__wbg_new_cd45aabdf6073e84: function(arg0) {
|
|
165
|
+
const ret = new Uint8Array(arg0);
|
|
166
|
+
return ret;
|
|
167
|
+
},
|
|
168
|
+
__wbg_new_da52cf8fe3429cb2: function() {
|
|
169
|
+
const ret = new Object();
|
|
170
|
+
return ret;
|
|
171
|
+
},
|
|
172
|
+
__wbg_next_6dbf2c0ac8cde20f: function(arg0) {
|
|
173
|
+
const ret = arg0.next;
|
|
174
|
+
return ret;
|
|
175
|
+
},
|
|
176
|
+
__wbg_next_71f2aa1cb3d1e37e: function() { return handleError(function (arg0) {
|
|
177
|
+
const ret = arg0.next();
|
|
178
|
+
return ret;
|
|
179
|
+
}, arguments); },
|
|
180
|
+
__wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
|
|
181
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
182
|
+
},
|
|
183
|
+
__wbg_push_d2ae3af0c1217ae6: function(arg0, arg1) {
|
|
184
|
+
const ret = arg0.push(arg1);
|
|
185
|
+
return ret;
|
|
186
|
+
},
|
|
187
|
+
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
188
|
+
arg0[arg1] = arg2;
|
|
189
|
+
},
|
|
190
|
+
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
|
|
191
|
+
const ret = arg1.stack;
|
|
192
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
193
|
+
const len1 = WASM_VECTOR_LEN;
|
|
194
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
195
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
196
|
+
},
|
|
197
|
+
__wbg_value_a5d5488a9589444a: function(arg0) {
|
|
198
|
+
const ret = arg0.value;
|
|
199
|
+
return ret;
|
|
200
|
+
},
|
|
201
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
202
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
203
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
204
|
+
return ret;
|
|
205
|
+
},
|
|
206
|
+
__wbindgen_init_externref_table: function() {
|
|
207
|
+
const table = wasm.__wbindgen_externrefs;
|
|
208
|
+
const offset = table.grow(4);
|
|
209
|
+
table.set(0, undefined);
|
|
210
|
+
table.set(offset + 0, undefined);
|
|
211
|
+
table.set(offset + 1, null);
|
|
212
|
+
table.set(offset + 2, true);
|
|
213
|
+
table.set(offset + 3, false);
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
return {
|
|
217
|
+
__proto__: null,
|
|
218
|
+
"./root_identity_wasm_bg.js": import0,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function addToExternrefTable0(obj) {
|
|
223
|
+
const idx = wasm.__externref_table_alloc();
|
|
224
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
225
|
+
return idx;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function debugString(val) {
|
|
229
|
+
// primitive types
|
|
230
|
+
const type = typeof val;
|
|
231
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
232
|
+
return `${val}`;
|
|
233
|
+
}
|
|
234
|
+
if (type == 'string') {
|
|
235
|
+
return `"${val}"`;
|
|
236
|
+
}
|
|
237
|
+
if (type == 'symbol') {
|
|
238
|
+
const description = val.description;
|
|
239
|
+
if (description == null) {
|
|
240
|
+
return 'Symbol';
|
|
241
|
+
} else {
|
|
242
|
+
return `Symbol(${description})`;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (type == 'function') {
|
|
246
|
+
const name = val.name;
|
|
247
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
248
|
+
return `Function(${name})`;
|
|
249
|
+
} else {
|
|
250
|
+
return 'Function';
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
// objects
|
|
254
|
+
if (Array.isArray(val)) {
|
|
255
|
+
const length = val.length;
|
|
256
|
+
let debug = '[';
|
|
257
|
+
if (length > 0) {
|
|
258
|
+
debug += debugString(val[0]);
|
|
259
|
+
}
|
|
260
|
+
for(let i = 1; i < length; i++) {
|
|
261
|
+
debug += ', ' + debugString(val[i]);
|
|
262
|
+
}
|
|
263
|
+
debug += ']';
|
|
264
|
+
return debug;
|
|
265
|
+
}
|
|
266
|
+
// Test for built-in
|
|
267
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
268
|
+
let className;
|
|
269
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
270
|
+
className = builtInMatches[1];
|
|
271
|
+
} else {
|
|
272
|
+
// Failed to match the standard '[object ClassName]'
|
|
273
|
+
return toString.call(val);
|
|
274
|
+
}
|
|
275
|
+
if (className == 'Object') {
|
|
276
|
+
// we're a user defined class or Object
|
|
277
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
278
|
+
// easier than looping through ownProperties of `val`.
|
|
279
|
+
try {
|
|
280
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
281
|
+
} catch (_) {
|
|
282
|
+
return 'Object';
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
// errors
|
|
286
|
+
if (val instanceof Error) {
|
|
287
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
288
|
+
}
|
|
289
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
290
|
+
return className;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
294
|
+
ptr = ptr >>> 0;
|
|
295
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
let cachedDataViewMemory0 = null;
|
|
299
|
+
function getDataViewMemory0() {
|
|
300
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
301
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
302
|
+
}
|
|
303
|
+
return cachedDataViewMemory0;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function getStringFromWasm0(ptr, len) {
|
|
307
|
+
return decodeText(ptr >>> 0, len);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
let cachedUint8ArrayMemory0 = null;
|
|
311
|
+
function getUint8ArrayMemory0() {
|
|
312
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
313
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
314
|
+
}
|
|
315
|
+
return cachedUint8ArrayMemory0;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
function handleError(f, args) {
|
|
319
|
+
try {
|
|
320
|
+
return f.apply(this, args);
|
|
321
|
+
} catch (e) {
|
|
322
|
+
const idx = addToExternrefTable0(e);
|
|
323
|
+
wasm.__wbindgen_exn_store(idx);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function isLikeNone(x) {
|
|
328
|
+
return x === undefined || x === null;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
332
|
+
if (realloc === undefined) {
|
|
333
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
334
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
335
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
336
|
+
WASM_VECTOR_LEN = buf.length;
|
|
337
|
+
return ptr;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
let len = arg.length;
|
|
341
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
342
|
+
|
|
343
|
+
const mem = getUint8ArrayMemory0();
|
|
344
|
+
|
|
345
|
+
let offset = 0;
|
|
346
|
+
|
|
347
|
+
for (; offset < len; offset++) {
|
|
348
|
+
const code = arg.charCodeAt(offset);
|
|
349
|
+
if (code > 0x7F) break;
|
|
350
|
+
mem[ptr + offset] = code;
|
|
351
|
+
}
|
|
352
|
+
if (offset !== len) {
|
|
353
|
+
if (offset !== 0) {
|
|
354
|
+
arg = arg.slice(offset);
|
|
355
|
+
}
|
|
356
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
357
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
358
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
359
|
+
|
|
360
|
+
offset += ret.written;
|
|
361
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
WASM_VECTOR_LEN = offset;
|
|
365
|
+
return ptr;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
function takeFromExternrefTable0(idx) {
|
|
369
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
370
|
+
wasm.__externref_table_dealloc(idx);
|
|
371
|
+
return value;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
375
|
+
cachedTextDecoder.decode();
|
|
376
|
+
function decodeText(ptr, len) {
|
|
377
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
const cachedTextEncoder = new TextEncoder();
|
|
381
|
+
|
|
382
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
383
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
384
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
385
|
+
view.set(buf);
|
|
386
|
+
return {
|
|
387
|
+
read: arg.length,
|
|
388
|
+
written: buf.length
|
|
389
|
+
};
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
let WASM_VECTOR_LEN = 0;
|
|
394
|
+
|
|
395
|
+
const wasmPath = `${__dirname}/root_identity_wasm_bg.wasm`;
|
|
396
|
+
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
397
|
+
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
398
|
+
let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
|
|
399
|
+
let wasm = wasmInstance.exports;
|
|
400
|
+
wasm.__wbindgen_start();
|
|
Binary file
|
|
@@ -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;
|