@typeberry/native 0.0.4-23cb00c → 0.0.4-4c0cd28

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 +54 -10
  2. package/index.js +136 -35
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1,8 +1,40 @@
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, vrf_output_hash };
3
3
  }
4
4
  /* tslint:disable */
5
5
  /* eslint-disable */
6
+ /**
7
+ * Compute VRF output hash from a secret seed and input data.
8
+ *
9
+ * This function derives a deterministic VRF output hash without generating a proof.
10
+ * Unlike `generate_seal`, this produces only the output hash, not a verifiable signature.
11
+ *
12
+ * # Arguments
13
+ * * `secret_seed` - Seed used to derive the secret key
14
+ * * `input` - VRF input data to be hashed
15
+ *
16
+ * # Returns
17
+ * A byte vector with the following format:
18
+ * - On success (33 bytes):
19
+ * - Byte 0: Status code `0` (RESULT_OK)
20
+ * - Bytes 1-32: VRF output hash (32 bytes)
21
+ * - On error (1 byte):
22
+ * - Byte 0: Status code `1` (RESULT_ERR)
23
+ *
24
+ * Returns an error if the input cannot be converted to a valid VRF input point.
25
+ */
26
+ declare function vrf_output_hash(secret_seed: Uint8Array, input: Uint8Array): Uint8Array;
27
+ /**
28
+ * Verify multiple tickets at once as defined in:
29
+ * https://graypaper.fluffylabs.dev/#/68eaa1f/0f3e000f3e00?v=0.6.4
30
+ *
31
+ * NOTE: the aux_data of VRF function is empty!
32
+ */
33
+ declare function batch_verify_tickets(ring_size: number, commitment: Uint8Array, tickets_data: Uint8Array, vrf_input_data_len: number): Uint8Array;
34
+ /**
35
+ * Generate ring commitment given concatenation of ring keys.
36
+ */
37
+ declare function ring_commitment(keys: Uint8Array): Uint8Array;
6
38
  /**
7
39
  * Seal verification as defined in:
8
40
  * https://graypaper.fluffylabs.dev/#/68eaa1f/0eff000eff00?v=0.6.4
@@ -11,29 +43,41 @@ declare namespace bandersnatch_d_exports {
11
43
  */
12
44
  declare function verify_seal(signer_key: Uint8Array, seal_data: Uint8Array, payload: Uint8Array, aux_data: Uint8Array): Uint8Array;
13
45
  /**
14
- * Verify multiple tickets at once as defined in:
15
- * https://graypaper.fluffylabs.dev/#/68eaa1f/0f3e000f3e00?v=0.6.4
46
+ * Generate seal that is verifiable using `verify_seal` function.
16
47
  *
17
- * NOTE: the aux_data of VRF function is empty!
48
+ * # Arguments
49
+ * * `secret_seed` - Seed used to derive the secret key
50
+ * * `input` - VRF input data
51
+ * * `aux_data` - Auxiliary data for the VRF proof
52
+ *
53
+ * # Returns
54
+ * A byte vector with the following format:
55
+ * - On success (97 bytes):
56
+ * - Byte 0: Status code `0` (RESULT_OK)
57
+ * - Bytes 1-32: Serialized VRF output (32 bytes, compressed) NOTE: not output hash!
58
+ * - Bytes 33-96: Serialized IETF VRF proof (64 bytes, compressed)
59
+ * - On error (1 byte):
60
+ * - Byte 0: Status code `1` (RESULT_ERR)
61
+ *
62
+ * Returns an error if the input cannot be converted to a valid VRF input point
63
+ * or if serialization of the output or proof fails.
18
64
  */
19
- declare function batch_verify_tickets(ring_size: number, commitment: Uint8Array, tickets_data: Uint8Array, vrf_input_data_len: number): Uint8Array;
65
+ declare function generate_seal(secret_seed: Uint8Array, input: Uint8Array, aux_data: Uint8Array): Uint8Array;
20
66
  /**
21
67
  * Derive Private and Public Key from Seed
22
68
  *
23
69
  * returns: `Vec<u8>` containing the exit (1 byte) status followed by the (32 bytes) public key
24
70
  */
25
71
  declare function derive_public_key(seed: Uint8Array): Uint8Array;
26
- /**
27
- * Generate ring commitment given concatenation of ring keys.
28
- */
29
- declare function ring_commitment(keys: Uint8Array): Uint8Array;
30
72
  type InitInput$2 = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
31
73
  interface InitOutput$2 {
32
74
  readonly memory: WebAssembly.Memory;
33
75
  readonly batch_verify_tickets: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
34
76
  readonly derive_public_key: (a: number, b: number) => [number, number];
77
+ readonly generate_seal: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
35
78
  readonly ring_commitment: (a: number, b: number) => [number, number];
36
79
  readonly verify_seal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
80
+ readonly vrf_output_hash: (a: number, b: number, c: number, d: number) => [number, number];
37
81
  readonly __wbindgen_export_0: WebAssembly.Table;
38
82
  readonly __wbindgen_malloc: (a: number, b: number) => number;
39
83
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
@@ -120,8 +164,8 @@ declare namespace reed_solomon_wasm_d_exports {
120
164
  }
121
165
  /* tslint:disable */
122
166
  /* eslint-disable */
123
- declare function encode(recovery_count: number, shards: ShardsCollection): ShardsCollection;
124
167
  declare function decode(original_count: number, recovery_count: number, shards: ShardsCollection): ShardsCollection;
168
+ declare function encode(recovery_count: number, shards: ShardsCollection): ShardsCollection;
125
169
  /**
126
170
  * Collection of shards (either input or output).
127
171
  *