@myecoria/frost-ed25519-blake2b-wasm 0.1.0
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/LICENSE-Apache-2.0 +13 -0
- package/LICENSE-MIT +18 -0
- package/README.md +118 -0
- package/frost_ed25519_blake2b_wasm.d.ts +69 -0
- package/frost_ed25519_blake2b_wasm.js +9 -0
- package/frost_ed25519_blake2b_wasm_bg.js +586 -0
- package/frost_ed25519_blake2b_wasm_bg.wasm +0 -0
- package/package.json +25 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2019-2021 Zcash Foundation
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
package/LICENSE-MIT
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Copyright 2019-2021 Zcash Foundation
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
5
|
+
the Software without restriction, including without limitation the rights to
|
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
7
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
8
|
+
subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
15
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
16
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
17
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
18
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# frost-ed25519-blake2b wasm bindings
|
|
2
|
+
|
|
3
|
+
Bindings `wasm-pack` pour utiliser `frost-ed25519-blake2b` depuis TypeScript.
|
|
4
|
+
|
|
5
|
+
## Prérequis
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
rustup target add wasm32-unknown-unknown
|
|
9
|
+
cargo install wasm-pack
|
|
10
|
+
npm login
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Build du package npm
|
|
14
|
+
|
|
15
|
+
Depuis `frost-ed25519-blake2b/bindings/node`:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
wasm-pack build --release --target bundler --out-dir pkg
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Si vous voulez publier sous scope npm (ex: `@myecoria/...`):
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
wasm-pack build --release --target bundler --scope myecoria --out-dir pkg
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## API exposée
|
|
28
|
+
|
|
29
|
+
- `generate_with_dealer(max_signers, min_signers) -> DealerKeygenResult`
|
|
30
|
+
- `key_package_from_secret_share(secret_share_bytes) -> Uint8Array`
|
|
31
|
+
- `round1_commit(key_package_bytes) -> Round1CommitResult`
|
|
32
|
+
- `create_signing_package(commitment_list, message_bytes) -> Uint8Array`
|
|
33
|
+
- `round2_sign(signing_package_bytes, nonces_bytes, key_package_bytes) -> Round2SignatureShareResult`
|
|
34
|
+
- `aggregate_signature(signing_package_bytes, signature_share_list, public_key_package_bytes) -> Uint8Array`
|
|
35
|
+
- `verify_group_signature(public_key_package_bytes, message_bytes, signature_bytes) -> boolean`
|
|
36
|
+
|
|
37
|
+
Toutes les données crypto sont échangées en bytes sérialisés (`Uint8Array`).
|
|
38
|
+
|
|
39
|
+
## Structures TS (générées par wasm-bindgen)
|
|
40
|
+
|
|
41
|
+
- `DealerKeygenResult`
|
|
42
|
+
- `public_key_package: Uint8Array`
|
|
43
|
+
- `shares_len: number`
|
|
44
|
+
- `share(index: number): DealerShare`
|
|
45
|
+
- `DealerShare`
|
|
46
|
+
- `identifier: Uint8Array`
|
|
47
|
+
- `secret_share: Uint8Array`
|
|
48
|
+
- `key_package: Uint8Array`
|
|
49
|
+
- `Round1CommitResult`
|
|
50
|
+
- `identifier: Uint8Array`
|
|
51
|
+
- `nonces: Uint8Array`
|
|
52
|
+
- `commitments: Uint8Array`
|
|
53
|
+
- `Round2SignatureShareResult`
|
|
54
|
+
- `identifier: Uint8Array`
|
|
55
|
+
- `signature_share: Uint8Array`
|
|
56
|
+
- `CommitmentList`
|
|
57
|
+
- `new CommitmentList()`
|
|
58
|
+
- `push(identifier, commitment)`
|
|
59
|
+
- `SignatureShareList`
|
|
60
|
+
- `new SignatureShareList()`
|
|
61
|
+
- `push(identifier, signature_share)`
|
|
62
|
+
|
|
63
|
+
## Exemple TypeScript
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
import init, {
|
|
67
|
+
CommitmentList,
|
|
68
|
+
SignatureShareList,
|
|
69
|
+
aggregate_signature,
|
|
70
|
+
create_signing_package,
|
|
71
|
+
generate_with_dealer,
|
|
72
|
+
round1_commit,
|
|
73
|
+
round2_sign,
|
|
74
|
+
verify_group_signature,
|
|
75
|
+
} from "frost-ed25519-blake2b-wasm";
|
|
76
|
+
|
|
77
|
+
await init();
|
|
78
|
+
|
|
79
|
+
const message = new TextEncoder().encode("message to sign");
|
|
80
|
+
const dealer = generate_with_dealer(5, 3);
|
|
81
|
+
|
|
82
|
+
const commitmentList = new CommitmentList();
|
|
83
|
+
const round1Results = [];
|
|
84
|
+
|
|
85
|
+
for (let i = 0; i < 3; i += 1) {
|
|
86
|
+
const share = dealer.share(i);
|
|
87
|
+
const round1 = round1_commit(share.key_package);
|
|
88
|
+
round1Results.push({ round1, keyPackage: share.key_package });
|
|
89
|
+
commitmentList.push(round1.identifier, round1.commitments);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const signingPackage = create_signing_package(commitmentList, message);
|
|
93
|
+
|
|
94
|
+
const signatureShareList = new SignatureShareList();
|
|
95
|
+
for (const item of round1Results) {
|
|
96
|
+
const round2 = round2_sign(signingPackage, item.round1.nonces, item.keyPackage);
|
|
97
|
+
signatureShareList.push(round2.identifier, round2.signature_share);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const signature = aggregate_signature(
|
|
101
|
+
signingPackage,
|
|
102
|
+
signatureShareList,
|
|
103
|
+
dealer.public_key_package
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
const ok = verify_group_signature(dealer.public_key_package, message, signature);
|
|
107
|
+
console.log("signature valid:", ok);
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Publication npmjs
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
cd pkg
|
|
114
|
+
npm publish --access public
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Le nom publié est basé sur `name` dans `Cargo.toml` (`frost-ed25519-blake2b-wasm`),
|
|
118
|
+
ou `@scope/frost-ed25519-blake2b-wasm` si `--scope` est utilisé.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export class CommitmentList {
|
|
5
|
+
free(): void;
|
|
6
|
+
[Symbol.dispose](): void;
|
|
7
|
+
clear(): void;
|
|
8
|
+
constructor();
|
|
9
|
+
push(identifier: Uint8Array, commitment: Uint8Array): void;
|
|
10
|
+
readonly len: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class DealerKeygenResult {
|
|
14
|
+
private constructor();
|
|
15
|
+
free(): void;
|
|
16
|
+
[Symbol.dispose](): void;
|
|
17
|
+
share(index: number): DealerShare;
|
|
18
|
+
readonly public_key_package: Uint8Array;
|
|
19
|
+
readonly shares_len: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export class DealerShare {
|
|
23
|
+
private constructor();
|
|
24
|
+
free(): void;
|
|
25
|
+
[Symbol.dispose](): void;
|
|
26
|
+
readonly identifier: Uint8Array;
|
|
27
|
+
readonly key_package: Uint8Array;
|
|
28
|
+
readonly secret_share: Uint8Array;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export class Round1CommitResult {
|
|
32
|
+
private constructor();
|
|
33
|
+
free(): void;
|
|
34
|
+
[Symbol.dispose](): void;
|
|
35
|
+
readonly commitments: Uint8Array;
|
|
36
|
+
readonly identifier: Uint8Array;
|
|
37
|
+
readonly nonces: Uint8Array;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export class Round2SignatureShareResult {
|
|
41
|
+
private constructor();
|
|
42
|
+
free(): void;
|
|
43
|
+
[Symbol.dispose](): void;
|
|
44
|
+
readonly identifier: Uint8Array;
|
|
45
|
+
readonly signature_share: Uint8Array;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export class SignatureShareList {
|
|
49
|
+
free(): void;
|
|
50
|
+
[Symbol.dispose](): void;
|
|
51
|
+
clear(): void;
|
|
52
|
+
constructor();
|
|
53
|
+
push(identifier: Uint8Array, signature_share: Uint8Array): void;
|
|
54
|
+
readonly len: number;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function aggregate_signature(signing_package_bytes: Uint8Array, signature_shares: SignatureShareList, public_key_package_bytes: Uint8Array): Uint8Array;
|
|
58
|
+
|
|
59
|
+
export function create_signing_package(round1_commitments: CommitmentList, message: Uint8Array): Uint8Array;
|
|
60
|
+
|
|
61
|
+
export function generate_with_dealer(max_signers: number, min_signers: number): DealerKeygenResult;
|
|
62
|
+
|
|
63
|
+
export function key_package_from_secret_share(secret_share_bytes: Uint8Array): Uint8Array;
|
|
64
|
+
|
|
65
|
+
export function round1_commit(key_package_bytes: Uint8Array): Round1CommitResult;
|
|
66
|
+
|
|
67
|
+
export function round2_sign(signing_package_bytes: Uint8Array, nonces_bytes: Uint8Array, key_package_bytes: Uint8Array): Round2SignatureShareResult;
|
|
68
|
+
|
|
69
|
+
export function verify_group_signature(public_key_package_bytes: Uint8Array, message: Uint8Array, signature_bytes: Uint8Array): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* @ts-self-types="./frost_ed25519_blake2b_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
import * as wasm from "./frost_ed25519_blake2b_wasm_bg.wasm";
|
|
4
|
+
import { __wbg_set_wasm } from "./frost_ed25519_blake2b_wasm_bg.js";
|
|
5
|
+
__wbg_set_wasm(wasm);
|
|
6
|
+
wasm.__wbindgen_start();
|
|
7
|
+
export {
|
|
8
|
+
CommitmentList, DealerKeygenResult, DealerShare, Round1CommitResult, Round2SignatureShareResult, SignatureShareList, aggregate_signature, create_signing_package, generate_with_dealer, key_package_from_secret_share, round1_commit, round2_sign, verify_group_signature
|
|
9
|
+
} from "./frost_ed25519_blake2b_wasm_bg.js";
|
|
@@ -0,0 +1,586 @@
|
|
|
1
|
+
export class CommitmentList {
|
|
2
|
+
__destroy_into_raw() {
|
|
3
|
+
const ptr = this.__wbg_ptr;
|
|
4
|
+
this.__wbg_ptr = 0;
|
|
5
|
+
CommitmentListFinalization.unregister(this);
|
|
6
|
+
return ptr;
|
|
7
|
+
}
|
|
8
|
+
free() {
|
|
9
|
+
const ptr = this.__destroy_into_raw();
|
|
10
|
+
wasm.__wbg_commitmentlist_free(ptr, 0);
|
|
11
|
+
}
|
|
12
|
+
clear() {
|
|
13
|
+
wasm.commitmentlist_clear(this.__wbg_ptr);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @returns {number}
|
|
17
|
+
*/
|
|
18
|
+
get len() {
|
|
19
|
+
const ret = wasm.commitmentlist_len(this.__wbg_ptr);
|
|
20
|
+
return ret >>> 0;
|
|
21
|
+
}
|
|
22
|
+
constructor() {
|
|
23
|
+
const ret = wasm.commitmentlist_new();
|
|
24
|
+
this.__wbg_ptr = ret >>> 0;
|
|
25
|
+
CommitmentListFinalization.register(this, this.__wbg_ptr, this);
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @param {Uint8Array} identifier
|
|
30
|
+
* @param {Uint8Array} commitment
|
|
31
|
+
*/
|
|
32
|
+
push(identifier, commitment) {
|
|
33
|
+
const ptr0 = passArray8ToWasm0(identifier, wasm.__wbindgen_malloc);
|
|
34
|
+
const len0 = WASM_VECTOR_LEN;
|
|
35
|
+
const ptr1 = passArray8ToWasm0(commitment, wasm.__wbindgen_malloc);
|
|
36
|
+
const len1 = WASM_VECTOR_LEN;
|
|
37
|
+
wasm.commitmentlist_push(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (Symbol.dispose) CommitmentList.prototype[Symbol.dispose] = CommitmentList.prototype.free;
|
|
41
|
+
|
|
42
|
+
export class DealerKeygenResult {
|
|
43
|
+
static __wrap(ptr) {
|
|
44
|
+
ptr = ptr >>> 0;
|
|
45
|
+
const obj = Object.create(DealerKeygenResult.prototype);
|
|
46
|
+
obj.__wbg_ptr = ptr;
|
|
47
|
+
DealerKeygenResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
48
|
+
return obj;
|
|
49
|
+
}
|
|
50
|
+
__destroy_into_raw() {
|
|
51
|
+
const ptr = this.__wbg_ptr;
|
|
52
|
+
this.__wbg_ptr = 0;
|
|
53
|
+
DealerKeygenResultFinalization.unregister(this);
|
|
54
|
+
return ptr;
|
|
55
|
+
}
|
|
56
|
+
free() {
|
|
57
|
+
const ptr = this.__destroy_into_raw();
|
|
58
|
+
wasm.__wbg_dealerkeygenresult_free(ptr, 0);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* @returns {Uint8Array}
|
|
62
|
+
*/
|
|
63
|
+
get public_key_package() {
|
|
64
|
+
const ret = wasm.dealerkeygenresult_public_key_package(this.__wbg_ptr);
|
|
65
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
66
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
67
|
+
return v1;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* @param {number} index
|
|
71
|
+
* @returns {DealerShare}
|
|
72
|
+
*/
|
|
73
|
+
share(index) {
|
|
74
|
+
const ret = wasm.dealerkeygenresult_share(this.__wbg_ptr, index);
|
|
75
|
+
if (ret[2]) {
|
|
76
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
77
|
+
}
|
|
78
|
+
return DealerShare.__wrap(ret[0]);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* @returns {number}
|
|
82
|
+
*/
|
|
83
|
+
get shares_len() {
|
|
84
|
+
const ret = wasm.dealerkeygenresult_shares_len(this.__wbg_ptr);
|
|
85
|
+
return ret >>> 0;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (Symbol.dispose) DealerKeygenResult.prototype[Symbol.dispose] = DealerKeygenResult.prototype.free;
|
|
89
|
+
|
|
90
|
+
export class DealerShare {
|
|
91
|
+
static __wrap(ptr) {
|
|
92
|
+
ptr = ptr >>> 0;
|
|
93
|
+
const obj = Object.create(DealerShare.prototype);
|
|
94
|
+
obj.__wbg_ptr = ptr;
|
|
95
|
+
DealerShareFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
96
|
+
return obj;
|
|
97
|
+
}
|
|
98
|
+
__destroy_into_raw() {
|
|
99
|
+
const ptr = this.__wbg_ptr;
|
|
100
|
+
this.__wbg_ptr = 0;
|
|
101
|
+
DealerShareFinalization.unregister(this);
|
|
102
|
+
return ptr;
|
|
103
|
+
}
|
|
104
|
+
free() {
|
|
105
|
+
const ptr = this.__destroy_into_raw();
|
|
106
|
+
wasm.__wbg_dealershare_free(ptr, 0);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* @returns {Uint8Array}
|
|
110
|
+
*/
|
|
111
|
+
get identifier() {
|
|
112
|
+
const ret = wasm.dealershare_identifier(this.__wbg_ptr);
|
|
113
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
114
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
115
|
+
return v1;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* @returns {Uint8Array}
|
|
119
|
+
*/
|
|
120
|
+
get key_package() {
|
|
121
|
+
const ret = wasm.dealershare_key_package(this.__wbg_ptr);
|
|
122
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
123
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
124
|
+
return v1;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* @returns {Uint8Array}
|
|
128
|
+
*/
|
|
129
|
+
get secret_share() {
|
|
130
|
+
const ret = wasm.dealershare_secret_share(this.__wbg_ptr);
|
|
131
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
132
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
133
|
+
return v1;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (Symbol.dispose) DealerShare.prototype[Symbol.dispose] = DealerShare.prototype.free;
|
|
137
|
+
|
|
138
|
+
export class Round1CommitResult {
|
|
139
|
+
static __wrap(ptr) {
|
|
140
|
+
ptr = ptr >>> 0;
|
|
141
|
+
const obj = Object.create(Round1CommitResult.prototype);
|
|
142
|
+
obj.__wbg_ptr = ptr;
|
|
143
|
+
Round1CommitResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
144
|
+
return obj;
|
|
145
|
+
}
|
|
146
|
+
__destroy_into_raw() {
|
|
147
|
+
const ptr = this.__wbg_ptr;
|
|
148
|
+
this.__wbg_ptr = 0;
|
|
149
|
+
Round1CommitResultFinalization.unregister(this);
|
|
150
|
+
return ptr;
|
|
151
|
+
}
|
|
152
|
+
free() {
|
|
153
|
+
const ptr = this.__destroy_into_raw();
|
|
154
|
+
wasm.__wbg_round1commitresult_free(ptr, 0);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* @returns {Uint8Array}
|
|
158
|
+
*/
|
|
159
|
+
get commitments() {
|
|
160
|
+
const ret = wasm.round1commitresult_commitments(this.__wbg_ptr);
|
|
161
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
162
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
163
|
+
return v1;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* @returns {Uint8Array}
|
|
167
|
+
*/
|
|
168
|
+
get identifier() {
|
|
169
|
+
const ret = wasm.round1commitresult_identifier(this.__wbg_ptr);
|
|
170
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
171
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
172
|
+
return v1;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* @returns {Uint8Array}
|
|
176
|
+
*/
|
|
177
|
+
get nonces() {
|
|
178
|
+
const ret = wasm.round1commitresult_nonces(this.__wbg_ptr);
|
|
179
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
180
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
181
|
+
return v1;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
if (Symbol.dispose) Round1CommitResult.prototype[Symbol.dispose] = Round1CommitResult.prototype.free;
|
|
185
|
+
|
|
186
|
+
export class Round2SignatureShareResult {
|
|
187
|
+
static __wrap(ptr) {
|
|
188
|
+
ptr = ptr >>> 0;
|
|
189
|
+
const obj = Object.create(Round2SignatureShareResult.prototype);
|
|
190
|
+
obj.__wbg_ptr = ptr;
|
|
191
|
+
Round2SignatureShareResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
192
|
+
return obj;
|
|
193
|
+
}
|
|
194
|
+
__destroy_into_raw() {
|
|
195
|
+
const ptr = this.__wbg_ptr;
|
|
196
|
+
this.__wbg_ptr = 0;
|
|
197
|
+
Round2SignatureShareResultFinalization.unregister(this);
|
|
198
|
+
return ptr;
|
|
199
|
+
}
|
|
200
|
+
free() {
|
|
201
|
+
const ptr = this.__destroy_into_raw();
|
|
202
|
+
wasm.__wbg_round2signatureshareresult_free(ptr, 0);
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* @returns {Uint8Array}
|
|
206
|
+
*/
|
|
207
|
+
get identifier() {
|
|
208
|
+
const ret = wasm.round2signatureshareresult_identifier(this.__wbg_ptr);
|
|
209
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
210
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
211
|
+
return v1;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* @returns {Uint8Array}
|
|
215
|
+
*/
|
|
216
|
+
get signature_share() {
|
|
217
|
+
const ret = wasm.round2signatureshareresult_signature_share(this.__wbg_ptr);
|
|
218
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
219
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
220
|
+
return v1;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
if (Symbol.dispose) Round2SignatureShareResult.prototype[Symbol.dispose] = Round2SignatureShareResult.prototype.free;
|
|
224
|
+
|
|
225
|
+
export class SignatureShareList {
|
|
226
|
+
__destroy_into_raw() {
|
|
227
|
+
const ptr = this.__wbg_ptr;
|
|
228
|
+
this.__wbg_ptr = 0;
|
|
229
|
+
SignatureShareListFinalization.unregister(this);
|
|
230
|
+
return ptr;
|
|
231
|
+
}
|
|
232
|
+
free() {
|
|
233
|
+
const ptr = this.__destroy_into_raw();
|
|
234
|
+
wasm.__wbg_signaturesharelist_free(ptr, 0);
|
|
235
|
+
}
|
|
236
|
+
clear() {
|
|
237
|
+
wasm.signaturesharelist_clear(this.__wbg_ptr);
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* @returns {number}
|
|
241
|
+
*/
|
|
242
|
+
get len() {
|
|
243
|
+
const ret = wasm.signaturesharelist_len(this.__wbg_ptr);
|
|
244
|
+
return ret >>> 0;
|
|
245
|
+
}
|
|
246
|
+
constructor() {
|
|
247
|
+
const ret = wasm.signaturesharelist_new();
|
|
248
|
+
this.__wbg_ptr = ret >>> 0;
|
|
249
|
+
SignatureShareListFinalization.register(this, this.__wbg_ptr, this);
|
|
250
|
+
return this;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* @param {Uint8Array} identifier
|
|
254
|
+
* @param {Uint8Array} signature_share
|
|
255
|
+
*/
|
|
256
|
+
push(identifier, signature_share) {
|
|
257
|
+
const ptr0 = passArray8ToWasm0(identifier, wasm.__wbindgen_malloc);
|
|
258
|
+
const len0 = WASM_VECTOR_LEN;
|
|
259
|
+
const ptr1 = passArray8ToWasm0(signature_share, wasm.__wbindgen_malloc);
|
|
260
|
+
const len1 = WASM_VECTOR_LEN;
|
|
261
|
+
wasm.signaturesharelist_push(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
if (Symbol.dispose) SignatureShareList.prototype[Symbol.dispose] = SignatureShareList.prototype.free;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* @param {Uint8Array} signing_package_bytes
|
|
268
|
+
* @param {SignatureShareList} signature_shares
|
|
269
|
+
* @param {Uint8Array} public_key_package_bytes
|
|
270
|
+
* @returns {Uint8Array}
|
|
271
|
+
*/
|
|
272
|
+
export function aggregate_signature(signing_package_bytes, signature_shares, public_key_package_bytes) {
|
|
273
|
+
const ptr0 = passArray8ToWasm0(signing_package_bytes, wasm.__wbindgen_malloc);
|
|
274
|
+
const len0 = WASM_VECTOR_LEN;
|
|
275
|
+
_assertClass(signature_shares, SignatureShareList);
|
|
276
|
+
const ptr1 = passArray8ToWasm0(public_key_package_bytes, wasm.__wbindgen_malloc);
|
|
277
|
+
const len1 = WASM_VECTOR_LEN;
|
|
278
|
+
const ret = wasm.aggregate_signature(ptr0, len0, signature_shares.__wbg_ptr, ptr1, len1);
|
|
279
|
+
if (ret[3]) {
|
|
280
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
281
|
+
}
|
|
282
|
+
var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
283
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
284
|
+
return v3;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* @param {CommitmentList} round1_commitments
|
|
289
|
+
* @param {Uint8Array} message
|
|
290
|
+
* @returns {Uint8Array}
|
|
291
|
+
*/
|
|
292
|
+
export function create_signing_package(round1_commitments, message) {
|
|
293
|
+
_assertClass(round1_commitments, CommitmentList);
|
|
294
|
+
const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);
|
|
295
|
+
const len0 = WASM_VECTOR_LEN;
|
|
296
|
+
const ret = wasm.create_signing_package(round1_commitments.__wbg_ptr, ptr0, len0);
|
|
297
|
+
if (ret[3]) {
|
|
298
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
299
|
+
}
|
|
300
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
301
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
302
|
+
return v2;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* @param {number} max_signers
|
|
307
|
+
* @param {number} min_signers
|
|
308
|
+
* @returns {DealerKeygenResult}
|
|
309
|
+
*/
|
|
310
|
+
export function generate_with_dealer(max_signers, min_signers) {
|
|
311
|
+
const ret = wasm.generate_with_dealer(max_signers, min_signers);
|
|
312
|
+
if (ret[2]) {
|
|
313
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
314
|
+
}
|
|
315
|
+
return DealerKeygenResult.__wrap(ret[0]);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* @param {Uint8Array} secret_share_bytes
|
|
320
|
+
* @returns {Uint8Array}
|
|
321
|
+
*/
|
|
322
|
+
export function key_package_from_secret_share(secret_share_bytes) {
|
|
323
|
+
const ptr0 = passArray8ToWasm0(secret_share_bytes, wasm.__wbindgen_malloc);
|
|
324
|
+
const len0 = WASM_VECTOR_LEN;
|
|
325
|
+
const ret = wasm.key_package_from_secret_share(ptr0, len0);
|
|
326
|
+
if (ret[3]) {
|
|
327
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
328
|
+
}
|
|
329
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
330
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
331
|
+
return v2;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* @param {Uint8Array} key_package_bytes
|
|
336
|
+
* @returns {Round1CommitResult}
|
|
337
|
+
*/
|
|
338
|
+
export function round1_commit(key_package_bytes) {
|
|
339
|
+
const ptr0 = passArray8ToWasm0(key_package_bytes, wasm.__wbindgen_malloc);
|
|
340
|
+
const len0 = WASM_VECTOR_LEN;
|
|
341
|
+
const ret = wasm.round1_commit(ptr0, len0);
|
|
342
|
+
if (ret[2]) {
|
|
343
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
344
|
+
}
|
|
345
|
+
return Round1CommitResult.__wrap(ret[0]);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* @param {Uint8Array} signing_package_bytes
|
|
350
|
+
* @param {Uint8Array} nonces_bytes
|
|
351
|
+
* @param {Uint8Array} key_package_bytes
|
|
352
|
+
* @returns {Round2SignatureShareResult}
|
|
353
|
+
*/
|
|
354
|
+
export function round2_sign(signing_package_bytes, nonces_bytes, key_package_bytes) {
|
|
355
|
+
const ptr0 = passArray8ToWasm0(signing_package_bytes, wasm.__wbindgen_malloc);
|
|
356
|
+
const len0 = WASM_VECTOR_LEN;
|
|
357
|
+
const ptr1 = passArray8ToWasm0(nonces_bytes, wasm.__wbindgen_malloc);
|
|
358
|
+
const len1 = WASM_VECTOR_LEN;
|
|
359
|
+
const ptr2 = passArray8ToWasm0(key_package_bytes, wasm.__wbindgen_malloc);
|
|
360
|
+
const len2 = WASM_VECTOR_LEN;
|
|
361
|
+
const ret = wasm.round2_sign(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
362
|
+
if (ret[2]) {
|
|
363
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
364
|
+
}
|
|
365
|
+
return Round2SignatureShareResult.__wrap(ret[0]);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* @param {Uint8Array} public_key_package_bytes
|
|
370
|
+
* @param {Uint8Array} message
|
|
371
|
+
* @param {Uint8Array} signature_bytes
|
|
372
|
+
* @returns {boolean}
|
|
373
|
+
*/
|
|
374
|
+
export function verify_group_signature(public_key_package_bytes, message, signature_bytes) {
|
|
375
|
+
const ptr0 = passArray8ToWasm0(public_key_package_bytes, wasm.__wbindgen_malloc);
|
|
376
|
+
const len0 = WASM_VECTOR_LEN;
|
|
377
|
+
const ptr1 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);
|
|
378
|
+
const len1 = WASM_VECTOR_LEN;
|
|
379
|
+
const ptr2 = passArray8ToWasm0(signature_bytes, wasm.__wbindgen_malloc);
|
|
380
|
+
const len2 = WASM_VECTOR_LEN;
|
|
381
|
+
const ret = wasm.verify_group_signature(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
382
|
+
if (ret[2]) {
|
|
383
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
384
|
+
}
|
|
385
|
+
return ret[0] !== 0;
|
|
386
|
+
}
|
|
387
|
+
export function __wbg___wbindgen_is_function_3c846841762788c1(arg0) {
|
|
388
|
+
const ret = typeof(arg0) === 'function';
|
|
389
|
+
return ret;
|
|
390
|
+
}
|
|
391
|
+
export function __wbg___wbindgen_is_object_781bc9f159099513(arg0) {
|
|
392
|
+
const val = arg0;
|
|
393
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
394
|
+
return ret;
|
|
395
|
+
}
|
|
396
|
+
export function __wbg___wbindgen_is_string_7ef6b97b02428fae(arg0) {
|
|
397
|
+
const ret = typeof(arg0) === 'string';
|
|
398
|
+
return ret;
|
|
399
|
+
}
|
|
400
|
+
export function __wbg___wbindgen_is_undefined_52709e72fb9f179c(arg0) {
|
|
401
|
+
const ret = arg0 === undefined;
|
|
402
|
+
return ret;
|
|
403
|
+
}
|
|
404
|
+
export function __wbg___wbindgen_throw_6ddd609b62940d55(arg0, arg1) {
|
|
405
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
406
|
+
}
|
|
407
|
+
export function __wbg_call_2d781c1f4d5c0ef8() { return handleError(function (arg0, arg1, arg2) {
|
|
408
|
+
const ret = arg0.call(arg1, arg2);
|
|
409
|
+
return ret;
|
|
410
|
+
}, arguments); }
|
|
411
|
+
export function __wbg_crypto_48300657fced39f9(arg0) {
|
|
412
|
+
const ret = arg0.crypto;
|
|
413
|
+
return ret;
|
|
414
|
+
}
|
|
415
|
+
export function __wbg_getRandomValues_263d0aa5464054ee() { return handleError(function (arg0, arg1) {
|
|
416
|
+
arg0.getRandomValues(arg1);
|
|
417
|
+
}, arguments); }
|
|
418
|
+
export function __wbg_length_ea16607d7b61445b(arg0) {
|
|
419
|
+
const ret = arg0.length;
|
|
420
|
+
return ret;
|
|
421
|
+
}
|
|
422
|
+
export function __wbg_msCrypto_8c6d45a75ef1d3da(arg0) {
|
|
423
|
+
const ret = arg0.msCrypto;
|
|
424
|
+
return ret;
|
|
425
|
+
}
|
|
426
|
+
export function __wbg_new_with_length_825018a1616e9e55(arg0) {
|
|
427
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
428
|
+
return ret;
|
|
429
|
+
}
|
|
430
|
+
export function __wbg_node_95beb7570492fd97(arg0) {
|
|
431
|
+
const ret = arg0.node;
|
|
432
|
+
return ret;
|
|
433
|
+
}
|
|
434
|
+
export function __wbg_process_b2fea42461d03994(arg0) {
|
|
435
|
+
const ret = arg0.process;
|
|
436
|
+
return ret;
|
|
437
|
+
}
|
|
438
|
+
export function __wbg_prototypesetcall_d62e5099504357e6(arg0, arg1, arg2) {
|
|
439
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
440
|
+
}
|
|
441
|
+
export function __wbg_randomFillSync_ca9f178fb14c88cb() { return handleError(function (arg0, arg1) {
|
|
442
|
+
arg0.randomFillSync(arg1);
|
|
443
|
+
}, arguments); }
|
|
444
|
+
export function __wbg_require_7a9419e39d796c95() { return handleError(function () {
|
|
445
|
+
const ret = module.require;
|
|
446
|
+
return ret;
|
|
447
|
+
}, arguments); }
|
|
448
|
+
export function __wbg_static_accessor_GLOBAL_8adb955bd33fac2f() {
|
|
449
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
450
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
451
|
+
}
|
|
452
|
+
export function __wbg_static_accessor_GLOBAL_THIS_ad356e0db91c7913() {
|
|
453
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
454
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
455
|
+
}
|
|
456
|
+
export function __wbg_static_accessor_SELF_f207c857566db248() {
|
|
457
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
458
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
459
|
+
}
|
|
460
|
+
export function __wbg_static_accessor_WINDOW_bb9f1ba69d61b386() {
|
|
461
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
462
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
463
|
+
}
|
|
464
|
+
export function __wbg_subarray_a068d24e39478a8a(arg0, arg1, arg2) {
|
|
465
|
+
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
466
|
+
return ret;
|
|
467
|
+
}
|
|
468
|
+
export function __wbg_versions_215a3ab1c9d5745a(arg0) {
|
|
469
|
+
const ret = arg0.versions;
|
|
470
|
+
return ret;
|
|
471
|
+
}
|
|
472
|
+
export function __wbindgen_cast_0000000000000001(arg0, arg1) {
|
|
473
|
+
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
474
|
+
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
475
|
+
return ret;
|
|
476
|
+
}
|
|
477
|
+
export function __wbindgen_cast_0000000000000002(arg0, arg1) {
|
|
478
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
479
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
480
|
+
return ret;
|
|
481
|
+
}
|
|
482
|
+
export function __wbindgen_init_externref_table() {
|
|
483
|
+
const table = wasm.__wbindgen_externrefs;
|
|
484
|
+
const offset = table.grow(4);
|
|
485
|
+
table.set(0, undefined);
|
|
486
|
+
table.set(offset + 0, undefined);
|
|
487
|
+
table.set(offset + 1, null);
|
|
488
|
+
table.set(offset + 2, true);
|
|
489
|
+
table.set(offset + 3, false);
|
|
490
|
+
}
|
|
491
|
+
const CommitmentListFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
492
|
+
? { register: () => {}, unregister: () => {} }
|
|
493
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_commitmentlist_free(ptr >>> 0, 1));
|
|
494
|
+
const DealerKeygenResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
495
|
+
? { register: () => {}, unregister: () => {} }
|
|
496
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_dealerkeygenresult_free(ptr >>> 0, 1));
|
|
497
|
+
const DealerShareFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
498
|
+
? { register: () => {}, unregister: () => {} }
|
|
499
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_dealershare_free(ptr >>> 0, 1));
|
|
500
|
+
const Round1CommitResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
501
|
+
? { register: () => {}, unregister: () => {} }
|
|
502
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_round1commitresult_free(ptr >>> 0, 1));
|
|
503
|
+
const Round2SignatureShareResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
504
|
+
? { register: () => {}, unregister: () => {} }
|
|
505
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_round2signatureshareresult_free(ptr >>> 0, 1));
|
|
506
|
+
const SignatureShareListFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
507
|
+
? { register: () => {}, unregister: () => {} }
|
|
508
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_signaturesharelist_free(ptr >>> 0, 1));
|
|
509
|
+
|
|
510
|
+
function addToExternrefTable0(obj) {
|
|
511
|
+
const idx = wasm.__externref_table_alloc();
|
|
512
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
513
|
+
return idx;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
function _assertClass(instance, klass) {
|
|
517
|
+
if (!(instance instanceof klass)) {
|
|
518
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
523
|
+
ptr = ptr >>> 0;
|
|
524
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
function getStringFromWasm0(ptr, len) {
|
|
528
|
+
ptr = ptr >>> 0;
|
|
529
|
+
return decodeText(ptr, len);
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
let cachedUint8ArrayMemory0 = null;
|
|
533
|
+
function getUint8ArrayMemory0() {
|
|
534
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
535
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
536
|
+
}
|
|
537
|
+
return cachedUint8ArrayMemory0;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
function handleError(f, args) {
|
|
541
|
+
try {
|
|
542
|
+
return f.apply(this, args);
|
|
543
|
+
} catch (e) {
|
|
544
|
+
const idx = addToExternrefTable0(e);
|
|
545
|
+
wasm.__wbindgen_exn_store(idx);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
function isLikeNone(x) {
|
|
550
|
+
return x === undefined || x === null;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
554
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
555
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
556
|
+
WASM_VECTOR_LEN = arg.length;
|
|
557
|
+
return ptr;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
function takeFromExternrefTable0(idx) {
|
|
561
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
562
|
+
wasm.__externref_table_dealloc(idx);
|
|
563
|
+
return value;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
567
|
+
cachedTextDecoder.decode();
|
|
568
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
569
|
+
let numBytesDecoded = 0;
|
|
570
|
+
function decodeText(ptr, len) {
|
|
571
|
+
numBytesDecoded += len;
|
|
572
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
573
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
574
|
+
cachedTextDecoder.decode();
|
|
575
|
+
numBytesDecoded = len;
|
|
576
|
+
}
|
|
577
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
let WASM_VECTOR_LEN = 0;
|
|
581
|
+
|
|
582
|
+
|
|
583
|
+
let wasm;
|
|
584
|
+
export function __wbg_set_wasm(val) {
|
|
585
|
+
wasm = val;
|
|
586
|
+
}
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@myecoria/frost-ed25519-blake2b-wasm",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"description": "WASM bindings for frost-ed25519-blake2b",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"license": "MIT OR Apache-2.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/ZcashFoundation/frost"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"frost_ed25519_blake2b_wasm_bg.wasm",
|
|
13
|
+
"frost_ed25519_blake2b_wasm.js",
|
|
14
|
+
"frost_ed25519_blake2b_wasm_bg.js",
|
|
15
|
+
"frost_ed25519_blake2b_wasm.d.ts",
|
|
16
|
+
"LICENSE-Apache-2.0",
|
|
17
|
+
"LICENSE-MIT"
|
|
18
|
+
],
|
|
19
|
+
"main": "frost_ed25519_blake2b_wasm.js",
|
|
20
|
+
"types": "frost_ed25519_blake2b_wasm.d.ts",
|
|
21
|
+
"sideEffects": [
|
|
22
|
+
"./frost_ed25519_blake2b_wasm.js",
|
|
23
|
+
"./snippets/*"
|
|
24
|
+
]
|
|
25
|
+
}
|