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