@maatara/core-pqc-wasm 0.4.1 → 0.4.3
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/core_pqc_wasm.d.ts +120 -49
- package/core_pqc_wasm.js +1001 -5
- package/core_pqc_wasm_bg.wasm +0 -0
- package/package.json +1 -3
- package/core_pqc_wasm_bg.js +0 -895
package/core_pqc_wasm.d.ts
CHANGED
|
@@ -1,94 +1,165 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
export function kyber_encaps(public_b64u: string): string;
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
+
* Generate EVM calldata for AnchorRegistry.anchor(bytes32, uint256)
|
|
6
|
+
* Returns hex-encoded calldata ready for transaction
|
|
5
7
|
*/
|
|
6
|
-
export function
|
|
8
|
+
export function generate_evm_anchor_calldata(root_hex: string, epoch: bigint): string;
|
|
9
|
+
/**
|
|
10
|
+
* ML-DSA-65 verification (FIPS 204 compliant)
|
|
11
|
+
* Security: Input validation prevents DoS; constant-time comparison
|
|
12
|
+
*/
|
|
13
|
+
export function dilithium_verify(message_b64u: string, signature_b64u: string, public_b64u: string): string;
|
|
7
14
|
/**
|
|
8
15
|
* ML-DSA-65 signing (FIPS 204 compliant)
|
|
9
16
|
* Security: Input validation prevents DoS; constant-time operations
|
|
10
17
|
*/
|
|
11
18
|
export function dilithium_sign(message_b64u: string, secret_b64u: string): string;
|
|
12
|
-
|
|
13
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Create a Merkle accumulator leaf with an explicit hash algorithm
|
|
21
|
+
* hash_alg: "sha256" or "sha3-384"
|
|
22
|
+
*/
|
|
23
|
+
export function create_accumulator_leaf_with_alg(user_id: string, chain_id: string, block_hash: string, block_index: bigint, hash_alg: string): string;
|
|
24
|
+
export function kyber_keygen(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Get elastic hash table configuration for key caching
|
|
27
|
+
*/
|
|
28
|
+
export function elastic_hash_config(capacity: number, load_factor: number): string;
|
|
14
29
|
export function preimage_asset_transfer(header_json: string): string;
|
|
15
30
|
export function preimage_governance(policy_json: string): string;
|
|
16
31
|
/**
|
|
17
|
-
*
|
|
32
|
+
* Truncate a SHA3-384 hash (48 bytes) to bytes32 (32 bytes) for EVM
|
|
33
|
+
* Uses first 32 bytes, preserving collision resistance
|
|
18
34
|
*/
|
|
19
|
-
export function
|
|
35
|
+
export function truncate_to_bytes32(hash_hex: string): string;
|
|
20
36
|
export function preimage_asset_mint(header_json: string, asset_json: string): string;
|
|
37
|
+
export function kyber_decaps(secret_b64u: string, kem_ct_b64u: string): string;
|
|
21
38
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
39
|
+
* Compute Merkle root from an array of leaf hashes
|
|
40
|
+
* Input: JSON array of hex hash strings
|
|
41
|
+
* Returns: { root: string, leaf_count: number }
|
|
24
42
|
*/
|
|
25
|
-
export function
|
|
43
|
+
export function compute_merkle_root(leaves_json: string, hash_alg: string): string;
|
|
26
44
|
/**
|
|
27
|
-
* Get
|
|
45
|
+
* Get SSSP algorithm configuration for graph verification
|
|
46
|
+
* nodes: expected number of nodes in the graph
|
|
28
47
|
*/
|
|
29
|
-
export function
|
|
30
|
-
export function aes_gcm_wrap(key_b64u: string, dek_b64u: string, aad_b64u: string): string;
|
|
48
|
+
export function sssp_config(nodes: number): string;
|
|
31
49
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
50
|
+
* Check if a nonce has been seen (for replay prevention)
|
|
51
|
+
* Returns info about the nonce cache algorithm
|
|
34
52
|
*/
|
|
35
|
-
export function
|
|
53
|
+
export function nonce_cache_info(): string;
|
|
54
|
+
export function preimage_anchor(user_id: string, root_hex: string, epoch: string, chains_json: string): string;
|
|
55
|
+
export function aes_gcm_wrap(key_b64u: string, dek_b64u: string, aad_b64u: string): string;
|
|
56
|
+
export function start(): void;
|
|
36
57
|
/**
|
|
37
58
|
* Compute shortest path verification info for provenance chains
|
|
38
59
|
* This returns the algorithm parameters for JS-side graph operations
|
|
39
60
|
*/
|
|
40
61
|
export function provenance_path_config(chain_length: number, branches: number): string;
|
|
41
|
-
export function start(): void;
|
|
42
|
-
/**
|
|
43
|
-
* Get SSSP algorithm configuration for graph verification
|
|
44
|
-
* nodes: expected number of nodes in the graph
|
|
45
|
-
*/
|
|
46
|
-
export function sssp_config(nodes: number): string;
|
|
47
|
-
/**
|
|
48
|
-
* Generate Bitcoin OP_RETURN payload for anchoring
|
|
49
|
-
* Returns hex-encoded payload (45 bytes)
|
|
50
|
-
*/
|
|
51
|
-
export function generate_bitcoin_anchor_payload(root_hex: string, epoch: bigint): string;
|
|
52
62
|
/**
|
|
53
63
|
* Get anchor configuration and gas estimates
|
|
54
64
|
*/
|
|
55
65
|
export function anchor_config_info(): string;
|
|
56
|
-
export function kyber_keygen(): string;
|
|
57
|
-
export function aes_gcm_unwrap(key_b64u: string, iv_b64u: string, ct_b64u: string, aad_b64u: string): string;
|
|
58
66
|
/**
|
|
59
|
-
*
|
|
60
|
-
* Uses first 32 bytes, preserving collision resistance
|
|
67
|
+
* Decode a Bitcoin OP_RETURN payload
|
|
61
68
|
*/
|
|
62
|
-
export function
|
|
63
|
-
export function hkdf_sha256(secret_b64u: string, info_b64u: string, salt_b64u: string | null | undefined, len: number): string;
|
|
64
|
-
export function preimage_anchor(user_id: string, root_hex: string, epoch: string, chains_json: string): string;
|
|
69
|
+
export function decode_bitcoin_anchor_payload(payload_hex: string): string;
|
|
65
70
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
71
|
+
* Create a Merkle accumulator leaf for a chain state
|
|
72
|
+
* Returns JSON with the leaf hash and canonical data
|
|
73
|
+
* Default hash algorithm is SHA3-384 (PQC)
|
|
69
74
|
*/
|
|
70
|
-
export function
|
|
71
|
-
export function kyber_encaps(public_b64u: string): string;
|
|
75
|
+
export function create_accumulator_leaf(user_id: string, chain_id: string, block_hash: string, block_index: bigint): string;
|
|
72
76
|
/**
|
|
73
77
|
* ML-DSA-65 key generation (FIPS 204 compliant)
|
|
74
78
|
* Security: Keys are generated using platform CSPRNG
|
|
75
79
|
*/
|
|
76
80
|
export function dilithium_keygen(): string;
|
|
81
|
+
export function hkdf_sha256(secret_b64u: string, info_b64u: string, salt_b64u: string | null | undefined, len: number): string;
|
|
82
|
+
/**
|
|
83
|
+
* Get supported anchor chains and their configurations
|
|
84
|
+
*/
|
|
85
|
+
export function anchor_chains_info(): string;
|
|
86
|
+
/**
|
|
87
|
+
* Generate Bitcoin OP_RETURN payload for anchoring
|
|
88
|
+
* Returns hex-encoded payload (45 bytes)
|
|
89
|
+
*/
|
|
90
|
+
export function generate_bitcoin_anchor_payload(root_hex: string, epoch: bigint): string;
|
|
91
|
+
export function jcs_canonicalize(json: string): string;
|
|
92
|
+
export function validate_royalty(receiver: string, bps: number): string;
|
|
77
93
|
/**
|
|
78
94
|
* Create a nonce cache for replay attack prevention
|
|
79
95
|
* capacity: maximum number of nonces to track
|
|
80
96
|
* ttl_ms: time-to-live in milliseconds before nonces expire
|
|
81
97
|
*/
|
|
82
98
|
export function create_nonce_cache(capacity: number, ttl_ms: bigint): string;
|
|
83
|
-
export function jcs_canonicalize(json: string): string;
|
|
84
|
-
/**
|
|
85
|
-
* Generate EVM calldata for AnchorRegistry.anchor(bytes32, uint256)
|
|
86
|
-
* Returns hex-encoded calldata ready for transaction
|
|
87
|
-
*/
|
|
88
|
-
export function generate_evm_anchor_calldata(root_hex: string, epoch: bigint): string;
|
|
89
99
|
export function verify_attestations(msg_b64u: string, attestations_json: string, allowed_public_keys_json?: string | null): string;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
export
|
|
100
|
+
export function aes_gcm_unwrap(key_b64u: string, iv_b64u: string, ct_b64u: string, aad_b64u: string): string;
|
|
101
|
+
|
|
102
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
103
|
+
|
|
104
|
+
export interface InitOutput {
|
|
105
|
+
readonly memory: WebAssembly.Memory;
|
|
106
|
+
readonly aes_gcm_unwrap: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
|
107
|
+
readonly aes_gcm_wrap: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
108
|
+
readonly anchor_chains_info: () => [number, number];
|
|
109
|
+
readonly anchor_config_info: () => [number, number];
|
|
110
|
+
readonly compute_merkle_root: (a: number, b: number, c: number, d: number) => [number, number];
|
|
111
|
+
readonly create_accumulator_leaf: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint) => [number, number];
|
|
112
|
+
readonly create_accumulator_leaf_with_alg: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: number, i: number) => [number, number];
|
|
113
|
+
readonly create_nonce_cache: (a: number, b: bigint) => [number, number];
|
|
114
|
+
readonly decode_bitcoin_anchor_payload: (a: number, b: number) => [number, number];
|
|
115
|
+
readonly dilithium_keygen: () => [number, number];
|
|
116
|
+
readonly dilithium_sign: (a: number, b: number, c: number, d: number) => [number, number];
|
|
117
|
+
readonly dilithium_verify: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
118
|
+
readonly elastic_hash_config: (a: number, b: number) => [number, number];
|
|
119
|
+
readonly generate_bitcoin_anchor_payload: (a: number, b: number, c: bigint) => [number, number];
|
|
120
|
+
readonly generate_evm_anchor_calldata: (a: number, b: number, c: bigint) => [number, number];
|
|
121
|
+
readonly hkdf_sha256: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
122
|
+
readonly jcs_canonicalize: (a: number, b: number) => [number, number];
|
|
123
|
+
readonly kyber_decaps: (a: number, b: number, c: number, d: number) => [number, number];
|
|
124
|
+
readonly kyber_encaps: (a: number, b: number) => [number, number];
|
|
125
|
+
readonly kyber_keygen: () => [number, number];
|
|
126
|
+
readonly nonce_cache_info: () => [number, number];
|
|
127
|
+
readonly preimage_anchor: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
|
128
|
+
readonly preimage_asset_mint: (a: number, b: number, c: number, d: number) => [number, number];
|
|
129
|
+
readonly preimage_asset_transfer: (a: number, b: number) => [number, number];
|
|
130
|
+
readonly provenance_path_config: (a: number, b: number) => [number, number];
|
|
131
|
+
readonly sssp_config: (a: number) => [number, number];
|
|
132
|
+
readonly start: () => void;
|
|
133
|
+
readonly truncate_to_bytes32: (a: number, b: number) => [number, number];
|
|
134
|
+
readonly validate_royalty: (a: number, b: number, c: number) => [number, number];
|
|
135
|
+
readonly verify_attestations: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
136
|
+
readonly preimage_governance: (a: number, b: number) => [number, number];
|
|
137
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
138
|
+
readonly __externref_table_alloc: () => number;
|
|
139
|
+
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
140
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
141
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
142
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
143
|
+
readonly __wbindgen_start: () => void;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
147
|
+
/**
|
|
148
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
149
|
+
* a precompiled `WebAssembly.Module`.
|
|
150
|
+
*
|
|
151
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
152
|
+
*
|
|
153
|
+
* @returns {InitOutput}
|
|
154
|
+
*/
|
|
155
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
159
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
160
|
+
*
|
|
161
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
162
|
+
*
|
|
163
|
+
* @returns {Promise<InitOutput>}
|
|
164
|
+
*/
|
|
165
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|