@typeberry/native 0.0.4-86135cc → 0.0.4-92ff682
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 +51 -29
- package/index.js +95 -49
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,8 +1,36 @@
|
|
|
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, generate_seal, initSync$2 as initSync, ring_commitment, verify_seal, vrf_output_hash };
|
|
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_header_seals, verify_seal, vrf_output_hash };
|
|
3
3
|
}
|
|
4
4
|
/* tslint:disable */
|
|
5
5
|
/* eslint-disable */
|
|
6
|
+
/**
|
|
7
|
+
* Generate seal that is verifiable using `verify_seal` function.
|
|
8
|
+
*
|
|
9
|
+
* # Arguments
|
|
10
|
+
* * `secret_seed` - Seed used to derive the secret key
|
|
11
|
+
* * `input` - VRF input data
|
|
12
|
+
* * `aux_data` - Auxiliary data for the VRF proof
|
|
13
|
+
*
|
|
14
|
+
* # Returns
|
|
15
|
+
* A byte vector with the following format:
|
|
16
|
+
* - On success (97 bytes):
|
|
17
|
+
* - Byte 0: Status code `0` (RESULT_OK)
|
|
18
|
+
* - Bytes 1-32: Serialized VRF output (32 bytes, compressed) NOTE: not output hash!
|
|
19
|
+
* - Bytes 33-96: Serialized IETF VRF proof (64 bytes, compressed)
|
|
20
|
+
* - On error (1 byte):
|
|
21
|
+
* - Byte 0: Status code `1` (RESULT_ERR)
|
|
22
|
+
*
|
|
23
|
+
* Returns an error if the input cannot be converted to a valid VRF input point
|
|
24
|
+
* or if serialization of the output or proof fails.
|
|
25
|
+
*/
|
|
26
|
+
declare function generate_seal(secret_seed: Uint8Array, input: Uint8Array, aux_data: 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;
|
|
6
34
|
/**
|
|
7
35
|
* Compute VRF output hash from a secret seed and input data.
|
|
8
36
|
*
|
|
@@ -24,17 +52,31 @@ declare namespace bandersnatch_d_exports {
|
|
|
24
52
|
* Returns an error if the input cannot be converted to a valid VRF input point.
|
|
25
53
|
*/
|
|
26
54
|
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
55
|
/**
|
|
35
56
|
* Generate ring commitment given concatenation of ring keys.
|
|
36
57
|
*/
|
|
37
58
|
declare function ring_commitment(keys: Uint8Array): Uint8Array;
|
|
59
|
+
/**
|
|
60
|
+
* Verifies both header seal and entropy source in a single call.
|
|
61
|
+
*
|
|
62
|
+
* This combines seal verification (block author's VRF proof) with entropy
|
|
63
|
+
* verification (randomness derivation) as required by the JAM protocol.
|
|
64
|
+
*
|
|
65
|
+
* # Arguments
|
|
66
|
+
* * `signer_key` - Signer's public key (32 bytes, compressed)
|
|
67
|
+
* * `seal_data` - VRF signature for the seal (96 bytes)
|
|
68
|
+
* * `seal_payload` - VRF input data for seal verification
|
|
69
|
+
* * `unsealed_header` - Auxiliary data (unsealed header bytes)
|
|
70
|
+
* * `entropy_data` - VRF signature for entropy (96 bytes)
|
|
71
|
+
* * `entropy_prefix` - Prefix bytes for entropy payload construction
|
|
72
|
+
*
|
|
73
|
+
* # Returns
|
|
74
|
+
* A 65-byte vector:
|
|
75
|
+
* - Byte 0: Status code (`0` = success, `1` = error)
|
|
76
|
+
* - Bytes 1-32: Seal VRF output hash (zeros on error)
|
|
77
|
+
* - Bytes 33-64: Entropy VRF output hash (zeros on error)
|
|
78
|
+
*/
|
|
79
|
+
declare function verify_header_seals(signer_key: Uint8Array, seal_data: Uint8Array, seal_payload: Uint8Array, unsealed_header: Uint8Array, entropy_data: Uint8Array, entropy_prefix: Uint8Array): Uint8Array;
|
|
38
80
|
/**
|
|
39
81
|
* Seal verification as defined in:
|
|
40
82
|
* https://graypaper.fluffylabs.dev/#/68eaa1f/0eff000eff00?v=0.6.4
|
|
@@ -42,27 +84,6 @@ declare function ring_commitment(keys: Uint8Array): Uint8Array;
|
|
|
42
84
|
* https://graypaper.fluffylabs.dev/#/68eaa1f/0e54010e5401?v=0.6.4
|
|
43
85
|
*/
|
|
44
86
|
declare function verify_seal(signer_key: Uint8Array, seal_data: Uint8Array, payload: Uint8Array, aux_data: Uint8Array): Uint8Array;
|
|
45
|
-
/**
|
|
46
|
-
* Generate seal that is verifiable using `verify_seal` function.
|
|
47
|
-
*
|
|
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.
|
|
64
|
-
*/
|
|
65
|
-
declare function generate_seal(secret_seed: Uint8Array, input: Uint8Array, aux_data: Uint8Array): Uint8Array;
|
|
66
87
|
/**
|
|
67
88
|
* Derive Private and Public Key from Seed
|
|
68
89
|
*
|
|
@@ -76,6 +97,7 @@ interface InitOutput$2 {
|
|
|
76
97
|
readonly derive_public_key: (a: number, b: number) => [number, number];
|
|
77
98
|
readonly generate_seal: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
78
99
|
readonly ring_commitment: (a: number, b: number) => [number, number];
|
|
100
|
+
readonly verify_header_seals: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number];
|
|
79
101
|
readonly verify_seal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
|
80
102
|
readonly vrf_output_hash: (a: number, b: number, c: number, d: number) => [number, number];
|
|
81
103
|
readonly __wbindgen_export_0: WebAssembly.Table;
|