@typeberry/native 0.0.1-fd03743 → 0.0.4-23cb00c
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 +81 -108
- package/index.js +211 -237
- 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
|
-
|
|
10
|
-
|
|
7
|
+
* Seal verification as defined in:
|
|
8
|
+
* https://graypaper.fluffylabs.dev/#/68eaa1f/0eff000eff00?v=0.6.4
|
|
9
|
+
* or
|
|
10
|
+
* https://graypaper.fluffylabs.dev/#/68eaa1f/0e54010e5401?v=0.6.4
|
|
11
|
+
*/
|
|
12
|
+
declare function verify_seal(signer_key: Uint8Array, seal_data: Uint8Array, payload: Uint8Array, aux_data: Uint8Array): Uint8Array;
|
|
11
13
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
declare function derive_public_key(seed: Uint8Array): Uint8Array;
|
|
14
|
+
* Verify multiple tickets at once as defined in:
|
|
15
|
+
* https://graypaper.fluffylabs.dev/#/68eaa1f/0f3e000f3e00?v=0.6.4
|
|
16
|
+
*
|
|
17
|
+
* NOTE: the aux_data of VRF function is empty!
|
|
18
|
+
*/
|
|
19
|
+
declare function batch_verify_tickets(ring_size: number, commitment: Uint8Array, tickets_data: Uint8Array, vrf_input_data_len: number): Uint8Array;
|
|
19
20
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* @param {number} signer_key_index
|
|
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;
|
|
21
|
+
* Derive Private and Public Key from Seed
|
|
22
|
+
*
|
|
23
|
+
* returns: `Vec<u8>` containing the exit (1 byte) status followed by the (32 bytes) public key
|
|
24
|
+
*/
|
|
25
|
+
declare function derive_public_key(seed: Uint8Array): Uint8Array;
|
|
32
26
|
/**
|
|
33
|
-
*
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
* NOTE: the aux_data of VRF function is empty!
|
|
37
|
-
* @param {Uint8Array} keys
|
|
38
|
-
* @param {Uint8Array} tickets_data
|
|
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;
|
|
27
|
+
* Generate ring commitment given concatenation of ring keys.
|
|
28
|
+
*/
|
|
29
|
+
declare function ring_commitment(keys: Uint8Array): 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
|
|
47
|
-
readonly derive_public_key: (a: number, b: number
|
|
48
|
-
readonly
|
|
49
|
-
readonly
|
|
50
|
-
readonly
|
|
33
|
+
readonly batch_verify_tickets: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
34
|
+
readonly derive_public_key: (a: number, b: number) => [number, number];
|
|
35
|
+
readonly ring_commitment: (a: number, b: number) => [number, number];
|
|
36
|
+
readonly verify_seal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: 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
|
}
|
|
@@ -78,18 +70,14 @@ declare namespace ed25519_wasm_d_exports {
|
|
|
78
70
|
/* eslint-disable */
|
|
79
71
|
/**
|
|
80
72
|
*
|
|
81
|
-
* * Verify Ed25519 signatures one by one
|
|
73
|
+
* * Verify Ed25519 signatures one by one.
|
|
82
74
|
* *
|
|
83
|
-
* *
|
|
84
|
-
*
|
|
75
|
+
* * ed25519-consensus always does strict verification (ZIP-215 compatible).
|
|
85
76
|
*/
|
|
86
77
|
declare function verify_ed25519(data: Uint8Array): Uint8Array;
|
|
87
78
|
/**
|
|
88
79
|
*
|
|
89
|
-
* *
|
|
90
|
-
* *
|
|
91
|
-
* * This function is faster but does not do strict verification.
|
|
92
|
-
* * See https://crates.io/crates/ed25519-dalek#batch-verification for more information.
|
|
80
|
+
* * ed25519-consensus doesn't have built-in batch verification.
|
|
93
81
|
*
|
|
94
82
|
*/
|
|
95
83
|
declare function verify_ed25519_batch(data: Uint8Array): boolean;
|
|
@@ -132,82 +120,67 @@ declare namespace reed_solomon_wasm_d_exports {
|
|
|
132
120
|
}
|
|
133
121
|
/* tslint:disable */
|
|
134
122
|
/* eslint-disable */
|
|
135
|
-
/**
|
|
136
|
-
* @param {number} recovery_count
|
|
137
|
-
* @param {ShardsCollection} shards
|
|
138
|
-
* @returns {ShardsCollection}
|
|
139
|
-
*/
|
|
140
123
|
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
124
|
declare function decode(original_count: number, recovery_count: number, shards: ShardsCollection): ShardsCollection;
|
|
148
125
|
/**
|
|
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
|
-
*/
|
|
126
|
+
* Collection of shards (either input or output).
|
|
127
|
+
*
|
|
128
|
+
* To efficiently pass data between JS and WASM all of the shards
|
|
129
|
+
* are passed as one big vector of bytes.
|
|
130
|
+
* It's assumed that every shard has the same length (`shard_len`).
|
|
131
|
+
* If the shards are NOT passed in the exact order they were created
|
|
132
|
+
* it's possible to pass `indices` array.
|
|
133
|
+
* A value of `indices` array at position `idx` is the shard index
|
|
134
|
+
* that resides at `[ idx * shard_len .. idx * shard_len + shard_len )`
|
|
135
|
+
* in `data` array.
|
|
136
|
+
*
|
|
137
|
+
* This collection is only used to get the data from JS or pass the data back.
|
|
138
|
+
* Internally we convert it to [`RsShardsCollection`], which copies
|
|
139
|
+
* the memory to/from WASM.
|
|
140
|
+
*/
|
|
164
141
|
declare class ShardsCollection {
|
|
165
142
|
free(): void;
|
|
166
143
|
/**
|
|
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
|
-
*/
|
|
144
|
+
* Extract the `indices` from this shards container.
|
|
145
|
+
*
|
|
146
|
+
* Should be called on the JS side to avoid copying.
|
|
147
|
+
* NOTE that subsequent calls to that method will return `None`.
|
|
148
|
+
*/
|
|
179
149
|
take_indices(): Uint16Array | undefined;
|
|
150
|
+
constructor(shard_len: number, data: Uint8Array, indices?: Uint16Array | null);
|
|
180
151
|
/**
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
*/
|
|
152
|
+
* Take the underlying `data` to the JS side.
|
|
153
|
+
*
|
|
154
|
+
* NOTE this object is destroyed after the data is consumed,
|
|
155
|
+
* so make sure to [`take_indices`] first.
|
|
156
|
+
*/
|
|
187
157
|
take_data(): Uint8Array;
|
|
188
158
|
/**
|
|
189
|
-
|
|
190
|
-
|
|
159
|
+
* Number of shards within the collection.
|
|
160
|
+
*/
|
|
191
161
|
length: number;
|
|
192
162
|
/**
|
|
193
|
-
|
|
194
|
-
|
|
163
|
+
* The length of each shard.
|
|
164
|
+
*/
|
|
195
165
|
shard_len: number;
|
|
196
166
|
}
|
|
197
167
|
type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
198
168
|
interface InitOutput {
|
|
199
169
|
readonly memory: WebAssembly.Memory;
|
|
200
|
-
readonly __wbg_shardscollection_free: (a: number, b: number) => void;
|
|
201
170
|
readonly __wbg_get_shardscollection_length: (a: number) => number;
|
|
202
|
-
readonly __wbg_set_shardscollection_length: (a: number, b: number) => void;
|
|
203
171
|
readonly __wbg_get_shardscollection_shard_len: (a: number) => number;
|
|
172
|
+
readonly __wbg_set_shardscollection_length: (a: number, b: number) => void;
|
|
204
173
|
readonly __wbg_set_shardscollection_shard_len: (a: number, b: number) => void;
|
|
205
|
-
readonly
|
|
206
|
-
readonly
|
|
207
|
-
readonly
|
|
208
|
-
readonly
|
|
209
|
-
readonly
|
|
210
|
-
readonly
|
|
174
|
+
readonly __wbg_shardscollection_free: (a: number, b: number) => void;
|
|
175
|
+
readonly decode: (a: number, b: number, c: number) => [number, number, number];
|
|
176
|
+
readonly encode: (a: number, b: number) => [number, number, number];
|
|
177
|
+
readonly shardscollection_new: (a: number, b: any, c: number) => number;
|
|
178
|
+
readonly shardscollection_take_data: (a: number) => any;
|
|
179
|
+
readonly shardscollection_take_indices: (a: number) => any;
|
|
180
|
+
readonly __wbindgen_export_0: WebAssembly.Table;
|
|
181
|
+
readonly __externref_table_alloc: () => number;
|
|
182
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
183
|
+
readonly __wbindgen_start: () => void;
|
|
211
184
|
}
|
|
212
185
|
type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
213
186
|
/**
|
|
@@ -237,9 +210,9 @@ declare function __wbg_init(module_or_path?: {
|
|
|
237
210
|
//#region native/index.d.ts
|
|
238
211
|
declare function initAll(): Promise<void>;
|
|
239
212
|
declare const init: {
|
|
240
|
-
bandersnatch:
|
|
241
|
-
ed25519:
|
|
242
|
-
reedSolomon:
|
|
213
|
+
bandersnatch: any;
|
|
214
|
+
ed25519: any;
|
|
215
|
+
reedSolomon: any;
|
|
243
216
|
};
|
|
244
217
|
//#endregion
|
|
245
218
|
export { bandersnatch_d_exports as bandersnatch, ed25519_wasm_d_exports as ed25519, init, initAll, reed_solomon_wasm_d_exports as reedSolomon };
|