@aztec/wallet-sdk 0.0.1-commit.3469e52 → 0.0.1-commit.43597cc1
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/README.md +217 -294
- package/dest/base-wallet/base_wallet.d.ts +36 -6
- package/dest/base-wallet/base_wallet.d.ts.map +1 -1
- package/dest/base-wallet/base_wallet.js +57 -12
- package/dest/base-wallet/index.d.ts +2 -1
- package/dest/base-wallet/index.d.ts.map +1 -1
- package/dest/base-wallet/index.js +1 -0
- package/dest/base-wallet/utils.d.ts +48 -0
- package/dest/base-wallet/utils.d.ts.map +1 -0
- package/dest/base-wallet/utils.js +128 -0
- package/dest/crypto.d.ts +59 -50
- package/dest/crypto.d.ts.map +1 -1
- package/dest/crypto.js +202 -108
- package/dest/emoji_alphabet.d.ts +35 -0
- package/dest/emoji_alphabet.d.ts.map +1 -0
- package/dest/emoji_alphabet.js +299 -0
- package/dest/extension/handlers/background_connection_handler.d.ts +158 -0
- package/dest/extension/handlers/background_connection_handler.d.ts.map +1 -0
- package/dest/extension/handlers/background_connection_handler.js +258 -0
- package/dest/extension/handlers/content_script_connection_handler.d.ts +56 -0
- package/dest/extension/handlers/content_script_connection_handler.d.ts.map +1 -0
- package/dest/extension/handlers/content_script_connection_handler.js +174 -0
- package/dest/extension/handlers/index.d.ts +12 -0
- package/dest/extension/handlers/index.d.ts.map +1 -0
- package/dest/extension/handlers/index.js +10 -0
- package/dest/extension/handlers/internal_message_types.d.ts +63 -0
- package/dest/extension/handlers/internal_message_types.d.ts.map +1 -0
- package/dest/extension/handlers/internal_message_types.js +22 -0
- package/dest/extension/provider/extension_provider.d.ts +107 -0
- package/dest/extension/provider/extension_provider.d.ts.map +1 -0
- package/dest/extension/provider/extension_provider.js +160 -0
- package/dest/extension/provider/extension_wallet.d.ts +131 -0
- package/dest/extension/provider/extension_wallet.d.ts.map +1 -0
- package/dest/{providers/extension → extension/provider}/extension_wallet.js +48 -95
- package/dest/extension/provider/index.d.ts +3 -0
- package/dest/extension/provider/index.d.ts.map +1 -0
- package/dest/{providers/extension → extension/provider}/index.js +0 -2
- package/dest/manager/index.d.ts +2 -8
- package/dest/manager/index.d.ts.map +1 -1
- package/dest/manager/index.js +0 -6
- package/dest/manager/types.d.ts +88 -6
- package/dest/manager/types.d.ts.map +1 -1
- package/dest/manager/types.js +17 -1
- package/dest/manager/wallet_manager.d.ts +50 -7
- package/dest/manager/wallet_manager.d.ts.map +1 -1
- package/dest/manager/wallet_manager.js +174 -44
- package/dest/types.d.ts +43 -12
- package/dest/types.d.ts.map +1 -1
- package/dest/types.js +3 -2
- package/package.json +17 -10
- package/src/base-wallet/base_wallet.ts +98 -28
- package/src/base-wallet/index.ts +1 -0
- package/src/base-wallet/utils.ts +229 -0
- package/src/crypto.ts +237 -113
- package/src/emoji_alphabet.ts +317 -0
- package/src/extension/handlers/background_connection_handler.ts +423 -0
- package/src/extension/handlers/content_script_connection_handler.ts +246 -0
- package/src/extension/handlers/index.ts +25 -0
- package/src/extension/handlers/internal_message_types.ts +69 -0
- package/src/extension/provider/extension_provider.ts +233 -0
- package/src/{providers/extension → extension/provider}/extension_wallet.ts +52 -110
- package/src/extension/provider/index.ts +7 -0
- package/src/manager/index.ts +2 -10
- package/src/manager/types.ts +91 -5
- package/src/manager/wallet_manager.ts +192 -46
- package/src/types.ts +44 -10
- package/dest/providers/extension/extension_provider.d.ts +0 -63
- package/dest/providers/extension/extension_provider.d.ts.map +0 -1
- package/dest/providers/extension/extension_provider.js +0 -124
- package/dest/providers/extension/extension_wallet.d.ts +0 -155
- package/dest/providers/extension/extension_wallet.d.ts.map +0 -1
- package/dest/providers/extension/index.d.ts +0 -6
- package/dest/providers/extension/index.d.ts.map +0 -1
- package/src/providers/extension/extension_provider.ts +0 -167
- package/src/providers/extension/index.ts +0 -5
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Account } from '@aztec/aztec.js/account';
|
|
2
2
|
import type { CallIntent, IntentInnerHash } from '@aztec/aztec.js/authorization';
|
|
3
|
+
import { type InteractionWaitOptions, type SendReturn } from '@aztec/aztec.js/contracts';
|
|
3
4
|
import type { FeePaymentMethod } from '@aztec/aztec.js/fee';
|
|
4
|
-
import type { Aliased, BatchResults, BatchedMethod, PrivateEvent, PrivateEventFilter, ProfileOptions, SendOptions, SimulateOptions, Wallet } from '@aztec/aztec.js/wallet';
|
|
5
|
+
import type { Aliased, AppCapabilities, BatchResults, BatchedMethod, PrivateEvent, PrivateEventFilter, ProfileOptions, SendOptions, SimulateOptions, Wallet, WalletCapabilities } from '@aztec/aztec.js/wallet';
|
|
5
6
|
import { AccountFeePaymentMethodOptions } from '@aztec/entrypoints/account';
|
|
6
7
|
import type { ChainInfo } from '@aztec/entrypoints/interfaces';
|
|
7
8
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
@@ -13,7 +14,7 @@ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
13
14
|
import { type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
14
15
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
15
16
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
16
|
-
import type
|
|
17
|
+
import { type TxExecutionRequest, type TxProfileResult, TxSimulationResult, type UtilitySimulationResult } from '@aztec/stdlib/tx';
|
|
17
18
|
import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
18
19
|
/**
|
|
19
20
|
* Options to configure fee payment for a transaction
|
|
@@ -52,6 +53,20 @@ export declare abstract class BaseWallet implements Wallet {
|
|
|
52
53
|
getChainInfo(): Promise<ChainInfo>;
|
|
53
54
|
protected createTxExecutionRequestFromPayloadAndFee(executionPayload: ExecutionPayload, from: AztecAddress, feeOptions: FeeOptions): Promise<TxExecutionRequest>;
|
|
54
55
|
createAuthWit(from: AztecAddress, messageHashOrIntent: IntentInnerHash | CallIntent): Promise<AuthWitness>;
|
|
56
|
+
/**
|
|
57
|
+
* Request capabilities from the wallet.
|
|
58
|
+
*
|
|
59
|
+
* This method is wallet-implementation-dependent and must be provided by classes extending BaseWallet.
|
|
60
|
+
* Embedded wallets typically don't support capability-based authorization (no user authorization flow),
|
|
61
|
+
* while external wallets (browser extensions, hardware wallets) implement this to reduce authorization
|
|
62
|
+
* friction by allowing apps to request permissions upfront.
|
|
63
|
+
*
|
|
64
|
+
* TODO: Consider making it abstract so implementing it is a conscious decision. Leaving it as-is
|
|
65
|
+
* while the feature stabilizes.
|
|
66
|
+
*
|
|
67
|
+
* @param _manifest - Application capability manifest declaring what operations the app needs
|
|
68
|
+
*/
|
|
69
|
+
requestCapabilities(_manifest: AppCapabilities): Promise<WalletCapabilities>;
|
|
55
70
|
batch<const T extends readonly BatchedMethod[]>(methods: T): Promise<BatchResults<T>>;
|
|
56
71
|
/**
|
|
57
72
|
* Completes partial user-provided fee options with wallet defaults.
|
|
@@ -81,18 +96,33 @@ export declare abstract class BaseWallet implements Wallet {
|
|
|
81
96
|
}>;
|
|
82
97
|
registerSender(address: AztecAddress, _alias?: string): Promise<AztecAddress>;
|
|
83
98
|
registerContract(instance: ContractInstanceWithAddress, artifact?: ContractArtifact, secretKey?: Fr): Promise<ContractInstanceWithAddress>;
|
|
99
|
+
/**
|
|
100
|
+
* Simulates calls through the standard PXE path (account entrypoint).
|
|
101
|
+
* @param executionPayload - The execution payload to simulate.
|
|
102
|
+
* @param from - The sender address.
|
|
103
|
+
* @param feeOptions - Fee options for the transaction.
|
|
104
|
+
* @param skipTxValidation - Whether to skip tx validation.
|
|
105
|
+
* @param skipFeeEnforcement - Whether to skip fee enforcement.
|
|
106
|
+
*/
|
|
107
|
+
protected simulateViaEntrypoint(executionPayload: ExecutionPayload, from: AztecAddress, feeOptions: FeeOptions, skipTxValidation?: boolean, skipFeeEnforcement?: boolean): Promise<TxSimulationResult>;
|
|
108
|
+
/**
|
|
109
|
+
* Simulates a transaction, optimizing leading public static calls by running them directly
|
|
110
|
+
* on the node while sending the remaining calls through the standard PXE path.
|
|
111
|
+
* Return values from both paths are merged back in original call order.
|
|
112
|
+
* @param executionPayload - The execution payload to simulate.
|
|
113
|
+
* @param opts - Simulation options (from address, fee settings, etc.).
|
|
114
|
+
* @returns The merged simulation result.
|
|
115
|
+
*/
|
|
84
116
|
simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
|
|
85
117
|
profileTx(executionPayload: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult>;
|
|
86
|
-
sendTx(executionPayload: ExecutionPayload, opts: SendOptions): Promise<
|
|
118
|
+
sendTx<W extends InteractionWaitOptions = undefined>(executionPayload: ExecutionPayload, opts: SendOptions<W>): Promise<SendReturn<W>>;
|
|
87
119
|
protected contextualizeError(err: Error, ...context: string[]): Error;
|
|
88
120
|
simulateUtility(call: FunctionCall, authwits?: AuthWitness[]): Promise<UtilitySimulationResult>;
|
|
89
|
-
getTxReceipt(txHash: TxHash): Promise<TxReceipt>;
|
|
90
121
|
getPrivateEvents<T>(eventDef: EventMetadataDefinition, eventFilter: PrivateEventFilter): Promise<PrivateEvent<T>[]>;
|
|
91
122
|
getContractMetadata(address: AztecAddress): Promise<{
|
|
92
123
|
instance: ContractInstanceWithAddress | undefined;
|
|
93
124
|
isContractInitialized: boolean;
|
|
94
125
|
isContractPublished: boolean;
|
|
95
|
-
isContractClassPubliclyRegistered: boolean;
|
|
96
126
|
isContractUpdated: boolean;
|
|
97
127
|
updatedContractClassId: Fr | undefined;
|
|
98
128
|
}>;
|
|
@@ -101,4 +131,4 @@ export declare abstract class BaseWallet implements Wallet {
|
|
|
101
131
|
isContractClassPubliclyRegistered: boolean;
|
|
102
132
|
}>;
|
|
103
133
|
}
|
|
104
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
134
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFzZV93YWxsZXQuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYX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E,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAIlG;IAEY,MAAM,CAAC,CAAC,SAAS,sBAAsB,GAAG,SAAS,EAC9D,gBAAgB,EAAE,gBAAgB,EAClC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAuBxB;IAED,SAAS,CAAC,kBAAkB,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,CAYpE;IAED,eAAe,CAAC,IAAI,EAAE,YAAY,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAE9F;IAEK,gBAAgB,CAAC,CAAC,EACtB,QAAQ,EAAE,uBAAuB,EACjC,WAAW,EAAE,kBAAkB,GAC9B,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAe5B;IAEK,mBAAmB,CAAC,OAAO,EAAE,YAAY;;;;;;OAe9C;IAEK,wBAAwB,CAAC,EAAE,EAAE,EAAE;;;OAMpC;CACF"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
2
|
+
import { waitForTx } from '@aztec/aztec.js/node';
|
|
1
3
|
import { GAS_ESTIMATION_DA_GAS_LIMIT, GAS_ESTIMATION_L2_GAS_LIMIT, GAS_ESTIMATION_TEARDOWN_DA_GAS_LIMIT, GAS_ESTIMATION_TEARDOWN_L2_GAS_LIMIT } from '@aztec/constants';
|
|
2
4
|
import { AccountFeePaymentMethodOptions } from '@aztec/entrypoints/account';
|
|
3
5
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
@@ -9,6 +11,7 @@ import { Gas, GasSettings } from '@aztec/stdlib/gas';
|
|
|
9
11
|
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
10
12
|
import { mergeExecutionPayloads } from '@aztec/stdlib/tx';
|
|
11
13
|
import { inspect } from 'util';
|
|
14
|
+
import { buildMergedSimulationResult, extractOptimizablePublicStaticCalls, simulateViaNode } from './utils.js';
|
|
12
15
|
/**
|
|
13
16
|
* A base class for Wallet implementations
|
|
14
17
|
*/ export class BaseWallet {
|
|
@@ -65,6 +68,21 @@ import { inspect } from 'util';
|
|
|
65
68
|
const chainInfo = await this.getChainInfo();
|
|
66
69
|
return account.createAuthWit(messageHashOrIntent, chainInfo);
|
|
67
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Request capabilities from the wallet.
|
|
73
|
+
*
|
|
74
|
+
* This method is wallet-implementation-dependent and must be provided by classes extending BaseWallet.
|
|
75
|
+
* Embedded wallets typically don't support capability-based authorization (no user authorization flow),
|
|
76
|
+
* while external wallets (browser extensions, hardware wallets) implement this to reduce authorization
|
|
77
|
+
* friction by allowing apps to request permissions upfront.
|
|
78
|
+
*
|
|
79
|
+
* TODO: Consider making it abstract so implementing it is a conscious decision. Leaving it as-is
|
|
80
|
+
* while the feature stabilizes.
|
|
81
|
+
*
|
|
82
|
+
* @param _manifest - Application capability manifest declaring what operations the app needs
|
|
83
|
+
*/ requestCapabilities(_manifest) {
|
|
84
|
+
throw new Error('Not implemented');
|
|
85
|
+
}
|
|
68
86
|
async batch(methods) {
|
|
69
87
|
const results = [];
|
|
70
88
|
for (const method of methods){
|
|
@@ -166,10 +184,38 @@ import { inspect } from 'util';
|
|
|
166
184
|
}
|
|
167
185
|
return instance;
|
|
168
186
|
}
|
|
169
|
-
|
|
187
|
+
/**
|
|
188
|
+
* Simulates calls through the standard PXE path (account entrypoint).
|
|
189
|
+
* @param executionPayload - The execution payload to simulate.
|
|
190
|
+
* @param from - The sender address.
|
|
191
|
+
* @param feeOptions - Fee options for the transaction.
|
|
192
|
+
* @param skipTxValidation - Whether to skip tx validation.
|
|
193
|
+
* @param skipFeeEnforcement - Whether to skip fee enforcement.
|
|
194
|
+
*/ async simulateViaEntrypoint(executionPayload, from, feeOptions, skipTxValidation, skipFeeEnforcement) {
|
|
195
|
+
const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(executionPayload, from, feeOptions);
|
|
196
|
+
return this.pxe.simulateTx(txRequest, true, skipTxValidation, skipFeeEnforcement);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Simulates a transaction, optimizing leading public static calls by running them directly
|
|
200
|
+
* on the node while sending the remaining calls through the standard PXE path.
|
|
201
|
+
* Return values from both paths are merged back in original call order.
|
|
202
|
+
* @param executionPayload - The execution payload to simulate.
|
|
203
|
+
* @param opts - Simulation options (from address, fee settings, etc.).
|
|
204
|
+
* @returns The merged simulation result.
|
|
205
|
+
*/ async simulateTx(executionPayload, opts) {
|
|
170
206
|
const feeOptions = opts.fee?.estimateGas ? await this.completeFeeOptionsForEstimation(opts.from, executionPayload.feePayer, opts.fee?.gasSettings) : await this.completeFeeOptions(opts.from, executionPayload.feePayer, opts.fee?.gasSettings);
|
|
171
|
-
const
|
|
172
|
-
|
|
207
|
+
const { optimizableCalls, remainingCalls } = extractOptimizablePublicStaticCalls(executionPayload);
|
|
208
|
+
const remainingPayload = {
|
|
209
|
+
...executionPayload,
|
|
210
|
+
calls: remainingCalls
|
|
211
|
+
};
|
|
212
|
+
const chainInfo = await this.getChainInfo();
|
|
213
|
+
const blockHeader = await this.pxe.getSyncedBlockHeader();
|
|
214
|
+
const [optimizedResults, normalResult] = await Promise.all([
|
|
215
|
+
optimizableCalls.length > 0 ? simulateViaNode(this.aztecNode, optimizableCalls, opts.from, chainInfo, feeOptions.gasSettings, blockHeader, opts.skipFeeEnforcement ?? true) : Promise.resolve([]),
|
|
216
|
+
remainingCalls.length > 0 ? this.simulateViaEntrypoint(remainingPayload, opts.from, feeOptions, opts.skipTxValidation, opts.skipFeeEnforcement ?? true) : Promise.resolve(null)
|
|
217
|
+
]);
|
|
218
|
+
return buildMergedSimulationResult(optimizedResults, normalResult);
|
|
173
219
|
}
|
|
174
220
|
async profileTx(executionPayload, opts) {
|
|
175
221
|
const feeOptions = await this.completeFeeOptions(opts.from, executionPayload.feePayer, opts.fee?.gasSettings);
|
|
@@ -190,7 +236,13 @@ import { inspect } from 'util';
|
|
|
190
236
|
throw this.contextualizeError(err, inspect(tx));
|
|
191
237
|
});
|
|
192
238
|
this.log.info(`Sent transaction ${txHash}`);
|
|
193
|
-
return txHash
|
|
239
|
+
// If wait is NO_WAIT, return txHash immediately
|
|
240
|
+
if (opts.wait === NO_WAIT) {
|
|
241
|
+
return txHash;
|
|
242
|
+
}
|
|
243
|
+
// Otherwise, wait for the full receipt (default behavior on wait: undefined)
|
|
244
|
+
const waitOpts = typeof opts.wait === 'object' ? opts.wait : undefined;
|
|
245
|
+
return await waitForTx(this.aztecNode, txHash, waitOpts);
|
|
194
246
|
}
|
|
195
247
|
contextualizeError(err, ...context) {
|
|
196
248
|
let contextStr = '';
|
|
@@ -208,9 +260,6 @@ import { inspect } from 'util';
|
|
|
208
260
|
simulateUtility(call, authwits) {
|
|
209
261
|
return this.pxe.simulateUtility(call, authwits);
|
|
210
262
|
}
|
|
211
|
-
getTxReceipt(txHash) {
|
|
212
|
-
return this.aztecNode.getTxReceipt(txHash);
|
|
213
|
-
}
|
|
214
263
|
async getPrivateEvents(eventDef, eventFilter) {
|
|
215
264
|
const pxeEvents = await this.pxe.getPrivateEvents(eventDef.eventSelector, eventFilter);
|
|
216
265
|
const decodedEvents = pxeEvents.map((pxeEvent)=>{
|
|
@@ -231,16 +280,12 @@ import { inspect } from 'util';
|
|
|
231
280
|
const instance = await this.pxe.getContractInstance(address);
|
|
232
281
|
const initNullifier = await siloNullifier(address, address.toField());
|
|
233
282
|
const publiclyRegisteredContract = await this.aztecNode.getContract(address);
|
|
234
|
-
const
|
|
235
|
-
this.aztecNode.getNullifierMembershipWitness('latest', initNullifier),
|
|
236
|
-
publiclyRegisteredContract ? this.aztecNode.getContractClass(publiclyRegisteredContract.currentContractClassId || instance?.currentContractClassId) : undefined
|
|
237
|
-
]);
|
|
283
|
+
const initNullifierMembershipWitness = await this.aztecNode.getNullifierMembershipWitness('latest', initNullifier);
|
|
238
284
|
const isContractUpdated = publiclyRegisteredContract && !publiclyRegisteredContract.currentContractClassId.equals(publiclyRegisteredContract.originalContractClassId);
|
|
239
285
|
return {
|
|
240
286
|
instance: instance ?? undefined,
|
|
241
287
|
isContractInitialized: !!initNullifierMembershipWitness,
|
|
242
288
|
isContractPublished: !!publiclyRegisteredContract,
|
|
243
|
-
isContractClassPubliclyRegistered: !!publiclyRegisteredContractClass,
|
|
244
289
|
isContractUpdated: !!isContractUpdated,
|
|
245
290
|
updatedContractClassId: isContractUpdated ? publiclyRegisteredContract.currentContractClassId : undefined
|
|
246
291
|
};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { BaseWallet, type FeeOptions } from './base_wallet.js';
|
|
2
|
-
|
|
2
|
+
export { simulateViaNode, buildMergedSimulationResult, extractOptimizablePublicStaticCalls } from './utils.js';
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYXNlLXdhbGxldC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLEtBQUssVUFBVSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDL0QsT0FBTyxFQUFFLGVBQWUsRUFBRSwyQkFBMkIsRUFBRSxtQ0FBbUMsRUFBRSxNQUFNLFlBQVksQ0FBQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/base-wallet/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/base-wallet/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,2BAA2B,EAAE,mCAAmC,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
2
|
+
import type { ChainInfo } from '@aztec/entrypoints/interfaces';
|
|
3
|
+
import { type FunctionCall } from '@aztec/stdlib/abi';
|
|
4
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
+
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
6
|
+
import { type BlockHeader, type ExecutionPayload, TxSimulationResult } from '@aztec/stdlib/tx';
|
|
7
|
+
/**
|
|
8
|
+
* Splits an execution payload into a leading prefix of public static calls
|
|
9
|
+
* (eligible for direct node simulation) and the remaining calls.
|
|
10
|
+
*
|
|
11
|
+
* Only a leading run of public static calls is eligible for optimization.
|
|
12
|
+
* Any non-public-static call may enqueue public state mutations
|
|
13
|
+
* (e.g. private calls can enqueue public calls), so all calls that follow
|
|
14
|
+
* must go through the normal simulation path to see the correct state.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
export declare function extractOptimizablePublicStaticCalls(payload: ExecutionPayload): {
|
|
18
|
+
/** Leading public static calls eligible for direct node simulation. */
|
|
19
|
+
optimizableCalls: FunctionCall[];
|
|
20
|
+
/** All remaining calls. */
|
|
21
|
+
remainingCalls: FunctionCall[];
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Simulates public static calls by splitting them into batches of MAX_ENQUEUED_CALLS_PER_CALL
|
|
25
|
+
* and sending each batch directly to the node.
|
|
26
|
+
*
|
|
27
|
+
* @param node - The Aztec node to simulate on.
|
|
28
|
+
* @param publicStaticCalls - Array of public static function calls to optimize.
|
|
29
|
+
* @param from - The account address making the calls.
|
|
30
|
+
* @param chainInfo - Chain information (chainId and version).
|
|
31
|
+
* @param gasSettings - Gas settings for the transaction.
|
|
32
|
+
* @param blockHeader - Block header to use as anchor.
|
|
33
|
+
* @param skipFeeEnforcement - Whether to skip fee enforcement during simulation.
|
|
34
|
+
* @returns Array of TxSimulationResult, one per batch.
|
|
35
|
+
*/
|
|
36
|
+
export declare function simulateViaNode(node: AztecNode, publicStaticCalls: FunctionCall[], from: AztecAddress, chainInfo: ChainInfo, gasSettings: GasSettings, blockHeader: BlockHeader, skipFeeEnforcement?: boolean): Promise<TxSimulationResult[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Merges simulation results from the optimized (public static) and normal paths.
|
|
39
|
+
* Since optimized calls are always a leading prefix, return values are simply
|
|
40
|
+
* concatenated: optimized first, then normal.
|
|
41
|
+
* Stats are taken from the normal result only (the optimized path doesn't produce them).
|
|
42
|
+
*
|
|
43
|
+
* @param optimizedResults - Results from optimized public static call batches.
|
|
44
|
+
* @param normalResult - Result from normal simulation (null if all calls were optimized).
|
|
45
|
+
* @returns A single TxSimulationResult with return values in original call order.
|
|
46
|
+
*/
|
|
47
|
+
export declare function buildMergedSimulationResult(optimizedResults: TxSimulationResult[], normalResult: TxSimulationResult | null): TxSimulationResult;
|
|
48
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYXNlLXdhbGxldC91dGlscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUV0RCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUsvRCxPQUFPLEVBQUUsS0FBSyxZQUFZLEVBQW9CLE1BQU0sbUJBQW1CLENBQUM7QUFDeEUsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZ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,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAK/D,OAAO,EAAE,KAAK,YAAY,EAAoB,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAQrD,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,gBAAgB,EAOrB,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;;GASG;AACH,wBAAgB,mCAAmC,CAAC,OAAO,EAAE,gBAAgB,GAAG;IAC9E,uEAAuE;IACvE,gBAAgB,EAAE,YAAY,EAAE,CAAC;IACjC,2BAA2B;IAC3B,cAAc,EAAE,YAAY,EAAE,CAAC;CAChC,CAOA;AAkGD;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,SAAS,EACf,iBAAiB,EAAE,YAAY,EAAE,EACjC,IAAI,EAAE,YAAY,EAClB,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,kBAAkB,GAAE,OAAc,GACjC,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAuB/B;AAED;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CACzC,gBAAgB,EAAE,kBAAkB,EAAE,EACtC,YAAY,EAAE,kBAAkB,GAAG,IAAI,GACtC,kBAAkB,CAoBpB"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { MAX_ENQUEUED_CALLS_PER_CALL } from '@aztec/constants';
|
|
2
|
+
import { makeTuple } from '@aztec/foundation/array';
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import { generateSimulatedProvingResult } from '@aztec/pxe/simulator';
|
|
5
|
+
import { ClaimedLengthArray, CountedPublicCallRequest, PrivateCircuitPublicInputs, PublicCallRequest } from '@aztec/stdlib/kernel';
|
|
6
|
+
import { ChonkProof } from '@aztec/stdlib/proofs';
|
|
7
|
+
import { HashedValues, PrivateCallExecutionResult, PrivateExecutionResult, Tx, TxContext, TxSimulationResult } from '@aztec/stdlib/tx';
|
|
8
|
+
/**
|
|
9
|
+
* Splits an execution payload into a leading prefix of public static calls
|
|
10
|
+
* (eligible for direct node simulation) and the remaining calls.
|
|
11
|
+
*
|
|
12
|
+
* Only a leading run of public static calls is eligible for optimization.
|
|
13
|
+
* Any non-public-static call may enqueue public state mutations
|
|
14
|
+
* (e.g. private calls can enqueue public calls), so all calls that follow
|
|
15
|
+
* must go through the normal simulation path to see the correct state.
|
|
16
|
+
*
|
|
17
|
+
*/ export function extractOptimizablePublicStaticCalls(payload) {
|
|
18
|
+
const splitIndex = payload.calls.findIndex((call)=>!call.isPublicStatic());
|
|
19
|
+
const boundary = splitIndex === -1 ? payload.calls.length : splitIndex;
|
|
20
|
+
return {
|
|
21
|
+
optimizableCalls: payload.calls.slice(0, boundary),
|
|
22
|
+
remainingCalls: payload.calls.slice(boundary)
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Simulates a batch of public static calls by bypassing account entrypoint and private execution,
|
|
27
|
+
* directly constructing a minimal Tx and calling node.simulatePublicCalls.
|
|
28
|
+
*
|
|
29
|
+
* @param node - The Aztec node to simulate on.
|
|
30
|
+
* @param publicStaticCalls - Array of public static function calls (max MAX_ENQUEUED_CALLS_PER_CALL).
|
|
31
|
+
* @param from - The account address making the calls.
|
|
32
|
+
* @param chainInfo - Chain information (chainId and version).
|
|
33
|
+
* @param gasSettings - Gas settings for the transaction.
|
|
34
|
+
* @param blockHeader - Block header to use as anchor.
|
|
35
|
+
* @param skipFeeEnforcement - Whether to skip fee enforcement during simulation.
|
|
36
|
+
* @returns TxSimulationResult with public return values.
|
|
37
|
+
*/ async function simulateBatchViaNode(node, publicStaticCalls, from, chainInfo, gasSettings, blockHeader, skipFeeEnforcement) {
|
|
38
|
+
const txContext = new TxContext(chainInfo.chainId, chainInfo.version, gasSettings);
|
|
39
|
+
const publicFunctionCalldata = [];
|
|
40
|
+
for (const call of publicStaticCalls){
|
|
41
|
+
const calldata = await HashedValues.fromCalldata([
|
|
42
|
+
call.selector.toField(),
|
|
43
|
+
...call.args
|
|
44
|
+
]);
|
|
45
|
+
publicFunctionCalldata.push(calldata);
|
|
46
|
+
}
|
|
47
|
+
const publicCallRequests = makeTuple(MAX_ENQUEUED_CALLS_PER_CALL, (i)=>{
|
|
48
|
+
const call = publicStaticCalls[i];
|
|
49
|
+
if (!call) {
|
|
50
|
+
return CountedPublicCallRequest.empty();
|
|
51
|
+
}
|
|
52
|
+
const publicCallRequest = new PublicCallRequest(from, call.to, call.isStatic, publicFunctionCalldata[i].hash);
|
|
53
|
+
// Counter starts at 1 (minRevertibleSideEffectCounter) so all calls are revertible
|
|
54
|
+
return new CountedPublicCallRequest(publicCallRequest, i + 1);
|
|
55
|
+
});
|
|
56
|
+
const publicCallRequestsArray = new ClaimedLengthArray(publicCallRequests, publicStaticCalls.length);
|
|
57
|
+
const publicInputs = PrivateCircuitPublicInputs.from({
|
|
58
|
+
...PrivateCircuitPublicInputs.empty(),
|
|
59
|
+
anchorBlockHeader: blockHeader,
|
|
60
|
+
txContext: txContext,
|
|
61
|
+
publicCallRequests: publicCallRequestsArray,
|
|
62
|
+
startSideEffectCounter: new Fr(0),
|
|
63
|
+
endSideEffectCounter: new Fr(publicStaticCalls.length + 1)
|
|
64
|
+
});
|
|
65
|
+
// Minimal entrypoint structure — no real private execution, just public call requests
|
|
66
|
+
const emptyEntrypoint = new PrivateCallExecutionResult(Buffer.alloc(0), Buffer.alloc(0), new Map(), publicInputs, [], new Map(), [], [], [], [], []);
|
|
67
|
+
const privateResult = new PrivateExecutionResult(emptyEntrypoint, Fr.random(), publicFunctionCalldata);
|
|
68
|
+
const provingResult = await generateSimulatedProvingResult(privateResult, (_contractAddress, _functionSelector)=>Promise.resolve(''), 1);
|
|
69
|
+
provingResult.publicInputs.feePayer = from;
|
|
70
|
+
const tx = await Tx.create({
|
|
71
|
+
data: provingResult.publicInputs,
|
|
72
|
+
chonkProof: ChonkProof.empty(),
|
|
73
|
+
contractClassLogFields: [],
|
|
74
|
+
publicFunctionCalldata: publicFunctionCalldata
|
|
75
|
+
});
|
|
76
|
+
const publicOutput = await node.simulatePublicCalls(tx, skipFeeEnforcement);
|
|
77
|
+
if (publicOutput.revertReason) {
|
|
78
|
+
throw publicOutput.revertReason;
|
|
79
|
+
}
|
|
80
|
+
return new TxSimulationResult(privateResult, provingResult.publicInputs, publicOutput, undefined);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Simulates public static calls by splitting them into batches of MAX_ENQUEUED_CALLS_PER_CALL
|
|
84
|
+
* and sending each batch directly to the node.
|
|
85
|
+
*
|
|
86
|
+
* @param node - The Aztec node to simulate on.
|
|
87
|
+
* @param publicStaticCalls - Array of public static function calls to optimize.
|
|
88
|
+
* @param from - The account address making the calls.
|
|
89
|
+
* @param chainInfo - Chain information (chainId and version).
|
|
90
|
+
* @param gasSettings - Gas settings for the transaction.
|
|
91
|
+
* @param blockHeader - Block header to use as anchor.
|
|
92
|
+
* @param skipFeeEnforcement - Whether to skip fee enforcement during simulation.
|
|
93
|
+
* @returns Array of TxSimulationResult, one per batch.
|
|
94
|
+
*/ export async function simulateViaNode(node, publicStaticCalls, from, chainInfo, gasSettings, blockHeader, skipFeeEnforcement = true) {
|
|
95
|
+
const batches = [];
|
|
96
|
+
for(let i = 0; i < publicStaticCalls.length; i += MAX_ENQUEUED_CALLS_PER_CALL){
|
|
97
|
+
batches.push(publicStaticCalls.slice(i, i + MAX_ENQUEUED_CALLS_PER_CALL));
|
|
98
|
+
}
|
|
99
|
+
const results = [];
|
|
100
|
+
for (const batch of batches){
|
|
101
|
+
const result = await simulateBatchViaNode(node, batch, from, chainInfo, gasSettings, blockHeader, skipFeeEnforcement);
|
|
102
|
+
results.push(result);
|
|
103
|
+
}
|
|
104
|
+
return results;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Merges simulation results from the optimized (public static) and normal paths.
|
|
108
|
+
* Since optimized calls are always a leading prefix, return values are simply
|
|
109
|
+
* concatenated: optimized first, then normal.
|
|
110
|
+
* Stats are taken from the normal result only (the optimized path doesn't produce them).
|
|
111
|
+
*
|
|
112
|
+
* @param optimizedResults - Results from optimized public static call batches.
|
|
113
|
+
* @param normalResult - Result from normal simulation (null if all calls were optimized).
|
|
114
|
+
* @returns A single TxSimulationResult with return values in original call order.
|
|
115
|
+
*/ export function buildMergedSimulationResult(optimizedResults, normalResult) {
|
|
116
|
+
const optimizedReturnValues = optimizedResults.flatMap((r)=>r.publicOutput?.publicReturnValues ?? []);
|
|
117
|
+
const normalReturnValues = normalResult?.publicOutput?.publicReturnValues ?? [];
|
|
118
|
+
const allReturnValues = [
|
|
119
|
+
...optimizedReturnValues,
|
|
120
|
+
...normalReturnValues
|
|
121
|
+
];
|
|
122
|
+
const baseResult = normalResult ?? optimizedResults[0];
|
|
123
|
+
const mergedPublicOutput = baseResult.publicOutput ? {
|
|
124
|
+
...baseResult.publicOutput,
|
|
125
|
+
publicReturnValues: allReturnValues
|
|
126
|
+
} : undefined;
|
|
127
|
+
return new TxSimulationResult(baseResult.privateExecutionResult, baseResult.publicInputs, mergedPublicOutput, normalResult?.stats);
|
|
128
|
+
}
|
package/dest/crypto.d.ts
CHANGED
|
@@ -36,11 +36,23 @@ export interface SecureKeyPair {
|
|
|
36
36
|
/** Private key - keep secret, used for key derivation */
|
|
37
37
|
privateKey: CryptoKey;
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Session keys derived from ECDH key exchange.
|
|
41
|
+
*
|
|
42
|
+
* Contains both the encryption key and the verification hash (verificationHash)
|
|
43
|
+
* computed from a separate HMAC key.
|
|
44
|
+
*/
|
|
45
|
+
export interface SessionKeys {
|
|
46
|
+
/** AES-256-GCM key for message encryption/decryption */
|
|
47
|
+
encryptionKey: CryptoKey;
|
|
48
|
+
/** Hex-encoded verificationHash for verification */
|
|
49
|
+
verificationHash: string;
|
|
50
|
+
}
|
|
39
51
|
/**
|
|
40
52
|
* Generates an ECDH P-256 key pair for key exchange.
|
|
41
53
|
*
|
|
42
|
-
* The generated key pair can be used to derive
|
|
43
|
-
* party's public key using {@link
|
|
54
|
+
* The generated key pair can be used to derive session keys with another
|
|
55
|
+
* party's public key using {@link deriveSessionKeys}.
|
|
44
56
|
*
|
|
45
57
|
* @returns A new ECDH key pair
|
|
46
58
|
*
|
|
@@ -72,65 +84,71 @@ export declare function exportPublicKey(publicKey: CryptoKey): Promise<ExportedP
|
|
|
72
84
|
/**
|
|
73
85
|
* Imports a public key from JWK format.
|
|
74
86
|
*
|
|
75
|
-
* Used to import the other party's public key for deriving
|
|
87
|
+
* Used to import the other party's public key for deriving session keys.
|
|
76
88
|
*
|
|
77
89
|
* @param exported - The public key in JWK format
|
|
78
|
-
* @returns A CryptoKey that can be used with {@link
|
|
90
|
+
* @returns A CryptoKey that can be used with {@link deriveSessionKeys}
|
|
79
91
|
*
|
|
80
92
|
* @example
|
|
81
93
|
* ```typescript
|
|
82
|
-
* //
|
|
83
|
-
* const
|
|
84
|
-
* const
|
|
94
|
+
* // App side: receive wallet's public key and derive session
|
|
95
|
+
* const walletPublicKey = await importPublicKey(receivedWalletKey);
|
|
96
|
+
* const session = await deriveSessionKeys(appKeyPair, walletPublicKey, true);
|
|
85
97
|
* ```
|
|
86
98
|
*/
|
|
87
99
|
export declare function importPublicKey(exported: ExportedPublicKey): Promise<CryptoKey>;
|
|
88
100
|
/**
|
|
89
|
-
* Derives
|
|
101
|
+
* Derives session keys from ECDH key exchange using HKDF.
|
|
102
|
+
*
|
|
103
|
+
* This is the main key derivation function that produces:
|
|
104
|
+
* 1. An AES-256-GCM encryption key (first 256 bits)
|
|
105
|
+
* 2. An HMAC key for verificationHash computation (second 256 bits)
|
|
106
|
+
* 3. A verificationHash computed as HMAC(hmacKey, "aztec-wallet-verification-verificationHash")
|
|
90
107
|
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
108
|
+
* The keys are derived using a single HKDF call that produces 512 bits,
|
|
109
|
+
* then split into the two keys.
|
|
93
110
|
*
|
|
94
|
-
* @param
|
|
95
|
-
* @param
|
|
96
|
-
* @
|
|
111
|
+
* @param ownKeyPair - The caller's ECDH key pair (private for ECDH, public for salt)
|
|
112
|
+
* @param peerPublicKey - The peer's ECDH public key (for ECDH and salt)
|
|
113
|
+
* @param isApp - true if caller is the app, false if caller is the wallet
|
|
114
|
+
* @returns Session keys containing encryption key and verificationHash
|
|
97
115
|
*
|
|
98
116
|
* @example
|
|
99
117
|
* ```typescript
|
|
100
|
-
* //
|
|
101
|
-
* const
|
|
102
|
-
*
|
|
103
|
-
*
|
|
118
|
+
* // App side
|
|
119
|
+
* const sessionA = await deriveSessionKeys(appKeyPair, walletPublicKey, true);
|
|
120
|
+
* // Wallet side
|
|
121
|
+
* const sessionB = await deriveSessionKeys(walletKeyPair, appPublicKey, false);
|
|
122
|
+
* // sessionA.verificationHash === sessionB.verificationHash
|
|
104
123
|
* ```
|
|
105
124
|
*/
|
|
106
|
-
export declare function
|
|
125
|
+
export declare function deriveSessionKeys(ownKeyPair: SecureKeyPair, peerPublicKey: CryptoKey, isApp: boolean): Promise<SessionKeys>;
|
|
107
126
|
/**
|
|
108
127
|
* Encrypts data using AES-256-GCM.
|
|
109
128
|
*
|
|
110
|
-
*
|
|
111
|
-
* generated for each encryption operation.
|
|
129
|
+
* A random 12-byte IV is generated for each encryption operation.
|
|
112
130
|
*
|
|
113
131
|
* AES-GCM provides both confidentiality and authenticity - any tampering
|
|
114
132
|
* with the ciphertext will cause decryption to fail.
|
|
115
133
|
*
|
|
116
|
-
* @param key - The AES-GCM key (from {@link
|
|
117
|
-
* @param data - The data to encrypt (
|
|
134
|
+
* @param key - The AES-GCM key (from {@link deriveSessionKeys})
|
|
135
|
+
* @param data - The string data to encrypt (caller is responsible for serialization)
|
|
118
136
|
* @returns The encrypted payload with IV and ciphertext
|
|
119
137
|
*
|
|
120
138
|
* @example
|
|
121
139
|
* ```typescript
|
|
122
|
-
* const encrypted = await encrypt(
|
|
140
|
+
* const encrypted = await encrypt(session.encryptionKey, JSON.stringify({ action: 'transfer', amount: 100 }));
|
|
123
141
|
* // encrypted.iv and encrypted.ciphertext are base64 strings
|
|
124
142
|
* ```
|
|
125
143
|
*/
|
|
126
|
-
export declare function encrypt(key: CryptoKey, data:
|
|
144
|
+
export declare function encrypt(key: CryptoKey, data: string): Promise<EncryptedPayload>;
|
|
127
145
|
/**
|
|
128
146
|
* Decrypts data using AES-256-GCM.
|
|
129
147
|
*
|
|
130
148
|
* The decrypted data is JSON parsed before returning.
|
|
131
149
|
*
|
|
132
150
|
* @typeParam T - The expected type of the decrypted data
|
|
133
|
-
* @param key - The AES-GCM key (from {@link
|
|
151
|
+
* @param key - The AES-GCM key (from {@link deriveSessionKeys})
|
|
134
152
|
* @param payload - The encrypted payload from {@link encrypt}
|
|
135
153
|
* @returns The decrypted and parsed data
|
|
136
154
|
*
|
|
@@ -138,46 +156,37 @@ export declare function encrypt(key: CryptoKey, data: unknown): Promise<Encrypte
|
|
|
138
156
|
*
|
|
139
157
|
* @example
|
|
140
158
|
* ```typescript
|
|
141
|
-
* const decrypted = await decrypt<{ action: string; amount: number }>(
|
|
159
|
+
* const decrypted = await decrypt<{ action: string; amount: number }>(session.encryptionKey, encrypted);
|
|
142
160
|
* console.log(decrypted.action); // 'transfer'
|
|
143
161
|
* ```
|
|
144
162
|
*/
|
|
145
163
|
export declare function decrypt<T = unknown>(key: CryptoKey, payload: EncryptedPayload): Promise<T>;
|
|
146
164
|
/**
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
* This extracts the raw key material and hashes it with SHA-256,
|
|
150
|
-
* returning the first 16 bytes as a hex string.
|
|
151
|
-
*
|
|
152
|
-
* @param sharedKey - The AES-GCM shared key (must be extractable)
|
|
153
|
-
* @returns A hex string representation of the hash
|
|
154
|
-
*
|
|
155
|
-
* @example
|
|
156
|
-
* ```typescript
|
|
157
|
-
* const hash = await hashSharedSecret(sharedKey);
|
|
158
|
-
* const emoji = hashToEmoji(hash);
|
|
159
|
-
* ```
|
|
165
|
+
* Default grid size for emoji verification display.
|
|
166
|
+
* 3x3 grid = 9 emojis = 72 bits of security.
|
|
160
167
|
*/
|
|
161
|
-
export declare
|
|
168
|
+
export declare const DEFAULT_EMOJI_GRID_SIZE = 9;
|
|
162
169
|
/**
|
|
163
170
|
* Converts a hex hash to an emoji sequence for visual verification.
|
|
164
171
|
*
|
|
165
|
-
* This is used for
|
|
166
|
-
* independently compute the same emoji sequence from the
|
|
172
|
+
* This is used for verification - both the dApp and wallet
|
|
173
|
+
* independently compute the same emoji sequence from the derived keys.
|
|
167
174
|
* Users can visually compare the sequences to detect interception.
|
|
168
175
|
*
|
|
169
|
-
*
|
|
176
|
+
* With a 256-emoji alphabet and 9 emojis (3x3 grid), this provides
|
|
177
|
+
* 72 bits of security (9 * 8 = 72 bits), making brute-force attacks
|
|
178
|
+
* computationally infeasible.
|
|
170
179
|
*
|
|
171
|
-
* @param hash - Hex string from
|
|
172
|
-
* @param
|
|
180
|
+
* @param hash - Hex string from verification hash (64 chars = 32 bytes)
|
|
181
|
+
* @param count - Number of emojis to generate (default: 9 for 3x3 grid)
|
|
173
182
|
* @returns A string of emojis representing the hash
|
|
174
183
|
*
|
|
175
184
|
* @example
|
|
176
185
|
* ```typescript
|
|
177
|
-
* const
|
|
178
|
-
* const emoji = hashToEmoji(
|
|
179
|
-
* // Display to user for verification
|
|
186
|
+
* const session = await deriveSessionKeys(...);
|
|
187
|
+
* const emoji = hashToEmoji(session.verificationHash); // e.g., "🔵🦋🎯🐼🌟🎲🦊🐸💎"
|
|
188
|
+
* // Display as 3x3 grid to user for verification
|
|
180
189
|
* ```
|
|
181
190
|
*/
|
|
182
|
-
export declare function hashToEmoji(hash: string,
|
|
183
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
191
|
+
export declare function hashToEmoji(h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