starknet 11.3.0 → 11.4.0
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/CHANGELOG.md +6 -0
- package/dist/falcon/index.d.ts +352 -0
- package/dist/falcon/index.js +3736 -0
- package/dist/falcon/index.js.map +1 -0
- package/dist/falcon/index.mjs +3723 -0
- package/dist/falcon/index.mjs.map +1 -0
- package/package.json +10 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
# [11.4.0](https://github.com/starknet-io/starknet.js/compare/v11.3.0...v11.4.0) (2026-10-16)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
- **falcon:** add starknet/falcon, a post-quantum Falcon-512 signer for the S2morrow account ([bfe33ac](https://github.com/starknet-io/starknet.js/commit/bfe33acc9a3801abe6dc09206e5520ca40a36eb8))
|
|
6
|
+
|
|
1
7
|
# [11.3.0](https://github.com/starknet-io/starknet.js/compare/v11.2.0...v11.3.0) (2026-10-15)
|
|
2
8
|
|
|
3
9
|
### Bug Fixes
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import * as starknet from 'starknet';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Signer for the S2morrow Falcon-512 account (post-quantum signature), in pure TypeScript.
|
|
5
|
+
*
|
|
6
|
+
* Falcon-512 is a signature scheme built on lattices, designed to resist attacks by quantum
|
|
7
|
+
* computers. The S2morrow account (https://github.com/feltroidprime/s2morrow) verifies it on-chain,
|
|
8
|
+
* on a Poseidon hash of the transaction. A signature is 61 felts.
|
|
9
|
+
*
|
|
10
|
+
* Fees: the on-chain verification costs much more L2 gas than an ECDSA one. By default, the fee
|
|
11
|
+
* estimates of `Account` skip the validation of the signature (`skipValidate: true`), so they leave
|
|
12
|
+
* out this cost: pass `{ skipValidate: false }` to `execute`, `deployAccount` and `declare`.
|
|
13
|
+
*
|
|
14
|
+
* Status:
|
|
15
|
+
* - This is Falcon as submitted to Round 3 of the NIST post-quantum standardization, not FN-DSA
|
|
16
|
+
* (FIPS 206). FN-DSA is not final yet, and will most likely be incompatible with it.
|
|
17
|
+
* - The Falcon code is a patched copy of `@noble/post-quantum` 0.7.1, kept until noble publishes
|
|
18
|
+
* the API this signer needs. noble has no independent audit: its author audited version 0.6.1
|
|
19
|
+
* (April 2026).
|
|
20
|
+
* - Signing is not constant-time: do not sign where an attacker can measure its timing closely.
|
|
21
|
+
* - Only V3 transactions are supported.
|
|
22
|
+
*/
|
|
23
|
+
declare class Falcon512Signer implements starknet.SignerInterface {
|
|
24
|
+
#private;
|
|
25
|
+
/**
|
|
26
|
+
* Builds a signer from a NIST Falcon-512 secret key. The key is fully checked, then copied: the
|
|
27
|
+
* signer keeps its own copy, in a private field.
|
|
28
|
+
* @param {Uint8Array | string} secretKey NIST Falcon-512 secret key (1281 bytes), Uint8Array or
|
|
29
|
+
* hex string. Prefer a Uint8Array: a string cannot be wiped from memory.
|
|
30
|
+
* @throws {Error} when the secret key is invalid
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const { secretKey } = falcon512.generateKeyPair();
|
|
34
|
+
* const mySigner = new Falcon512Signer(secretKey);
|
|
35
|
+
* new Falcon512Signer(new Uint8Array(1281));
|
|
36
|
+
* // throws Error("Falcon512: invalid secret key header")
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
constructor(secretKey: Uint8Array | string);
|
|
40
|
+
/**
|
|
41
|
+
* Builds a signer from a falcon-rs secret key (3584 bytes), converted to the NIST format.
|
|
42
|
+
*
|
|
43
|
+
* Warning: falcon-rs derives the seed of its sampler from the public salt of each signature, so
|
|
44
|
+
* the signatures it produced may leak information about the secret key. Use this for continuity
|
|
45
|
+
* only; for real funds, generate a new key with `falcon512.generateKeyPair`. The S2morrow account
|
|
46
|
+
* cannot change its key: a new key means a new account.
|
|
47
|
+
* @param {Uint8Array | string} secretKey the falcon-rs secret key (3584 bytes), or its hex string
|
|
48
|
+
* @returns {Falcon512Signer} a signer that holds the same key, in the NIST format
|
|
49
|
+
* @throws {Error} when the falcon-rs secret key is invalid
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* const mySigner = Falcon512Signer.fromFalconRs(falconRsSecretKey); // 3584 bytes, from falcon-rs
|
|
53
|
+
* const result = mySigner.getPackedPublicKey();
|
|
54
|
+
* // result = ['0xb2cf4f8b3c6f60cc662f438970ad34017e260c52d7911297a42811ce3cea2b', …] (29 felts)
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
static fromFalconRs(secretKey: Uint8Array | string): Falcon512Signer;
|
|
58
|
+
/**
|
|
59
|
+
* NIST Falcon-512 public key (897 bytes), as a hex string.
|
|
60
|
+
* @returns {Promise<string>} the public key: 0x, then 1794 hex digits
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* const { secretKey } = falcon512.generateKeyPair();
|
|
64
|
+
* const mySigner = new Falcon512Signer(secretKey);
|
|
65
|
+
* const result = await mySigner.getPubKey();
|
|
66
|
+
* // result = '0x09…' (1796 characters; 09 is the header of the format)
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
getPubKey(): Promise<string>;
|
|
70
|
+
/**
|
|
71
|
+
* The 29 felts of the account constructor argument `pk_packed`.
|
|
72
|
+
* @returns {string[]} the 29 felts, as hex strings (a new array at each call)
|
|
73
|
+
* @example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* const { secretKey } = falcon512.generateKeyPair();
|
|
76
|
+
* const mySigner = new Falcon512Signer(secretKey);
|
|
77
|
+
* const result = mySigner.getPackedPublicKey();
|
|
78
|
+
* // result = ['0x…', …] (29 felts)
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
getPackedPublicKey(): string[];
|
|
82
|
+
/**
|
|
83
|
+
* Signs a SNIP-12 message (TypedData) for off-chain use.
|
|
84
|
+
* @param {TypedData} typedData the message to sign
|
|
85
|
+
* @param {string} accountAddress address of the account that signs the message
|
|
86
|
+
* @returns {Promise<Signature>} the 61 felts of the signature, as hex strings
|
|
87
|
+
* @example
|
|
88
|
+
* ```typescript
|
|
89
|
+
* const result = await mySigner.signMessage(myTypedData, accountAddress);
|
|
90
|
+
* // result = ['0x…', …] (61 felts, random salt); result[29] = '0x2' (salt length)
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
signMessage(typedData: starknet.TypedData, accountAddress: string): Promise<starknet.Signature>;
|
|
94
|
+
/**
|
|
95
|
+
* Signs an INVOKE transaction (V3 only).
|
|
96
|
+
* @param {Call[]} transactions the calls of the transaction
|
|
97
|
+
* @param {InvocationsSignerDetails} details the details needed to hash the transaction
|
|
98
|
+
* @returns {Promise<Signature>} the 61 felts of the signature, as hex strings
|
|
99
|
+
* @throws {Error} when the transaction is not V3
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* const calls: Call[] = [
|
|
103
|
+
* {
|
|
104
|
+
* contractAddress: '0x4718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d',
|
|
105
|
+
* entrypoint: 'transfer',
|
|
106
|
+
* calldata: ['0x123', '1000', '0'],
|
|
107
|
+
* },
|
|
108
|
+
* ];
|
|
109
|
+
* const details: InvocationsSignerDetails = {
|
|
110
|
+
* walletAddress: accountAddress,
|
|
111
|
+
* chainId: constants.StarknetChainId.SN_SEPOLIA,
|
|
112
|
+
* cairoVersion: '1',
|
|
113
|
+
* version: '0x3',
|
|
114
|
+
* nonce: 1,
|
|
115
|
+
* resourceBounds: {
|
|
116
|
+
* l1_gas: { max_amount: 0n, max_price_per_unit: 50000000000000n },
|
|
117
|
+
* l2_gas: { max_amount: 40000000n, max_price_per_unit: 20000000000n },
|
|
118
|
+
* l1_data_gas: { max_amount: 1000n, max_price_per_unit: 100000n },
|
|
119
|
+
* },
|
|
120
|
+
* tip: 0,
|
|
121
|
+
* paymasterData: [],
|
|
122
|
+
* accountDeploymentData: [],
|
|
123
|
+
* nonceDataAvailabilityMode: RPC.EDataAvailabilityMode.L1,
|
|
124
|
+
* feeDataAvailabilityMode: RPC.EDataAvailabilityMode.L1,
|
|
125
|
+
* };
|
|
126
|
+
* const result = await mySigner.signTransaction(calls, details);
|
|
127
|
+
* // result = ['0x…', …] (61 felts)
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
signTransaction(transactions: starknet.Call[], details: starknet.InvocationsSignerDetails): Promise<starknet.Signature>;
|
|
131
|
+
/**
|
|
132
|
+
* Signs the DEPLOY_ACCOUNT transaction of a Falcon-512 account (V3 only).
|
|
133
|
+
* @param {DeployAccountSignerDetails} details the details needed to hash the transaction
|
|
134
|
+
* @returns {Promise<Signature>} the 61 felts of the signature, as hex strings
|
|
135
|
+
* @throws {Error} when the transaction is not V3
|
|
136
|
+
* @example
|
|
137
|
+
* ```typescript
|
|
138
|
+
* const packedPublicKey = mySigner.getPackedPublicKey();
|
|
139
|
+
* const classHash = '0x37c7626b50ba517835c9556b53bce57cb6633704bb702f8c2f13a44cf151d5';
|
|
140
|
+
* const salt = packedPublicKey[0];
|
|
141
|
+
* const details: DeployAccountSignerDetails = {
|
|
142
|
+
* classHash,
|
|
143
|
+
* constructorCalldata: packedPublicKey,
|
|
144
|
+
* addressSalt: salt,
|
|
145
|
+
* contractAddress: hash.calculateContractAddressFromHash(salt, classHash, packedPublicKey, 0),
|
|
146
|
+
* chainId: constants.StarknetChainId.SN_SEPOLIA,
|
|
147
|
+
* version: '0x3',
|
|
148
|
+
* nonce: 0,
|
|
149
|
+
* resourceBounds: {
|
|
150
|
+
* l1_gas: { max_amount: 0n, max_price_per_unit: 50000000000000n },
|
|
151
|
+
* l2_gas: { max_amount: 60000000n, max_price_per_unit: 20000000000n },
|
|
152
|
+
* l1_data_gas: { max_amount: 1000n, max_price_per_unit: 100000n },
|
|
153
|
+
* },
|
|
154
|
+
* tip: 0,
|
|
155
|
+
* paymasterData: [],
|
|
156
|
+
* accountDeploymentData: [],
|
|
157
|
+
* nonceDataAvailabilityMode: RPC.EDataAvailabilityMode.L1,
|
|
158
|
+
* feeDataAvailabilityMode: RPC.EDataAvailabilityMode.L1,
|
|
159
|
+
* };
|
|
160
|
+
* const result = await mySigner.signDeployAccountTransaction(details);
|
|
161
|
+
* // result = ['0x…', …] (61 felts)
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
signDeployAccountTransaction(details: starknet.DeployAccountSignerDetails): Promise<starknet.Signature>;
|
|
165
|
+
/**
|
|
166
|
+
* Signs a DECLARE transaction (V3 only).
|
|
167
|
+
* @param {DeclareSignerDetails} details the details needed to hash the transaction
|
|
168
|
+
* @returns {Promise<Signature>} the 61 felts of the signature, as hex strings
|
|
169
|
+
* @throws {Error} when the transaction is not V3
|
|
170
|
+
* @example
|
|
171
|
+
* ```typescript
|
|
172
|
+
* const details: DeclareSignerDetails = {
|
|
173
|
+
* senderAddress: accountAddress,
|
|
174
|
+
* classHash: '0x37c7626b50ba517835c9556b53bce57cb6633704bb702f8c2f13a44cf151d5',
|
|
175
|
+
* compiledClassHash: '0x1f2afb8ae690b84f4b7acfde52fbd2e5a1dc0c910ed898a778dc1ad3339e5c5',
|
|
176
|
+
* chainId: constants.StarknetChainId.SN_SEPOLIA,
|
|
177
|
+
* version: '0x3',
|
|
178
|
+
* nonce: 2,
|
|
179
|
+
* resourceBounds: {
|
|
180
|
+
* l1_gas: { max_amount: 0n, max_price_per_unit: 50000000000000n },
|
|
181
|
+
* l2_gas: { max_amount: 80000000n, max_price_per_unit: 20000000000n },
|
|
182
|
+
* l1_data_gas: { max_amount: 1000n, max_price_per_unit: 100000n },
|
|
183
|
+
* },
|
|
184
|
+
* tip: 0,
|
|
185
|
+
* paymasterData: [],
|
|
186
|
+
* accountDeploymentData: [],
|
|
187
|
+
* nonceDataAvailabilityMode: RPC.EDataAvailabilityMode.L1,
|
|
188
|
+
* feeDataAvailabilityMode: RPC.EDataAvailabilityMode.L1,
|
|
189
|
+
* };
|
|
190
|
+
* const result = await mySigner.signDeclareTransaction(details);
|
|
191
|
+
* // result = ['0x…', …] (61 felts)
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
signDeclareTransaction(details: starknet.DeclareSignerDetails): Promise<starknet.Signature>;
|
|
195
|
+
/**
|
|
196
|
+
* Signs a hash: the last step of all the methods above. It stays protected, so that no public
|
|
197
|
+
* method signs an arbitrary hash. A subclass can override it, as for every starknet.js signer.
|
|
198
|
+
* @param {string} msgHash the hash to sign, a felt252
|
|
199
|
+
* @returns {Promise<Signature>} the 61 felts of the signature, as hex strings
|
|
200
|
+
* @example
|
|
201
|
+
* ```typescript
|
|
202
|
+
* class LoggedFalconSigner extends Falcon512Signer {
|
|
203
|
+
* protected async signRaw(msgHash: string): Promise<Signature> {
|
|
204
|
+
* console.log('Falcon-512 signs', msgHash);
|
|
205
|
+
* return super.signRaw(msgHash);
|
|
206
|
+
* }
|
|
207
|
+
* }
|
|
208
|
+
* const result = await new LoggedFalconSigner(secretKey).signMessage(myTypedData, accountAddress);
|
|
209
|
+
* // logs the hash of the message; result = ['0x…', …] (61 felts)
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
protected signRaw(msgHash: string): Promise<starknet.Signature>;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Low-level verification, same shape as `ec.starkCurve.verify(signature, msgHash, fullPublicKey)`.
|
|
217
|
+
* @param {Signature} signature the 61 felts of a Falcon-512 signature
|
|
218
|
+
* @param {BigNumberish} msgHash the signed hash (a transaction hash, or the hash of a SNIP-12
|
|
219
|
+
* message)
|
|
220
|
+
* @param {Uint8Array | string} fullPublicKey NIST Falcon-512 public key (897 bytes), as returned by
|
|
221
|
+
* `getPubKey()`
|
|
222
|
+
* @returns {boolean} true for a valid signature of msgHash; false for an invalid or malformed
|
|
223
|
+
* signature, or a malformed hash
|
|
224
|
+
* @throws {Error} when the public key is invalid
|
|
225
|
+
* @example
|
|
226
|
+
* ```typescript
|
|
227
|
+
* const { secretKey, publicKey } = falcon512.generateKeyPair();
|
|
228
|
+
* const mySigner = new Falcon512Signer(secretKey);
|
|
229
|
+
* const signature = await mySigner.signMessage(myTypedData, accountAddress);
|
|
230
|
+
* const msgHash = typedData.getMessageHash(myTypedData, accountAddress);
|
|
231
|
+
* const result = falcon512.verify(signature, msgHash, publicKey);
|
|
232
|
+
* // result = true
|
|
233
|
+
* const result2 = falcon512.verify(signature, '0x1234', publicKey);
|
|
234
|
+
* // result2 = false
|
|
235
|
+
* falcon512.verify(signature, msgHash, '0x1234');
|
|
236
|
+
* // throws Error("Falcon512: public key must have 1794 hex digits, got 4")
|
|
237
|
+
* ```
|
|
238
|
+
*/
|
|
239
|
+
declare function verify(signature: starknet.Signature, msgHash: starknet.BigNumberish, fullPublicKey: Uint8Array | string): boolean;
|
|
240
|
+
/**
|
|
241
|
+
* Checks a SNIP-12 message signed by a Falcon-512 account. Same shapes as
|
|
242
|
+
* `typedData.verifyMessage`.
|
|
243
|
+
* @param {BigNumberish | TypedData} message a TypedData message, or its hash (SNIP-12)
|
|
244
|
+
* @param {Signature} signature the 61 felts of a Falcon-512 signature
|
|
245
|
+
* @param {Uint8Array | string} fullPublicKey NIST Falcon-512 public key (897 bytes), as returned by
|
|
246
|
+
* `getPubKey()`
|
|
247
|
+
* @param {BigNumberish} [accountAddress] address of the account that signed the message. Needed
|
|
248
|
+
* only when `message` is a TypedData
|
|
249
|
+
* @returns {boolean} true if the message is verified
|
|
250
|
+
* @throws {Error} when `message` is a TypedData and accountAddress is missing, or when the public
|
|
251
|
+
* key is invalid
|
|
252
|
+
* @example
|
|
253
|
+
* ```typescript
|
|
254
|
+
* const signature = await mySigner.signMessage(myTypedData, accountAddress);
|
|
255
|
+
* const msgHash = typedData.getMessageHash(myTypedData, accountAddress);
|
|
256
|
+
* const result1 = falcon512.verifyMessage(myTypedData, signature, publicKey, accountAddress);
|
|
257
|
+
* const result2 = falcon512.verifyMessage(msgHash, signature, publicKey);
|
|
258
|
+
* // result1 = result2 = true
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
declare function verifyMessage(message: starknet.TypedData, signature: starknet.Signature, fullPublicKey: Uint8Array | string, accountAddress: starknet.BigNumberish): boolean;
|
|
262
|
+
declare function verifyMessage(message: starknet.BigNumberish, signature: starknet.Signature, fullPublicKey: Uint8Array | string): boolean;
|
|
263
|
+
|
|
264
|
+
type Falcon512KeyPair = {
|
|
265
|
+
secretKey: Uint8Array;
|
|
266
|
+
publicKey: Uint8Array;
|
|
267
|
+
};
|
|
268
|
+
/**
|
|
269
|
+
* New key pair (NIST formats). The optional seed must be 48 bytes from a CSPRNG.
|
|
270
|
+
* @param {Uint8Array} [seed] 48 random bytes; by default, drawn by the engine
|
|
271
|
+
* @returns {Falcon512KeyPair} the secret key (1281 bytes) and the public key (897 bytes)
|
|
272
|
+
* @throws {Error} when the seed is not 48 bytes
|
|
273
|
+
* @example
|
|
274
|
+
* ```typescript
|
|
275
|
+
* const result = falcon512.generateKeyPair();
|
|
276
|
+
* // result = { secretKey: Uint8Array(1281) [89, …], publicKey: Uint8Array(897) [9, …] }
|
|
277
|
+
* // A new random key at each call; 89 (0x59) and 9 (0x09) are the headers of the two formats.
|
|
278
|
+
* ```
|
|
279
|
+
*/
|
|
280
|
+
declare function generateKeyPair(seed?: Uint8Array): Falcon512KeyPair;
|
|
281
|
+
/**
|
|
282
|
+
* Public key h = g / f mod q of a validated secret key (NIST format).
|
|
283
|
+
* @param {Uint8Array | string} secretKey the NIST secret key (1281 bytes), or its hex string
|
|
284
|
+
* @returns {Uint8Array} the NIST public key (897 bytes)
|
|
285
|
+
* @throws {Error} when the secret key is invalid
|
|
286
|
+
* @example
|
|
287
|
+
* ```typescript
|
|
288
|
+
* const { secretKey, publicKey } = falcon512.generateKeyPair();
|
|
289
|
+
* const result = falcon512.getPublicKey(secretKey);
|
|
290
|
+
* // result = Uint8Array(897) [9, …] (the same bytes as publicKey)
|
|
291
|
+
* ```
|
|
292
|
+
*/
|
|
293
|
+
declare function getPublicKey(secretKey: Uint8Array | string): Uint8Array;
|
|
294
|
+
/**
|
|
295
|
+
* The 29 felts of the account constructor argument `pk_packed`.
|
|
296
|
+
* @param {Uint8Array | string} publicKey the NIST public key (897 bytes), or its hex string
|
|
297
|
+
* @returns {string[]} the 29 felts, as hex strings
|
|
298
|
+
* @throws {Error} when the public key is invalid
|
|
299
|
+
* @example
|
|
300
|
+
* ```typescript
|
|
301
|
+
* const { publicKey } = falcon512.generateKeyPair();
|
|
302
|
+
* const result = falcon512.getPackedPublicKey(publicKey);
|
|
303
|
+
* // result = ['0x…', …] (29 felts)
|
|
304
|
+
* ```
|
|
305
|
+
*/
|
|
306
|
+
declare function getPackedPublicKey(publicKey: Uint8Array | string): string[];
|
|
307
|
+
/**
|
|
308
|
+
* Converts a falcon-rs secret key (f‖g‖F‖G, 4 × 896 bytes) into a NIST secret key.
|
|
309
|
+
*
|
|
310
|
+
* Warning: falcon-rs derives the seed of its sampler from the public salt of each signature, so the
|
|
311
|
+
* signatures it produced may leak information about the secret key. Import such a key for
|
|
312
|
+
* continuity only; for real funds, generate a new key with `generateKeyPair`.
|
|
313
|
+
* @param {Uint8Array | string} secretKey the falcon-rs secret key (3584 bytes), or its hex string
|
|
314
|
+
* @returns {Uint8Array} the NIST secret key (1281 bytes)
|
|
315
|
+
* @throws {Error} when the key has a wrong length, a coefficient out of range, a G that does not
|
|
316
|
+
* match f, g, F, or does not satisfy the NTRU equation
|
|
317
|
+
* @example
|
|
318
|
+
* ```typescript
|
|
319
|
+
* const result = falcon512.importFalconRsSecretKey(falconRsSecretKey);
|
|
320
|
+
* // result = Uint8Array(1281) [89, …] (NIST header 0x59)
|
|
321
|
+
* ```
|
|
322
|
+
*/
|
|
323
|
+
declare function importFalconRsSecretKey(secretKey: Uint8Array | string): Uint8Array;
|
|
324
|
+
/**
|
|
325
|
+
* Converts a NIST secret key into the falcon-rs format (f‖g‖F‖G, 4 × 896 bytes).
|
|
326
|
+
*
|
|
327
|
+
* Warning: falcon-rs derives the seed of its sampler from the public salt of each signature, so
|
|
328
|
+
* signing with falcon-rs exposes the key: keep signing with this library.
|
|
329
|
+
* @param {Uint8Array | string} secretKey the NIST secret key (1281 bytes), or its hex string
|
|
330
|
+
* @returns {Uint8Array} the falcon-rs secret key (3584 bytes)
|
|
331
|
+
* @throws {Error} when the secret key is invalid
|
|
332
|
+
* @example
|
|
333
|
+
* ```typescript
|
|
334
|
+
* const { secretKey } = falcon512.generateKeyPair();
|
|
335
|
+
* const result = falcon512.exportFalconRsSecretKey(secretKey);
|
|
336
|
+
* // result = Uint8Array(3584) […]
|
|
337
|
+
* ```
|
|
338
|
+
*/
|
|
339
|
+
declare function exportFalconRsSecretKey(secretKey: Uint8Array | string): Uint8Array;
|
|
340
|
+
|
|
341
|
+
declare const falcon512_exportFalconRsSecretKey: typeof exportFalconRsSecretKey;
|
|
342
|
+
declare const falcon512_generateKeyPair: typeof generateKeyPair;
|
|
343
|
+
declare const falcon512_getPackedPublicKey: typeof getPackedPublicKey;
|
|
344
|
+
declare const falcon512_getPublicKey: typeof getPublicKey;
|
|
345
|
+
declare const falcon512_importFalconRsSecretKey: typeof importFalconRsSecretKey;
|
|
346
|
+
declare const falcon512_verify: typeof verify;
|
|
347
|
+
declare const falcon512_verifyMessage: typeof verifyMessage;
|
|
348
|
+
declare namespace falcon512 {
|
|
349
|
+
export { falcon512_exportFalconRsSecretKey as exportFalconRsSecretKey, falcon512_generateKeyPair as generateKeyPair, falcon512_getPackedPublicKey as getPackedPublicKey, falcon512_getPublicKey as getPublicKey, falcon512_importFalconRsSecretKey as importFalconRsSecretKey, falcon512_verify as verify, falcon512_verifyMessage as verifyMessage };
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
export { type Falcon512KeyPair, Falcon512Signer, falcon512 };
|