@aztec/node-keystore 3.0.0-devnet.5 → 3.0.0-devnet.6-patch.1
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/dest/config.d.ts +1 -1
- package/dest/index.d.ts +1 -1
- package/dest/keystore_manager.d.ts +2 -2
- package/dest/keystore_manager.d.ts.map +1 -1
- package/dest/loader.d.ts +1 -1
- package/dest/loader.d.ts.map +1 -1
- package/dest/loader.js +25 -17
- package/dest/schemas.d.ts +397 -397
- package/dest/schemas.d.ts.map +1 -1
- package/dest/schemas.js +12 -12
- package/dest/signer.d.ts +2 -17
- package/dest/signer.d.ts.map +1 -1
- package/dest/signer.js +7 -6
- package/dest/types.d.ts +13 -11
- package/dest/types.d.ts.map +1 -1
- package/package.json +8 -7
- package/src/keystore_manager.ts +3 -3
- package/src/loader.ts +20 -11
- package/src/schemas.ts +56 -41
- package/src/signer.ts +8 -11
- package/src/types.ts +12 -9
package/dest/schemas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG/D,eAAO,MAAM,mBAAmB,kDAGK,CAAC;AACtC,eAAO,MAAM,mBAAmB,kDAGK,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG/D,eAAO,MAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAavB,CAAC"}
|
package/dest/schemas.js
CHANGED
|
@@ -14,7 +14,7 @@ const remoteSignerConfigSchema = z.union([
|
|
|
14
14
|
remoteSignerUrl: urlSchema,
|
|
15
15
|
certPath: optional(z.string()),
|
|
16
16
|
certPass: optional(z.string())
|
|
17
|
-
})
|
|
17
|
+
}).strict()
|
|
18
18
|
]);
|
|
19
19
|
// Remote signer account schema
|
|
20
20
|
const remoteSignerAccountSchema = z.union([
|
|
@@ -24,13 +24,13 @@ const remoteSignerAccountSchema = z.union([
|
|
|
24
24
|
remoteSignerUrl: urlSchema,
|
|
25
25
|
certPath: optional(z.string()),
|
|
26
26
|
certPass: optional(z.string())
|
|
27
|
-
})
|
|
27
|
+
}).strict()
|
|
28
28
|
]);
|
|
29
|
-
// JSON V3
|
|
30
|
-
const
|
|
29
|
+
// Encrypted keystore file schema (used for both JSON V3 ETH keys and EIP-2335 BLS keys)
|
|
30
|
+
const encryptedKeyFileSchema = z.object({
|
|
31
31
|
path: z.string(),
|
|
32
32
|
password: optional(z.string())
|
|
33
|
-
});
|
|
33
|
+
}).strict();
|
|
34
34
|
// Mnemonic config schema
|
|
35
35
|
const mnemonicConfigSchema = z.object({
|
|
36
36
|
mnemonic: z.string().min(1, 'Mnemonic cannot be empty'),
|
|
@@ -38,12 +38,12 @@ const mnemonicConfigSchema = z.object({
|
|
|
38
38
|
accountIndex: z.number().int().min(0).default(0),
|
|
39
39
|
addressCount: z.number().int().min(1).default(1),
|
|
40
40
|
accountCount: z.number().int().min(1).default(1)
|
|
41
|
-
});
|
|
41
|
+
}).strict();
|
|
42
42
|
// EthAccount schema
|
|
43
43
|
const ethAccountSchema = z.union([
|
|
44
44
|
ethPrivateKeySchema,
|
|
45
45
|
remoteSignerAccountSchema,
|
|
46
|
-
|
|
46
|
+
encryptedKeyFileSchema
|
|
47
47
|
]);
|
|
48
48
|
// EthAccounts schema
|
|
49
49
|
const ethAccountsSchema = z.union([
|
|
@@ -54,7 +54,7 @@ const ethAccountsSchema = z.union([
|
|
|
54
54
|
// BLSAccount schema
|
|
55
55
|
const blsAccountSchema = z.union([
|
|
56
56
|
blsPrivateKeySchema,
|
|
57
|
-
|
|
57
|
+
encryptedKeyFileSchema
|
|
58
58
|
]);
|
|
59
59
|
// AttesterAccount schema: either EthAccount or { eth: EthAccount, bls?: BLSAccount }
|
|
60
60
|
const attesterAccountSchema = z.union([
|
|
@@ -62,7 +62,7 @@ const attesterAccountSchema = z.union([
|
|
|
62
62
|
z.object({
|
|
63
63
|
eth: ethAccountSchema,
|
|
64
64
|
bls: optional(blsAccountSchema)
|
|
65
|
-
})
|
|
65
|
+
}).strict()
|
|
66
66
|
]);
|
|
67
67
|
// AttesterAccounts schema: AttesterAccount | AttesterAccount[] | MnemonicConfig
|
|
68
68
|
const attesterAccountsSchema = z.union([
|
|
@@ -76,7 +76,7 @@ const proverKeyStoreSchema = z.union([
|
|
|
76
76
|
z.object({
|
|
77
77
|
id: schemas.EthAddress,
|
|
78
78
|
publisher: ethAccountsSchema
|
|
79
|
-
})
|
|
79
|
+
}).strict()
|
|
80
80
|
]);
|
|
81
81
|
// Validator keystore schema
|
|
82
82
|
const validatorKeyStoreSchema = z.object({
|
|
@@ -86,7 +86,7 @@ const validatorKeyStoreSchema = z.object({
|
|
|
86
86
|
feeRecipient: AztecAddress.schema,
|
|
87
87
|
remoteSigner: optional(remoteSignerConfigSchema),
|
|
88
88
|
fundingAccount: optional(ethAccountSchema)
|
|
89
|
-
});
|
|
89
|
+
}).strict();
|
|
90
90
|
// Main keystore schema
|
|
91
91
|
export const keystoreSchema = z.object({
|
|
92
92
|
schemaVersion: z.literal(1),
|
|
@@ -95,7 +95,7 @@ export const keystoreSchema = z.object({
|
|
|
95
95
|
remoteSigner: optional(remoteSignerConfigSchema),
|
|
96
96
|
prover: optional(proverKeyStoreSchema),
|
|
97
97
|
fundingAccount: optional(ethAccountSchema)
|
|
98
|
-
}).refine((data)=>data.validators || data.prover, {
|
|
98
|
+
}).strict().refine((data)=>data.validators || data.prover, {
|
|
99
99
|
message: 'Keystore must have at least validators or prover configuration',
|
|
100
100
|
path: [
|
|
101
101
|
'root'
|
package/dest/signer.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Common interface for different signing backends (local, remote, encrypted)
|
|
5
5
|
*/
|
|
6
|
-
import type { EthSigner } from '@aztec/ethereum';
|
|
6
|
+
import type { EthSigner } from '@aztec/ethereum/eth-signer';
|
|
7
7
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
8
8
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
9
9
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
@@ -56,24 +56,9 @@ export declare class RemoteSigner implements EthSigner {
|
|
|
56
56
|
*/
|
|
57
57
|
signTypedData(typedData: TypedDataDefinition): Promise<Signature>;
|
|
58
58
|
signTransaction(transaction: TransactionSerializable): Promise<Signature>;
|
|
59
|
-
/**
|
|
60
|
-
* Make a JSON-RPC sign request using eth_sign
|
|
61
|
-
*/
|
|
62
|
-
/**
|
|
63
|
-
* Make a JSON-RPC eth_sign request.
|
|
64
|
-
*/
|
|
65
59
|
private makeJsonRpcSignRequest;
|
|
66
|
-
/**
|
|
67
|
-
* Make a JSON-RPC eth_signTypedData_v4 request.
|
|
68
|
-
*/
|
|
69
60
|
private makeJsonRpcSignTypedDataRequest;
|
|
70
|
-
/**
|
|
71
|
-
* Make a JSON-RPC eth_signTransaction request.
|
|
72
|
-
*/
|
|
73
61
|
private makeJsonRpcSignTransactionRequest;
|
|
74
|
-
/**
|
|
75
|
-
* Sends a JSON-RPC request and returns its result
|
|
76
|
-
*/
|
|
77
62
|
private makeJsonRpcRequest;
|
|
78
63
|
/**
|
|
79
64
|
* Resolve the effective remote signer URL from config.
|
|
@@ -84,4 +69,4 @@ export declare class RemoteSigner implements EthSigner {
|
|
|
84
69
|
*/
|
|
85
70
|
private generateId;
|
|
86
71
|
}
|
|
87
|
-
//# sourceMappingURL=
|
|
72
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2lnbmVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvc2lnbmVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7O0dBSUc7QUFDSCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQztBQUM1RCxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFHcEQsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFDaEUsT0FBTyxFQUFFLFNBQVMsRUFBaUMsTUFBTSxpQ0FBaUMsQ0FBQztBQUkzRixPQUFPLEVBQ0wsS0FBSyx1QkFBdUIsRUFDNUIsS0FBSyxtQkFBbUIsRUFLekIsTUFBTSxNQUFNLENBQUM7QUFFZCxPQUFPLEtBQUssRUFBRSxxQkFBcUIsRUFBRSxNQUFNLFlBQVksQ0FBQztBQUV4RDs7R0F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7T0FNRztJQUNILE9BQWEsY0FBYyxDQUN6QixlQUFlLEVBQUUscUJBQXFCLEVBQ3RDLFNBQVMsRUFBRSxNQUFNLEVBQUUsRUFDbkIsS0FBSyxHQUFFLE9BQU8sVUFBVSxDQUFDLEtBQXdCLEdBQ2hELE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0ErRGY7SUFFRDs7T0FFRztJQUNHLFdBQVcsQ0FBQyxPQUFPLEVBQUUsUUFBUSxHQUFHLE9BQU8sQ0FBQyxTQUFTLENBQUMsQ0FFdkQ7SUFFRDs7T0FFRztJQUNHLGFBQWEsQ0FBQyxTQUFTLEVBQUUsbUJBQW1CLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUV0RTtJQUVELGVBQWUsQ0FBQyxXQUFXLEVBQUUsdUJBQXVCLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUV4RTtZQVFhLHNCQUFzQjtZQWlCdEIsK0JBQStCO1lBcUIvQixpQ0FBaUM7WUE4Q2pDLGtCQUFrQjtJQXlDaEM7O09BRUc7SUFDSCxPQUFPLENBQUMsWUFBWTtJQU9wQjs7T0FFRztJQUNILE9BQU8sQ0FBQyxVQUFVO0NBR25CIn0=
|
package/dest/signer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAiC,MAAM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AC,CA+Df;IAED;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,CAEvD;IAED;;OAEG;IACG,aAAa,CAAC,SAAS,EAAE,mBAAmB,GAAG,OAAO,CAAC,SAAS,CAAC,CAEtE;IAED,eAAe,CAAC,WAAW,EAAE,uBAAuB,GAAG,OAAO,CAAC,SAAS,CAAC,CAExE;YAQa,sBAAsB;YAiBtB,+BAA+B;YAqB/B,iCAAiC;YA8CjC,kBAAkB;IAyChC;;OAEG;IACH,OAAO,CAAC,YAAY;IAOpB;;OAEG;IACH,OAAO,CAAC,UAAU;CAGnB"}
|
package/dest/signer.js
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Common interface for different signing backends (local, remote, encrypted)
|
|
5
5
|
*/ import { Buffer32 } from '@aztec/foundation/buffer';
|
|
6
|
-
import {
|
|
6
|
+
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
7
|
+
import { Secp256k1Signer, toRecoveryBit } from '@aztec/foundation/crypto/secp256k1-signer';
|
|
7
8
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
8
9
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
9
|
-
import { withHexPrefix } from '@aztec/foundation/string';
|
|
10
|
+
import { bufferToHex, withHexPrefix } from '@aztec/foundation/string';
|
|
10
11
|
import { hashTypedData, keccak256, parseTransaction, serializeTransaction } from 'viem';
|
|
11
12
|
/**
|
|
12
13
|
* Error thrown for remote signer HTTP or JSON-RPC failures
|
|
@@ -155,9 +156,6 @@ import { hashTypedData, keccak256, parseTransaction, serializeTransaction } from
|
|
|
155
156
|
/**
|
|
156
157
|
* Make a JSON-RPC eth_signTransaction request.
|
|
157
158
|
*/ async makeJsonRpcSignTransactionRequest(tx) {
|
|
158
|
-
if (tx.type !== 'eip1559') {
|
|
159
|
-
throw new Error('This signer does not support tx type: ' + tx.type);
|
|
160
|
-
}
|
|
161
159
|
const txObject = {
|
|
162
160
|
from: this.address.toString(),
|
|
163
161
|
to: tx.to ?? null,
|
|
@@ -166,7 +164,10 @@ import { hashTypedData, keccak256, parseTransaction, serializeTransaction } from
|
|
|
166
164
|
nonce: typeof tx.nonce !== 'undefined' ? withHexPrefix(tx.nonce.toString(16)) : undefined,
|
|
167
165
|
gas: typeof tx.gas !== 'undefined' ? withHexPrefix(tx.gas.toString(16)) : undefined,
|
|
168
166
|
maxFeePerGas: typeof tx.maxFeePerGas !== 'undefined' ? withHexPrefix(tx.maxFeePerGas.toString(16)) : undefined,
|
|
169
|
-
maxPriorityFeePerGas: typeof tx.maxPriorityFeePerGas !== 'undefined' ? withHexPrefix(tx.maxPriorityFeePerGas.toString(16)) : undefined
|
|
167
|
+
maxPriorityFeePerGas: typeof tx.maxPriorityFeePerGas !== 'undefined' ? withHexPrefix(tx.maxPriorityFeePerGas.toString(16)) : undefined,
|
|
168
|
+
maxFeePerBlobGas: typeof tx.maxFeePerBlobGas !== 'undefined' ? withHexPrefix(tx.maxFeePerBlobGas.toString(16)) : undefined,
|
|
169
|
+
blobVersionedHashes: tx.blobVersionedHashes,
|
|
170
|
+
blobs: tx.blobs?.map((blob)=>typeof blob === 'string' ? blob : bufferToHex(Buffer.from(blob)))
|
|
170
171
|
};
|
|
171
172
|
let rawTxHex = await this.makeJsonRpcRequest('eth_signTransaction', txObject);
|
|
172
173
|
if (typeof rawTxHex !== 'string') {
|
package/dest/types.d.ts
CHANGED
|
@@ -6,13 +6,15 @@
|
|
|
6
6
|
* their associated keys and addresses.
|
|
7
7
|
*/
|
|
8
8
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
9
|
+
import type { Hex } from '@aztec/foundation/string';
|
|
9
10
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
/**
|
|
12
|
+
* An encrypted keystore file config points to a local file with an encrypted private key.
|
|
13
|
+
* The file may be in different formats:
|
|
14
|
+
* - JSON V3 format for ETH keys (Ethereum wallet standard)
|
|
15
|
+
* - EIP-2335 format for BLS keys (Ethereum 2.0 validator standard)
|
|
16
|
+
*/
|
|
17
|
+
export type EncryptedKeyFileConfig = {
|
|
16
18
|
path: string;
|
|
17
19
|
password?: string;
|
|
18
20
|
};
|
|
@@ -40,8 +42,8 @@ export type EthRemoteSignerAccount = EthAddress | {
|
|
|
40
42
|
certPath?: string;
|
|
41
43
|
certPass?: string;
|
|
42
44
|
};
|
|
43
|
-
/** An L1 account is a private key, a remote signer configuration, or
|
|
44
|
-
export type EthAccount = EthPrivateKey | EthRemoteSignerAccount |
|
|
45
|
+
/** An L1 account is a private key, a remote signer configuration, or an encrypted keystore file (JSON V3 format) */
|
|
46
|
+
export type EthAccount = EthPrivateKey | EthRemoteSignerAccount | EncryptedKeyFileConfig;
|
|
45
47
|
/** A mnemonic can be used to define a set of accounts */
|
|
46
48
|
export type MnemonicConfig = {
|
|
47
49
|
mnemonic: string;
|
|
@@ -59,8 +61,8 @@ export type ProverKeyStoreWithId = {
|
|
|
59
61
|
publisher: EthAccounts;
|
|
60
62
|
};
|
|
61
63
|
export type ProverKeyStore = ProverKeyStoreWithId | EthAccount;
|
|
62
|
-
/** A BLS account is either a private key, or
|
|
63
|
-
export type BLSAccount = BLSPrivateKey |
|
|
64
|
+
/** A BLS account is either a private key, or an EIP-2335 encrypted keystore file */
|
|
65
|
+
export type BLSAccount = BLSPrivateKey | EncryptedKeyFileConfig;
|
|
64
66
|
/** An AttesterAccount is a combined EthAccount and optional BLSAccount */
|
|
65
67
|
export type AttesterAccount = {
|
|
66
68
|
eth: EthAccount;
|
|
@@ -111,4 +113,4 @@ export type KeyStore = {
|
|
|
111
113
|
/** Used for automatically funding publisher accounts if there is none defined in the corresponding ValidatorKeyStore*/
|
|
112
114
|
fundingAccount?: EthAccount;
|
|
113
115
|
};
|
|
114
|
-
//# sourceMappingURL=
|
|
116
|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AA0E;IAC1E,YAAY,CAAC,EAAE,qBAAqB,CAAC;IACrC,sEAAsE;IACtE,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,wHAAwH;IACxH,cAAc,CAAC,EAAE,UAAU,CAAC;CAC7B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/node-keystore",
|
|
3
|
-
"version": "3.0.0-devnet.
|
|
3
|
+
"version": "3.0.0-devnet.6-patch.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"tsconfig": "./tsconfig.json"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
|
-
"build": "yarn clean && tsc
|
|
20
|
-
"build:dev": "tsc
|
|
19
|
+
"build": "yarn clean && ../scripts/tsc.sh",
|
|
20
|
+
"build:dev": "../scripts/tsc.sh --watch",
|
|
21
21
|
"clean": "rm -rf ./dest .tsbuildinfo",
|
|
22
22
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
|
|
23
23
|
},
|
|
@@ -62,18 +62,19 @@
|
|
|
62
62
|
]
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@aztec/ethereum": "3.0.0-devnet.
|
|
66
|
-
"@aztec/foundation": "3.0.0-devnet.
|
|
67
|
-
"@aztec/stdlib": "3.0.0-devnet.
|
|
65
|
+
"@aztec/ethereum": "3.0.0-devnet.6-patch.1",
|
|
66
|
+
"@aztec/foundation": "3.0.0-devnet.6-patch.1",
|
|
67
|
+
"@aztec/stdlib": "3.0.0-devnet.6-patch.1",
|
|
68
68
|
"@ethersproject/wallet": "^5.7.0",
|
|
69
69
|
"tslib": "^2.4.0",
|
|
70
|
-
"viem": "npm:@
|
|
70
|
+
"viem": "npm:@aztec/viem@2.38.2",
|
|
71
71
|
"zod": "^3.23.8"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@jest/globals": "^30.0.0",
|
|
75
75
|
"@types/jest": "^30.0.0",
|
|
76
76
|
"@types/node": "^22.15.17",
|
|
77
|
+
"@typescript/native-preview": "7.0.0-dev.20251126.1",
|
|
77
78
|
"jest": "^30.0.0",
|
|
78
79
|
"ts-node": "^10.9.1",
|
|
79
80
|
"typescript": "^5.3.3"
|
package/src/keystore_manager.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Manages keystore configuration and delegates signing operations to appropriate signers.
|
|
5
5
|
*/
|
|
6
|
-
import type { EthSigner } from '@aztec/ethereum';
|
|
6
|
+
import type { EthSigner } from '@aztec/ethereum/eth-signer';
|
|
7
7
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
8
8
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
9
9
|
import type { Signature } from '@aztec/foundation/eth-signature';
|
|
@@ -19,11 +19,11 @@ import { ethPrivateKeySchema } from './schemas.js';
|
|
|
19
19
|
import { LocalSigner, RemoteSigner } from './signer.js';
|
|
20
20
|
import type {
|
|
21
21
|
AttesterAccounts,
|
|
22
|
+
EncryptedKeyFileConfig,
|
|
22
23
|
EthAccount,
|
|
23
24
|
EthAccounts,
|
|
24
25
|
EthRemoteSignerAccount,
|
|
25
26
|
EthRemoteSignerConfig,
|
|
26
|
-
JsonKeyFileV3Config,
|
|
27
27
|
KeyStore,
|
|
28
28
|
MnemonicConfig,
|
|
29
29
|
ProverKeyStore,
|
|
@@ -465,7 +465,7 @@ export class KeystoreManager {
|
|
|
465
465
|
/**
|
|
466
466
|
* Create signer from JSON V3 keystore file or directory
|
|
467
467
|
*/
|
|
468
|
-
private createSignerFromJsonV3(config:
|
|
468
|
+
private createSignerFromJsonV3(config: EncryptedKeyFileConfig): EthSigner[] {
|
|
469
469
|
try {
|
|
470
470
|
const stats = statSync(config.path);
|
|
471
471
|
|
package/src/loader.ts
CHANGED
|
@@ -3,10 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Handles loading and parsing keystore configuration files.
|
|
5
5
|
*/
|
|
6
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
6
7
|
import { createLogger } from '@aztec/foundation/log';
|
|
8
|
+
import type { Hex } from '@aztec/foundation/string';
|
|
7
9
|
|
|
8
10
|
import { readFileSync, readdirSync, statSync } from 'fs';
|
|
9
11
|
import { extname, join } from 'path';
|
|
12
|
+
import { privateKeyToAddress } from 'viem/accounts';
|
|
10
13
|
|
|
11
14
|
import { keystoreSchema } from './schemas.js';
|
|
12
15
|
import type { EthAccounts, KeyStore } from './types.js';
|
|
@@ -220,8 +223,9 @@ export function mergeKeystores(keystores: KeyStore[]): KeyStore {
|
|
|
220
223
|
if (keystore.validators) {
|
|
221
224
|
for (const validator of keystore.validators) {
|
|
222
225
|
// Check for duplicate attester addresses
|
|
223
|
-
const attesterKeys =
|
|
224
|
-
for (
|
|
226
|
+
const attesterKeys = extractAttesterAddresses(validator.attester);
|
|
227
|
+
for (let key of attesterKeys) {
|
|
228
|
+
key = key.toLowerCase();
|
|
225
229
|
if (attesterAddresses.has(key)) {
|
|
226
230
|
throw new KeyStoreLoadError(
|
|
227
231
|
`Duplicate attester address ${key} found across keystore files`,
|
|
@@ -284,38 +288,43 @@ export function mergeKeystores(keystores: KeyStore[]): KeyStore {
|
|
|
284
288
|
* @param attester The attester configuration in any supported shape.
|
|
285
289
|
* @returns Array of string keys used to detect duplicates.
|
|
286
290
|
*/
|
|
287
|
-
function
|
|
291
|
+
function extractAttesterAddresses(attester: unknown): string[] {
|
|
288
292
|
// String forms (private key or other) - return as-is for coarse uniqueness
|
|
289
293
|
if (typeof attester === 'string') {
|
|
290
|
-
|
|
294
|
+
if (attester.length === 66) {
|
|
295
|
+
return [privateKeyToAddress(attester as Hex<32>)];
|
|
296
|
+
} else {
|
|
297
|
+
return [attester];
|
|
298
|
+
}
|
|
291
299
|
}
|
|
292
300
|
|
|
293
301
|
// Arrays of attester items
|
|
294
302
|
if (Array.isArray(attester)) {
|
|
295
303
|
const keys: string[] = [];
|
|
296
304
|
for (const item of attester) {
|
|
297
|
-
keys.push(...
|
|
305
|
+
keys.push(...extractAttesterAddresses(item));
|
|
298
306
|
}
|
|
299
307
|
return keys;
|
|
300
308
|
}
|
|
301
309
|
|
|
302
310
|
if (attester && typeof attester === 'object') {
|
|
311
|
+
if (attester instanceof EthAddress) {
|
|
312
|
+
return [attester.toString()];
|
|
313
|
+
}
|
|
314
|
+
|
|
303
315
|
const obj = attester as Record<string, unknown>;
|
|
304
316
|
|
|
305
317
|
// New shape: { eth: EthAccount, bls?: BLSAccount }
|
|
306
318
|
if ('eth' in obj) {
|
|
307
|
-
return
|
|
319
|
+
return extractAttesterAddresses(obj.eth);
|
|
308
320
|
}
|
|
309
321
|
|
|
310
322
|
// Remote signer account object shape: { address, remoteSignerUrl?, ... }
|
|
311
323
|
if ('address' in obj) {
|
|
312
324
|
return [String((obj as any).address)];
|
|
313
325
|
}
|
|
314
|
-
|
|
315
|
-
// Mnemonic or other object shapes: stringify
|
|
316
|
-
return [JSON.stringify(attester)];
|
|
317
326
|
}
|
|
318
327
|
|
|
319
|
-
//
|
|
320
|
-
return [
|
|
328
|
+
// mnemonic, encrypted file just disable early duplicates checking
|
|
329
|
+
return [];
|
|
321
330
|
}
|
package/src/schemas.ts
CHANGED
|
@@ -22,55 +22,65 @@ const urlSchema = z.string().url('Invalid URL');
|
|
|
22
22
|
// Remote signer config schema
|
|
23
23
|
const remoteSignerConfigSchema = z.union([
|
|
24
24
|
urlSchema,
|
|
25
|
-
z
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
z
|
|
26
|
+
.object({
|
|
27
|
+
remoteSignerUrl: urlSchema,
|
|
28
|
+
certPath: optional(z.string()),
|
|
29
|
+
certPass: optional(z.string()),
|
|
30
|
+
})
|
|
31
|
+
.strict(),
|
|
30
32
|
]);
|
|
31
33
|
|
|
32
34
|
// Remote signer account schema
|
|
33
35
|
const remoteSignerAccountSchema = z.union([
|
|
34
36
|
schemas.EthAddress,
|
|
35
|
-
z
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
z
|
|
38
|
+
.object({
|
|
39
|
+
address: schemas.EthAddress,
|
|
40
|
+
remoteSignerUrl: urlSchema,
|
|
41
|
+
certPath: optional(z.string()),
|
|
42
|
+
certPass: optional(z.string()),
|
|
43
|
+
})
|
|
44
|
+
.strict(),
|
|
41
45
|
]);
|
|
42
46
|
|
|
43
|
-
// JSON V3
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
// Encrypted keystore file schema (used for both JSON V3 ETH keys and EIP-2335 BLS keys)
|
|
48
|
+
const encryptedKeyFileSchema = z
|
|
49
|
+
.object({
|
|
50
|
+
path: z.string(),
|
|
51
|
+
password: optional(z.string()),
|
|
52
|
+
})
|
|
53
|
+
.strict();
|
|
48
54
|
|
|
49
55
|
// Mnemonic config schema
|
|
50
|
-
const mnemonicConfigSchema = z
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
const mnemonicConfigSchema = z
|
|
57
|
+
.object({
|
|
58
|
+
mnemonic: z.string().min(1, 'Mnemonic cannot be empty'),
|
|
59
|
+
addressIndex: z.number().int().min(0).default(0),
|
|
60
|
+
accountIndex: z.number().int().min(0).default(0),
|
|
61
|
+
addressCount: z.number().int().min(1).default(1),
|
|
62
|
+
accountCount: z.number().int().min(1).default(1),
|
|
63
|
+
})
|
|
64
|
+
.strict();
|
|
57
65
|
|
|
58
66
|
// EthAccount schema
|
|
59
|
-
const ethAccountSchema = z.union([ethPrivateKeySchema, remoteSignerAccountSchema,
|
|
67
|
+
const ethAccountSchema = z.union([ethPrivateKeySchema, remoteSignerAccountSchema, encryptedKeyFileSchema]);
|
|
60
68
|
|
|
61
69
|
// EthAccounts schema
|
|
62
70
|
const ethAccountsSchema = z.union([ethAccountSchema, z.array(ethAccountSchema), mnemonicConfigSchema]);
|
|
63
71
|
|
|
64
72
|
// BLSAccount schema
|
|
65
|
-
const blsAccountSchema = z.union([blsPrivateKeySchema,
|
|
73
|
+
const blsAccountSchema = z.union([blsPrivateKeySchema, encryptedKeyFileSchema]);
|
|
66
74
|
|
|
67
75
|
// AttesterAccount schema: either EthAccount or { eth: EthAccount, bls?: BLSAccount }
|
|
68
76
|
const attesterAccountSchema = z.union([
|
|
69
77
|
ethAccountSchema,
|
|
70
|
-
z
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
z
|
|
79
|
+
.object({
|
|
80
|
+
eth: ethAccountSchema,
|
|
81
|
+
bls: optional(blsAccountSchema),
|
|
82
|
+
})
|
|
83
|
+
.strict(),
|
|
74
84
|
]);
|
|
75
85
|
|
|
76
86
|
// AttesterAccounts schema: AttesterAccount | AttesterAccount[] | MnemonicConfig
|
|
@@ -79,21 +89,25 @@ const attesterAccountsSchema = z.union([attesterAccountSchema, z.array(attesterA
|
|
|
79
89
|
// Prover keystore schema
|
|
80
90
|
const proverKeyStoreSchema = z.union([
|
|
81
91
|
ethAccountSchema,
|
|
82
|
-
z
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
92
|
+
z
|
|
93
|
+
.object({
|
|
94
|
+
id: schemas.EthAddress,
|
|
95
|
+
publisher: ethAccountsSchema,
|
|
96
|
+
})
|
|
97
|
+
.strict(),
|
|
86
98
|
]);
|
|
87
99
|
|
|
88
100
|
// Validator keystore schema
|
|
89
|
-
const validatorKeyStoreSchema = z
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
101
|
+
const validatorKeyStoreSchema = z
|
|
102
|
+
.object({
|
|
103
|
+
attester: attesterAccountsSchema,
|
|
104
|
+
coinbase: optional(schemas.EthAddress),
|
|
105
|
+
publisher: optional(ethAccountsSchema),
|
|
106
|
+
feeRecipient: AztecAddress.schema,
|
|
107
|
+
remoteSigner: optional(remoteSignerConfigSchema),
|
|
108
|
+
fundingAccount: optional(ethAccountSchema),
|
|
109
|
+
})
|
|
110
|
+
.strict();
|
|
97
111
|
|
|
98
112
|
// Main keystore schema
|
|
99
113
|
export const keystoreSchema = z
|
|
@@ -105,6 +119,7 @@ export const keystoreSchema = z
|
|
|
105
119
|
prover: optional(proverKeyStoreSchema),
|
|
106
120
|
fundingAccount: optional(ethAccountSchema),
|
|
107
121
|
})
|
|
122
|
+
.strict()
|
|
108
123
|
.refine(data => data.validators || data.prover, {
|
|
109
124
|
message: 'Keystore must have at least validators or prover configuration',
|
|
110
125
|
path: ['root'],
|
package/src/signer.ts
CHANGED
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Common interface for different signing backends (local, remote, encrypted)
|
|
5
5
|
*/
|
|
6
|
-
import type { EthSigner } from '@aztec/ethereum';
|
|
6
|
+
import type { EthSigner } from '@aztec/ethereum/eth-signer';
|
|
7
7
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
8
|
-
import {
|
|
8
|
+
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
9
|
+
import { Secp256k1Signer, toRecoveryBit } from '@aztec/foundation/crypto/secp256k1-signer';
|
|
9
10
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
10
11
|
import { Signature, type ViemTransactionSignature } from '@aztec/foundation/eth-signature';
|
|
11
12
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
12
|
-
import { withHexPrefix } from '@aztec/foundation/string';
|
|
13
|
+
import { bufferToHex, withHexPrefix } from '@aztec/foundation/string';
|
|
13
14
|
|
|
14
15
|
import {
|
|
15
16
|
type TransactionSerializable,
|
|
@@ -243,10 +244,6 @@ export class RemoteSigner implements EthSigner {
|
|
|
243
244
|
* Make a JSON-RPC eth_signTransaction request.
|
|
244
245
|
*/
|
|
245
246
|
private async makeJsonRpcSignTransactionRequest(tx: TransactionSerializable): Promise<Signature> {
|
|
246
|
-
if (tx.type !== 'eip1559') {
|
|
247
|
-
throw new Error('This signer does not support tx type: ' + tx.type);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
247
|
const txObject: RemoteSignerTxObject = {
|
|
251
248
|
from: this.address.toString(),
|
|
252
249
|
to: tx.to ?? null,
|
|
@@ -260,10 +257,10 @@ export class RemoteSigner implements EthSigner {
|
|
|
260
257
|
? withHexPrefix(tx.maxPriorityFeePerGas.toString(16))
|
|
261
258
|
: undefined,
|
|
262
259
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
260
|
+
maxFeePerBlobGas:
|
|
261
|
+
typeof tx.maxFeePerBlobGas !== 'undefined' ? withHexPrefix(tx.maxFeePerBlobGas.toString(16)) : undefined,
|
|
262
|
+
blobVersionedHashes: tx.blobVersionedHashes,
|
|
263
|
+
blobs: tx.blobs?.map(blob => (typeof blob === 'string' ? blob : bufferToHex(Buffer.from(blob)))),
|
|
267
264
|
};
|
|
268
265
|
|
|
269
266
|
let rawTxHex = await this.makeJsonRpcRequest('eth_signTransaction', txObject);
|
package/src/types.ts
CHANGED
|
@@ -6,13 +6,16 @@
|
|
|
6
6
|
* their associated keys and addresses.
|
|
7
7
|
*/
|
|
8
8
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
9
|
+
import type { Hex } from '@aztec/foundation/string';
|
|
9
10
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
10
11
|
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
/**
|
|
13
|
+
* An encrypted keystore file config points to a local file with an encrypted private key.
|
|
14
|
+
* The file may be in different formats:
|
|
15
|
+
* - JSON V3 format for ETH keys (Ethereum wallet standard)
|
|
16
|
+
* - EIP-2335 format for BLS keys (Ethereum 2.0 validator standard)
|
|
17
|
+
*/
|
|
18
|
+
export type EncryptedKeyFileConfig = { path: string; password?: string };
|
|
16
19
|
|
|
17
20
|
/** A private key is a 32-byte 0x-prefixed hex */
|
|
18
21
|
export type EthPrivateKey = Hex<32>;
|
|
@@ -47,8 +50,8 @@ export type EthRemoteSignerAccount =
|
|
|
47
50
|
certPass?: string;
|
|
48
51
|
};
|
|
49
52
|
|
|
50
|
-
/** An L1 account is a private key, a remote signer configuration, or
|
|
51
|
-
export type EthAccount = EthPrivateKey | EthRemoteSignerAccount |
|
|
53
|
+
/** An L1 account is a private key, a remote signer configuration, or an encrypted keystore file (JSON V3 format) */
|
|
54
|
+
export type EthAccount = EthPrivateKey | EthRemoteSignerAccount | EncryptedKeyFileConfig;
|
|
52
55
|
|
|
53
56
|
/** A mnemonic can be used to define a set of accounts */
|
|
54
57
|
export type MnemonicConfig = {
|
|
@@ -71,8 +74,8 @@ export type ProverKeyStoreWithId = {
|
|
|
71
74
|
|
|
72
75
|
export type ProverKeyStore = ProverKeyStoreWithId | EthAccount;
|
|
73
76
|
|
|
74
|
-
/** A BLS account is either a private key, or
|
|
75
|
-
export type BLSAccount = BLSPrivateKey |
|
|
77
|
+
/** A BLS account is either a private key, or an EIP-2335 encrypted keystore file */
|
|
78
|
+
export type BLSAccount = BLSPrivateKey | EncryptedKeyFileConfig;
|
|
76
79
|
|
|
77
80
|
/** An AttesterAccount is a combined EthAccount and optional BLSAccount */
|
|
78
81
|
export type AttesterAccount = { eth: EthAccount; bls?: BLSAccount } | EthAccount;
|