@typeberry/native 0.0.1-52b20cd → 0.0.1-6d5d1ff
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/index.d.ts +84 -102
- package/index.js +258 -218
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,76 +1,72 @@
|
|
|
1
1
|
declare namespace bandersnatch_d_exports {
|
|
2
|
-
export { InitInput$2 as InitInput, InitOutput$2 as InitOutput, SyncInitInput$2 as SyncInitInput, batch_verify_tickets, __wbg_init$2 as default, derive_public_key, initSync$2 as initSync, ring_commitment, verify_seal };
|
|
2
|
+
export { InitInput$2 as InitInput, InitOutput$2 as InitOutput, SyncInitInput$2 as SyncInitInput, WasmVerifier, batch_verify_tickets, __wbg_init$2 as default, derive_public_key, initSync$2 as initSync, ring_commitment, verifier, verify_seal };
|
|
3
3
|
}
|
|
4
4
|
/* tslint:disable */
|
|
5
5
|
/* eslint-disable */
|
|
6
|
+
declare function verifier(keys: Uint8Array): WasmVerifier;
|
|
7
|
+
declare function ring_commitment(verifier: WasmVerifier): Uint8Array;
|
|
6
8
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Derive Private and Public Key from Seed
|
|
13
|
-
*
|
|
14
|
-
* returns: `Vec<u8>` containing the exit (1 byte) status followed by the (32 bytes) public key
|
|
15
|
-
* @param {Uint8Array} seed
|
|
16
|
-
* @returns {Uint8Array}
|
|
17
|
-
*/
|
|
9
|
+
* Derive Private and Public Key from Seed
|
|
10
|
+
*
|
|
11
|
+
* returns: `Vec<u8>` containing the exit (1 byte) status followed by the (32 bytes) public key
|
|
12
|
+
*/
|
|
18
13
|
declare function derive_public_key(seed: Uint8Array): Uint8Array;
|
|
19
14
|
/**
|
|
20
|
-
* Seal verification as defined in:
|
|
21
|
-
* https://graypaper.fluffylabs.dev/#/68eaa1f/0eff000eff00?v=0.6.4
|
|
22
|
-
* or
|
|
23
|
-
* https://graypaper.fluffylabs.dev/#/68eaa1f/0e54010e5401?v=0.6.4
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* @param {Uint8Array} seal_data
|
|
27
|
-
* @param {Uint8Array} payload
|
|
28
|
-
* @param {Uint8Array} aux_data
|
|
29
|
-
* @returns {Uint8Array}
|
|
30
|
-
*/
|
|
31
|
-
declare function verify_seal(keys: Uint8Array, signer_key_index: number, seal_data: Uint8Array, payload: Uint8Array, aux_data: Uint8Array): Uint8Array;
|
|
15
|
+
* Seal verification as defined in:
|
|
16
|
+
* https://graypaper.fluffylabs.dev/#/68eaa1f/0eff000eff00?v=0.6.4
|
|
17
|
+
* or
|
|
18
|
+
* https://graypaper.fluffylabs.dev/#/68eaa1f/0e54010e5401?v=0.6.4
|
|
19
|
+
*/
|
|
20
|
+
declare function verify_seal(verifier: WasmVerifier, signer_key_index: number, seal_data: Uint8Array, payload: Uint8Array, aux_data: Uint8Array): Uint8Array;
|
|
32
21
|
/**
|
|
33
|
-
* Verify multiple tickets at once as defined in:
|
|
34
|
-
* https://graypaper.fluffylabs.dev/#/68eaa1f/0f3e000f3e00?v=0.6.4
|
|
35
|
-
*
|
|
36
|
-
* NOTE: the aux_data of VRF function is empty!
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
22
|
+
* Verify multiple tickets at once as defined in:
|
|
23
|
+
* https://graypaper.fluffylabs.dev/#/68eaa1f/0f3e000f3e00?v=0.6.4
|
|
24
|
+
*
|
|
25
|
+
* NOTE: the aux_data of VRF function is empty!
|
|
26
|
+
*/
|
|
27
|
+
declare function batch_verify_tickets(verifier: WasmVerifier, tickets_data: Uint8Array, vrf_input_data_len: number): Uint8Array;
|
|
28
|
+
declare class WasmVerifier {
|
|
29
|
+
private constructor();
|
|
30
|
+
free(): void;
|
|
31
|
+
}
|
|
43
32
|
type InitInput$2 = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
44
33
|
interface InitOutput$2 {
|
|
45
34
|
readonly memory: WebAssembly.Memory;
|
|
46
|
-
readonly
|
|
47
|
-
readonly
|
|
48
|
-
readonly
|
|
49
|
-
readonly
|
|
50
|
-
readonly
|
|
35
|
+
readonly __wbg_wasmverifier_free: (a: number, b: number) => void;
|
|
36
|
+
readonly verifier: (a: number, b: number) => number;
|
|
37
|
+
readonly ring_commitment: (a: number) => [number, number];
|
|
38
|
+
readonly derive_public_key: (a: number, b: number) => [number, number];
|
|
39
|
+
readonly verify_seal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
|
40
|
+
readonly batch_verify_tickets: (a: number, b: number, c: number, d: number) => [number, number];
|
|
41
|
+
readonly __wbindgen_export_0: WebAssembly.Table;
|
|
51
42
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
52
43
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
44
|
+
readonly __wbindgen_start: () => void;
|
|
53
45
|
}
|
|
54
46
|
type SyncInitInput$2 = BufferSource | WebAssembly.Module;
|
|
55
47
|
/**
|
|
56
48
|
* Instantiates the given `module`, which can either be bytes or
|
|
57
49
|
* a precompiled `WebAssembly.Module`.
|
|
58
50
|
*
|
|
59
|
-
* @param {SyncInitInput} module
|
|
51
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
60
52
|
*
|
|
61
53
|
* @returns {InitOutput}
|
|
62
54
|
*/
|
|
63
|
-
declare function initSync$2(module:
|
|
55
|
+
declare function initSync$2(module: {
|
|
56
|
+
module: SyncInitInput$2;
|
|
57
|
+
} | SyncInitInput$2): InitOutput$2;
|
|
64
58
|
|
|
65
59
|
/**
|
|
66
60
|
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
67
61
|
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
68
62
|
*
|
|
69
|
-
* @param {InitInput | Promise<InitInput>} module_or_path
|
|
63
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
70
64
|
*
|
|
71
65
|
* @returns {Promise<InitOutput>}
|
|
72
66
|
*/
|
|
73
|
-
declare function __wbg_init$2(module_or_path?:
|
|
67
|
+
declare function __wbg_init$2(module_or_path?: {
|
|
68
|
+
module_or_path: InitInput$2 | Promise<InitInput$2>;
|
|
69
|
+
} | InitInput$2 | Promise<InitInput$2>): Promise<InitOutput$2>;
|
|
74
70
|
declare namespace ed25519_wasm_d_exports {
|
|
75
71
|
export { InitInput$1 as InitInput, InitOutput$1 as InitOutput, SyncInitInput$1 as SyncInitInput, __wbg_init$1 as default, initSync$1 as initSync, verify_ed25519, verify_ed25519_batch };
|
|
76
72
|
}
|
|
@@ -132,66 +128,48 @@ declare namespace reed_solomon_wasm_d_exports {
|
|
|
132
128
|
}
|
|
133
129
|
/* tslint:disable */
|
|
134
130
|
/* eslint-disable */
|
|
135
|
-
/**
|
|
136
|
-
* @param {number} recovery_count
|
|
137
|
-
* @param {ShardsCollection} shards
|
|
138
|
-
* @returns {ShardsCollection}
|
|
139
|
-
*/
|
|
140
131
|
declare function encode(recovery_count: number, shards: ShardsCollection): ShardsCollection;
|
|
141
|
-
/**
|
|
142
|
-
* @param {number} original_count
|
|
143
|
-
* @param {number} recovery_count
|
|
144
|
-
* @param {ShardsCollection} shards
|
|
145
|
-
* @returns {ShardsCollection}
|
|
146
|
-
*/
|
|
147
132
|
declare function decode(original_count: number, recovery_count: number, shards: ShardsCollection): ShardsCollection;
|
|
148
133
|
/**
|
|
149
|
-
* Collection of shards (either input or output).
|
|
150
|
-
*
|
|
151
|
-
* To efficiently pass data between JS and WASM all of the shards
|
|
152
|
-
* are passed as one big vector of bytes.
|
|
153
|
-
* It's assumed that every shard has the same length (`shard_len`).
|
|
154
|
-
* If the shards are NOT passed in the exact order they were created
|
|
155
|
-
* it's possible to pass `indices` array.
|
|
156
|
-
* A value of `indices` array at position `idx` is the shard index
|
|
157
|
-
* that resides at `[ idx * shard_len .. idx * shard_len + shard_len )`
|
|
158
|
-
* in `data` array.
|
|
159
|
-
*
|
|
160
|
-
* This collection is only used to get the data from JS or pass the data back.
|
|
161
|
-
* Internally we convert it to [`RsShardsCollection`], which copies
|
|
162
|
-
* the memory to/from WASM.
|
|
163
|
-
*/
|
|
134
|
+
* Collection of shards (either input or output).
|
|
135
|
+
*
|
|
136
|
+
* To efficiently pass data between JS and WASM all of the shards
|
|
137
|
+
* are passed as one big vector of bytes.
|
|
138
|
+
* It's assumed that every shard has the same length (`shard_len`).
|
|
139
|
+
* If the shards are NOT passed in the exact order they were created
|
|
140
|
+
* it's possible to pass `indices` array.
|
|
141
|
+
* A value of `indices` array at position `idx` is the shard index
|
|
142
|
+
* that resides at `[ idx * shard_len .. idx * shard_len + shard_len )`
|
|
143
|
+
* in `data` array.
|
|
144
|
+
*
|
|
145
|
+
* This collection is only used to get the data from JS or pass the data back.
|
|
146
|
+
* Internally we convert it to [`RsShardsCollection`], which copies
|
|
147
|
+
* the memory to/from WASM.
|
|
148
|
+
*/
|
|
164
149
|
declare class ShardsCollection {
|
|
165
150
|
free(): void;
|
|
151
|
+
constructor(shard_len: number, data: Uint8Array, indices?: Uint16Array | null);
|
|
166
152
|
/**
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Extract the `indices` from this shards container.
|
|
174
|
-
*
|
|
175
|
-
* Should be called on the JS side to avoid copying.
|
|
176
|
-
* NOTE that subsequent calls to that method will return `None`.
|
|
177
|
-
* @returns {Uint16Array | undefined}
|
|
178
|
-
*/
|
|
153
|
+
* Extract the `indices` from this shards container.
|
|
154
|
+
*
|
|
155
|
+
* Should be called on the JS side to avoid copying.
|
|
156
|
+
* NOTE that subsequent calls to that method will return `None`.
|
|
157
|
+
*/
|
|
179
158
|
take_indices(): Uint16Array | undefined;
|
|
180
159
|
/**
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
*/
|
|
160
|
+
* Take the underlying `data` to the JS side.
|
|
161
|
+
*
|
|
162
|
+
* NOTE this object is destroyed after the data is consumed,
|
|
163
|
+
* so make sure to [`take_indices`] first.
|
|
164
|
+
*/
|
|
187
165
|
take_data(): Uint8Array;
|
|
188
166
|
/**
|
|
189
|
-
|
|
190
|
-
|
|
167
|
+
* Number of shards within the collection.
|
|
168
|
+
*/
|
|
191
169
|
length: number;
|
|
192
170
|
/**
|
|
193
|
-
|
|
194
|
-
|
|
171
|
+
* The length of each shard.
|
|
172
|
+
*/
|
|
195
173
|
shard_len: number;
|
|
196
174
|
}
|
|
197
175
|
type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
@@ -202,12 +180,15 @@ interface InitOutput {
|
|
|
202
180
|
readonly __wbg_set_shardscollection_length: (a: number, b: number) => void;
|
|
203
181
|
readonly __wbg_get_shardscollection_shard_len: (a: number) => number;
|
|
204
182
|
readonly __wbg_set_shardscollection_shard_len: (a: number, b: number) => void;
|
|
205
|
-
readonly shardscollection_new: (a: number, b:
|
|
206
|
-
readonly shardscollection_take_indices: (a: number) =>
|
|
207
|
-
readonly shardscollection_take_data: (a: number) =>
|
|
208
|
-
readonly encode: (a: number, b: number
|
|
209
|
-
readonly decode: (a: number, b: number, c: number
|
|
210
|
-
readonly
|
|
183
|
+
readonly shardscollection_new: (a: number, b: any, c: number) => number;
|
|
184
|
+
readonly shardscollection_take_indices: (a: number) => any;
|
|
185
|
+
readonly shardscollection_take_data: (a: number) => any;
|
|
186
|
+
readonly encode: (a: number, b: number) => [number, number, number];
|
|
187
|
+
readonly decode: (a: number, b: number, c: number) => [number, number, number];
|
|
188
|
+
readonly __wbindgen_export_0: WebAssembly.Table;
|
|
189
|
+
readonly __externref_table_alloc: () => number;
|
|
190
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
191
|
+
readonly __wbindgen_start: () => void;
|
|
211
192
|
}
|
|
212
193
|
type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
213
194
|
/**
|
|
@@ -235,10 +216,11 @@ declare function __wbg_init(module_or_path?: {
|
|
|
235
216
|
} | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
236
217
|
//#endregion
|
|
237
218
|
//#region native/index.d.ts
|
|
238
|
-
declare
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
219
|
+
declare function initAll(): Promise<void>;
|
|
220
|
+
declare const init: {
|
|
221
|
+
bandersnatch: () => Promise<InitOutput$2>;
|
|
222
|
+
ed25519: () => Promise<InitOutput$1>;
|
|
223
|
+
reedSolomon: () => Promise<InitOutput>;
|
|
242
224
|
};
|
|
243
225
|
//#endregion
|
|
244
|
-
export { bandersnatch_d_exports as bandersnatch, ed25519_wasm_d_exports as ed25519, reed_solomon_wasm_d_exports as reedSolomon
|
|
226
|
+
export { bandersnatch_d_exports as bandersnatch, ed25519_wasm_d_exports as ed25519, init, initAll, reed_solomon_wasm_d_exports as reedSolomon };
|