@typeberry/native 0.0.4-23cb00c → 0.0.4-51b82bc

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 +45 -1
  2. package/index.js +73 -2
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
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 */
@@ -17,12 +17,54 @@ declare function verify_seal(signer_key: Uint8Array, seal_data: Uint8Array, payl
17
17
  * NOTE: the aux_data of VRF function is empty!
18
18
  */
19
19
  declare function batch_verify_tickets(ring_size: number, commitment: Uint8Array, tickets_data: Uint8Array, vrf_input_data_len: number): Uint8Array;
20
+ /**
21
+ * Generate seal that is verifiable using `verify_seal` function.
22
+ *
23
+ * # Arguments
24
+ * * `secret_seed` - Seed used to derive the secret key
25
+ * * `input` - VRF input data
26
+ * * `aux_data` - Auxiliary data for the VRF proof
27
+ *
28
+ * # Returns
29
+ * A byte vector with the following format:
30
+ * - On success (97 bytes):
31
+ * - Byte 0: Status code `0` (RESULT_OK)
32
+ * - Bytes 1-32: Serialized VRF output (32 bytes, compressed) NOTE: not output hash!
33
+ * - Bytes 33-96: Serialized IETF VRF proof (64 bytes, compressed)
34
+ * - On error (1 byte):
35
+ * - Byte 0: Status code `1` (RESULT_ERR)
36
+ *
37
+ * Returns an error if the input cannot be converted to a valid VRF input point
38
+ * or if serialization of the output or proof fails.
39
+ */
40
+ declare function generate_seal(secret_seed: Uint8Array, input: Uint8Array, aux_data: Uint8Array): Uint8Array;
20
41
  /**
21
42
  * Derive Private and Public Key from Seed
22
43
  *
23
44
  * returns: `Vec<u8>` containing the exit (1 byte) status followed by the (32 bytes) public key
24
45
  */
25
46
  declare function derive_public_key(seed: Uint8Array): Uint8Array;
47
+ /**
48
+ * Compute VRF output hash from a secret seed and input data.
49
+ *
50
+ * This function derives a deterministic VRF output hash without generating a proof.
51
+ * Unlike `generate_seal`, this produces only the output hash, not a verifiable signature.
52
+ *
53
+ * # Arguments
54
+ * * `secret_seed` - Seed used to derive the secret key
55
+ * * `input` - VRF input data to be hashed
56
+ *
57
+ * # Returns
58
+ * A byte vector with the following format:
59
+ * - On success (33 bytes):
60
+ * - Byte 0: Status code `0` (RESULT_OK)
61
+ * - Bytes 1-32: VRF output hash (32 bytes)
62
+ * - On error (1 byte):
63
+ * - Byte 0: Status code `1` (RESULT_ERR)
64
+ *
65
+ * Returns an error if the input cannot be converted to a valid VRF input point.
66
+ */
67
+ declare function vrf_output_hash(secret_seed: Uint8Array, input: Uint8Array): Uint8Array;
26
68
  /**
27
69
  * Generate ring commitment given concatenation of ring keys.
28
70
  */
@@ -32,8 +74,10 @@ 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;