@typeberry/native 0.0.4-c369217 → 0.0.4-e18a946

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.
Files changed (3) hide show
  1. package/index.d.ts +43 -25
  2. package/index.js +102 -69
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1,25 +1,42 @@
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, batch_verify_tickets, __wbg_init$2 as default, derive_public_key, generate_seal, initSync$2 as initSync, ring_commitment, verify_seal };
3
3
  }
4
4
  /* tslint:disable */
5
5
  /* eslint-disable */
6
6
  /**
7
- * Generate ring commitment given concatenation of ring keys.
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
8
11
  */
9
- declare function ring_commitment(keys: Uint8Array): Uint8Array;
12
+ declare function verify_seal(signer_key: Uint8Array, seal_data: Uint8Array, payload: Uint8Array, aux_data: Uint8Array): Uint8Array;
13
+ /**
14
+ * Generate seal that is verifiable using `verify_seal` function.
15
+ *
16
+ * # Arguments
17
+ * * `secret_seed` - Seed used to derive the secret key
18
+ * * `input` - VRF input data
19
+ * * `aux_data` - Auxiliary data for the VRF proof
20
+ *
21
+ * # Returns
22
+ * A byte vector with the following format:
23
+ * - On success (97 bytes):
24
+ * - Byte 0: Status code `0` (RESULT_OK)
25
+ * - Bytes 1-32: Serialized VRF output (32 bytes, compressed)
26
+ * - Bytes 33-96: Serialized IETF VRF proof (64 bytes, compressed)
27
+ * - On error (1 byte):
28
+ * - Byte 0: Status code `1` (RESULT_ERR)
29
+ *
30
+ * Returns an error if the input cannot be converted to a valid VRF input point
31
+ * or if serialization of the output or proof fails.
32
+ */
33
+ declare function generate_seal(secret_seed: Uint8Array, input: Uint8Array, aux_data: Uint8Array): Uint8Array;
10
34
  /**
11
35
  * Derive Private and Public Key from Seed
12
36
  *
13
37
  * returns: `Vec<u8>` containing the exit (1 byte) status followed by the (32 bytes) public key
14
38
  */
15
39
  declare function derive_public_key(seed: Uint8Array): Uint8Array;
16
- /**
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;
23
40
  /**
24
41
  * Verify multiple tickets at once as defined in:
25
42
  * https://graypaper.fluffylabs.dev/#/68eaa1f/0f3e000f3e00?v=0.6.4
@@ -27,13 +44,18 @@ declare function verify_seal(signer_key: Uint8Array, seal_data: Uint8Array, payl
27
44
  * NOTE: the aux_data of VRF function is empty!
28
45
  */
29
46
  declare function batch_verify_tickets(ring_size: number, commitment: Uint8Array, tickets_data: Uint8Array, vrf_input_data_len: number): Uint8Array;
47
+ /**
48
+ * Generate ring commitment given concatenation of ring keys.
49
+ */
50
+ declare function ring_commitment(keys: Uint8Array): Uint8Array;
30
51
  type InitInput$2 = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
31
52
  interface InitOutput$2 {
32
53
  readonly memory: WebAssembly.Memory;
33
- readonly ring_commitment: (a: number, b: number) => [number, number];
54
+ readonly batch_verify_tickets: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
34
55
  readonly derive_public_key: (a: number, b: number) => [number, number];
56
+ readonly generate_seal: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
57
+ readonly ring_commitment: (a: number, b: number) => [number, number];
35
58
  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
59
  readonly __wbindgen_export_0: WebAssembly.Table;
38
60
  readonly __wbindgen_malloc: (a: number, b: number) => number;
39
61
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
@@ -70,18 +92,14 @@ declare namespace ed25519_wasm_d_exports {
70
92
  /* eslint-disable */
71
93
  /**
72
94
  *
73
- * * Verify Ed25519 signatures one by one using strict verification.
95
+ * * Verify Ed25519 signatures one by one.
74
96
  * *
75
- * * This function is slower but does strict verification.
76
- *
97
+ * * ed25519-consensus always does strict verification (ZIP-215 compatible).
77
98
  */
78
99
  declare function verify_ed25519(data: Uint8Array): Uint8Array;
79
100
  /**
80
101
  *
81
- * * Verify Ed25519 signatures using build-in batch verification.
82
- * *
83
- * * This function is faster but does not do strict verification.
84
- * * See https://crates.io/crates/ed25519-dalek#batch-verification for more information.
102
+ * * ed25519-consensus doesn't have built-in batch verification.
85
103
  *
86
104
  */
87
105
  declare function verify_ed25519_batch(data: Uint8Array): boolean;
@@ -144,7 +162,6 @@ declare function decode(original_count: number, recovery_count: number, shards:
144
162
  */
145
163
  declare class ShardsCollection {
146
164
  free(): void;
147
- constructor(shard_len: number, data: Uint8Array, indices?: Uint16Array | null);
148
165
  /**
149
166
  * Extract the `indices` from this shards container.
150
167
  *
@@ -152,6 +169,7 @@ declare class ShardsCollection {
152
169
  * NOTE that subsequent calls to that method will return `None`.
153
170
  */
154
171
  take_indices(): Uint16Array | undefined;
172
+ constructor(shard_len: number, data: Uint8Array, indices?: Uint16Array | null);
155
173
  /**
156
174
  * Take the underlying `data` to the JS side.
157
175
  *
@@ -171,16 +189,16 @@ declare class ShardsCollection {
171
189
  type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
172
190
  interface InitOutput {
173
191
  readonly memory: WebAssembly.Memory;
174
- readonly __wbg_shardscollection_free: (a: number, b: number) => void;
175
192
  readonly __wbg_get_shardscollection_length: (a: number) => number;
176
- readonly __wbg_set_shardscollection_length: (a: number, b: number) => void;
177
193
  readonly __wbg_get_shardscollection_shard_len: (a: number) => number;
194
+ readonly __wbg_set_shardscollection_length: (a: number, b: number) => void;
178
195
  readonly __wbg_set_shardscollection_shard_len: (a: number, b: number) => void;
196
+ readonly __wbg_shardscollection_free: (a: number, b: number) => void;
197
+ readonly decode: (a: number, b: number, c: number) => [number, number, number];
198
+ readonly encode: (a: number, b: number) => [number, number, number];
179
199
  readonly shardscollection_new: (a: number, b: any, c: number) => number;
180
- readonly shardscollection_take_indices: (a: number) => any;
181
200
  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];
201
+ readonly shardscollection_take_indices: (a: number) => any;
184
202
  readonly __wbindgen_export_0: WebAssembly.Table;
185
203
  readonly __externref_table_alloc: () => number;
186
204
  readonly __externref_table_dealloc: (a: number) => void;