@aztec/accounts 5.0.0-rc.2 → 5.0.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/artifacts/EcdsaKAccount.json +1068 -716
- package/artifacts/EcdsaRAccount.json +1068 -716
- package/artifacts/SchnorrAccount.json +951 -573
- package/artifacts/SchnorrInitializerlessAccount.json +302 -250
- package/artifacts/SimulatedEcdsaAccount.json +650 -534
- package/artifacts/SimulatedSchnorrAccount.json +632 -496
- package/dest/schnorr/initializerless/index.d.ts +4 -4
- package/dest/schnorr/initializerless/index.d.ts.map +1 -1
- package/dest/schnorr/initializerless/index.js +7 -7
- package/dest/schnorr/initializerless/lazy.d.ts +4 -4
- package/dest/schnorr/initializerless/lazy.d.ts.map +1 -1
- package/dest/schnorr/initializerless/lazy.js +7 -7
- package/dest/schnorr/private_immutable/index.d.ts +4 -4
- package/dest/schnorr/private_immutable/index.d.ts.map +1 -1
- package/dest/schnorr/private_immutable/index.js +7 -7
- package/dest/schnorr/private_immutable/lazy.d.ts +4 -4
- package/dest/schnorr/private_immutable/lazy.d.ts.map +1 -1
- package/dest/schnorr/private_immutable/lazy.js +7 -7
- package/dest/testing/configuration.d.ts +1 -1
- package/dest/testing/configuration.d.ts.map +1 -1
- package/dest/testing/configuration.js +6 -2
- package/dest/testing/index.d.ts +1 -1
- package/dest/testing/index.d.ts.map +1 -1
- package/dest/testing/index.js +13 -11
- package/dest/testing/lazy.d.ts +1 -1
- package/dest/testing/lazy.d.ts.map +1 -1
- package/dest/testing/lazy.js +13 -11
- package/dest/utils/index.d.ts +2 -1
- package/dest/utils/index.d.ts.map +1 -1
- package/dest/utils/index.js +1 -0
- package/dest/utils/key_derivation.d.ts +9 -0
- package/dest/utils/key_derivation.d.ts.map +1 -0
- package/dest/utils/key_derivation.js +16 -0
- package/package.json +6 -6
- package/src/schnorr/initializerless/index.ts +8 -8
- package/src/schnorr/initializerless/lazy.ts +8 -8
- package/src/schnorr/private_immutable/index.ts +8 -8
- package/src/schnorr/private_immutable/lazy.ts +8 -8
- package/src/testing/configuration.ts +6 -2
- package/src/testing/index.ts +13 -13
- package/src/testing/lazy.ts +13 -13
- package/src/utils/index.ts +1 -0
- package/src/utils/key_derivation.ts +15 -0
|
@@ -17,9 +17,9 @@ export declare class SchnorrInitializerlessAccountContract extends SchnorrBaseAc
|
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Compute the address of a schnorr account contract.
|
|
20
|
-
* @param
|
|
20
|
+
* @param signingPrivateKey - The account's signing private key.
|
|
21
21
|
* @param salt - The contract address salt.
|
|
22
|
-
* @param
|
|
22
|
+
* @param secretKey - Seed for the account's privacy keys. Derived from the signing key when omitted.
|
|
23
23
|
*/
|
|
24
|
-
export declare function getSchnorrInitializerlessAccountContractAddress(
|
|
25
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
24
|
+
export declare function getSchnorrInitializerlessAccountContractAddress(signingPrivateKey: GrumpkinScalar, salt: Fr, secretKey?: Fr): Promise<AztecAddress>;
|
|
25
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zY2hub3JyL2luaXRpYWxpemVybGVzcy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFPQSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUU5RCxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLG1DQUFtQyxDQUFDO0FBQ25FLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFNMUQsT0FBTyxFQUFFLDBCQUEwQixFQUFFLE1BQU0sd0JBQXdCL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F;AAED;;;;;GAKG;AACH,wBAAsB,+CAA+C,CACnE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schnorr/initializerless/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAM1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEpE,eAAO,MAAM,6CAA6C,kBAEzD,CAAC;AAEF;;;;GAIG;AACH,qBAAa,qCAAsC,SAAQ,0BAA0B;IACnF,YAAY,iBAAiB,EAAE,cAAc,EAE5C;IAEQ,gCAAgC,uBAExC;IAEc,iBAAiB,IAAI,OAAO,CAAC,EAAE,CAAC,CAG9C;IAEQ,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAExD;CACF;AAED;;;;;GAKG;AACH,wBAAsB,+CAA+C,CACnE,iBAAiB,EAAE,cAAc,EACjC,IAAI,EAAE,EAAE,EACR,SAAS,CAAC,EAAE,EAAE,GACb,OAAO,CAAC,YAAY,CAAC,CAIvB"}
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
*/ import { getAccountContractAddress } from '@aztec/aztec.js/account';
|
|
7
7
|
import { poseidon2Hash } from '@aztec/foundation/crypto/poseidon';
|
|
8
8
|
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
9
|
-
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
10
9
|
import SchnorrInitializerlessAccountContractJson from '../../../artifacts/SchnorrInitializerlessAccount.json' with {
|
|
11
10
|
type: 'json'
|
|
12
11
|
};
|
|
12
|
+
import { deriveSecretKeyFromSigningKey } from '../../utils/key_derivation.js';
|
|
13
13
|
import { SchnorrBaseAccountContract } from '../account_contract.js';
|
|
14
14
|
export const SchnorrInitializerlessAccountContractArtifact = loadContractArtifact(SchnorrInitializerlessAccountContractJson);
|
|
15
15
|
/**
|
|
@@ -36,11 +36,11 @@ export const SchnorrInitializerlessAccountContractArtifact = loadContractArtifac
|
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* Compute the address of a schnorr account contract.
|
|
39
|
-
* @param
|
|
39
|
+
* @param signingPrivateKey - The account's signing private key.
|
|
40
40
|
* @param salt - The contract address salt.
|
|
41
|
-
* @param
|
|
42
|
-
*/ export async function getSchnorrInitializerlessAccountContractAddress(
|
|
43
|
-
const
|
|
44
|
-
const accountContract = new SchnorrInitializerlessAccountContract(
|
|
45
|
-
return await getAccountContractAddress(accountContract,
|
|
41
|
+
* @param secretKey - Seed for the account's privacy keys. Derived from the signing key when omitted.
|
|
42
|
+
*/ export async function getSchnorrInitializerlessAccountContractAddress(signingPrivateKey, salt, secretKey) {
|
|
43
|
+
const resolvedSecretKey = secretKey ?? await deriveSecretKeyFromSigningKey(signingPrivateKey);
|
|
44
|
+
const accountContract = new SchnorrInitializerlessAccountContract(signingPrivateKey);
|
|
45
|
+
return await getAccountContractAddress(accountContract, resolvedSecretKey, salt);
|
|
46
46
|
}
|
|
@@ -21,9 +21,9 @@ export declare class SchnorrInitializerlessAccountContract extends SchnorrBaseAc
|
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* Compute the address of a schnorr account contract.
|
|
24
|
-
* @param
|
|
24
|
+
* @param signingPrivateKey - The account's signing private key.
|
|
25
25
|
* @param salt - The contract address salt.
|
|
26
|
-
* @param
|
|
26
|
+
* @param secretKey - Seed for the account's privacy keys. Derived from the signing key when omitted.
|
|
27
27
|
*/
|
|
28
|
-
export declare function getSchnorrInitializerlessAccountContractAddress(
|
|
29
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
28
|
+
export declare function getSchnorrInitializerlessAccountContractAddress(signingPrivateKey: GrumpkinScalar, salt: Fr, secretKey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version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../../src/schnorr/initializerless/lazy.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGhE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEpE;;;GAGG;AACH,wBAAsB,gDAAgD,8BAQrE;AAED;;;;GAIG;AACH,qBAAa,qCAAsC,SAAQ,0BAA0B;IACnF,YAAY,iBAAiB,EAAE,cAAc,EAE5C;IAEQ,gCAAgC,uBAExC;IAEc,iBAAiB,IAAI,OAAO,CAAC,EAAE,CAAC,CAG9C;IAEQ,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAExD;CACF;AAED;;;;;GAKG;AACH,wBAAsB,+CAA+C,CACnE,
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../../src/schnorr/initializerless/lazy.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGhE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEpE;;;GAGG;AACH,wBAAsB,gDAAgD,8BAQrE;AAED;;;;GAIG;AACH,qBAAa,qCAAsC,SAAQ,0BAA0B;IACnF,YAAY,iBAAiB,EAAE,cAAc,EAE5C;IAEQ,gCAAgC,uBAExC;IAEc,iBAAiB,IAAI,OAAO,CAAC,EAAE,CAAC,CAG9C;IAEQ,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAExD;CACF;AAED;;;;;GAKG;AACH,wBAAsB,+CAA+C,CACnE,iBAAiB,EAAE,cAAc,EACjC,IAAI,EAAE,EAAE,EACR,SAAS,CAAC,EAAE,EAAE,GACb,OAAO,CAAC,YAAY,CAAC,CAIvB"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/ import { getAccountContractAddress } from '@aztec/aztec.js/account';
|
|
7
7
|
import { poseidon2Hash } from '@aztec/foundation/crypto/poseidon';
|
|
8
8
|
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
9
|
-
import {
|
|
9
|
+
import { deriveSecretKeyFromSigningKey } from '../../utils/key_derivation.js';
|
|
10
10
|
import { SchnorrBaseAccountContract } from '../account_contract.js';
|
|
11
11
|
/**
|
|
12
12
|
* Lazily loads the contract artifact
|
|
@@ -44,11 +44,11 @@ import { SchnorrBaseAccountContract } from '../account_contract.js';
|
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Compute the address of a schnorr account contract.
|
|
47
|
-
* @param
|
|
47
|
+
* @param signingPrivateKey - The account's signing private key.
|
|
48
48
|
* @param salt - The contract address salt.
|
|
49
|
-
* @param
|
|
50
|
-
*/ export async function getSchnorrInitializerlessAccountContractAddress(
|
|
51
|
-
const
|
|
52
|
-
const accountContract = new SchnorrInitializerlessAccountContract(
|
|
53
|
-
return await getAccountContractAddress(accountContract,
|
|
49
|
+
* @param secretKey - Seed for the account's privacy keys. Derived from the signing key when omitted.
|
|
50
|
+
*/ export async function getSchnorrInitializerlessAccountContractAddress(signingPrivateKey, salt, secretKey) {
|
|
51
|
+
const resolvedSecretKey = secretKey ?? await deriveSecretKeyFromSigningKey(signingPrivateKey);
|
|
52
|
+
const accountContract = new SchnorrInitializerlessAccountContract(signingPrivateKey);
|
|
53
|
+
return await getAccountContractAddress(accountContract, resolvedSecretKey, salt);
|
|
54
54
|
}
|
|
@@ -15,9 +15,9 @@ export declare class SchnorrAccountContract extends SchnorrBaseAccountContract {
|
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Compute the address of a schnorr account contract.
|
|
18
|
-
* @param
|
|
18
|
+
* @param signingPrivateKey - The account's signing private key.
|
|
19
19
|
* @param salt - The contract address salt.
|
|
20
|
-
* @param
|
|
20
|
+
* @param secretKey - Seed for the account's privacy keys. Derived from the signing key when omitted.
|
|
21
21
|
*/
|
|
22
|
-
export declare function getSchnorrAccountContractAddress(
|
|
23
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
22
|
+
export declare function getSchnorrAccountContractAddress(signingPrivateKey: GrumpkinScalar, salt: Fr, secretKey?: Fr): Promise<AztecAddress>;
|
|
23
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zY2hub3JyL3ByaXZhdGVfaW1tdXRhYmxlL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU9BLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBQzlELE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUNwRCxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0sbUNBQW1DLENBQUM7QUFDbkUsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQU0xRCxPQUFPLEVBQUUsMEJBQTBCLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUVwRSxlQUFPLE1BQU0sOEJBQThCLGtCQUEyRSxDQUFDO0FBRXZIOzs7O0dBSUc7QUFDSCxxQkFBYSxzQkFBdUIsU0FBUSwwQkFBMEI7SUFDcEUsWUFBWSxpQkFBaUIsRUFBRSxjQUFjLEVBRTVDO0lBRVEsbUJBQW1CLElBQUksT0FBTyxDQUFDLGdCQUFnQixDQUFDLENBRXhEO0NBQ0Y7QUFFRDs7Ozs7R0FLRztBQUNILHdCQUFzQixnQ0FBZ0MsQ0FDcEQsaUJBQWlCLEVBQUUsY0FBYyxFQUNqQyxJQUFJLEVBQUUsRUFBRSxFQUNSLFNBQVMsQ0FBQyxFQUFFLEVBQUUsR0FDYixPQUFPLENBQUMsWUFBWSxDQUFDLENBSXZCIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schnorr/private_immutable/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAM1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEpE,eAAO,MAAM,8BAA8B,kBAA2E,CAAC;AAEvH;;;;GAIG;AACH,qBAAa,sBAAuB,SAAQ,0BAA0B;IACpE,YAAY,iBAAiB,EAAE,cAAc,EAE5C;IAEQ,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAExD;CACF;AAED;;;;;GAKG;AACH,wBAAsB,gCAAgC,CACpD,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schnorr/private_immutable/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAM1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEpE,eAAO,MAAM,8BAA8B,kBAA2E,CAAC;AAEvH;;;;GAIG;AACH,qBAAa,sBAAuB,SAAQ,0BAA0B;IACpE,YAAY,iBAAiB,EAAE,cAAc,EAE5C;IAEQ,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAExD;CACF;AAED;;;;;GAKG;AACH,wBAAsB,gCAAgC,CACpD,iBAAiB,EAAE,cAAc,EACjC,IAAI,EAAE,EAAE,EACR,SAAS,CAAC,EAAE,EAAE,GACb,OAAO,CAAC,YAAY,CAAC,CAIvB"}
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* @packageDocumentation
|
|
6
6
|
*/ import { getAccountContractAddress } from '@aztec/aztec.js/account';
|
|
7
7
|
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
8
|
-
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
9
8
|
import SchnorrAccountContractJson from '../../../artifacts/SchnorrAccount.json' with {
|
|
10
9
|
type: 'json'
|
|
11
10
|
};
|
|
11
|
+
import { deriveSecretKeyFromSigningKey } from '../../utils/key_derivation.js';
|
|
12
12
|
import { SchnorrBaseAccountContract } from '../account_contract.js';
|
|
13
13
|
export const SchnorrAccountContractArtifact = loadContractArtifact(SchnorrAccountContractJson);
|
|
14
14
|
/**
|
|
@@ -25,11 +25,11 @@ export const SchnorrAccountContractArtifact = loadContractArtifact(SchnorrAccoun
|
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* Compute the address of a schnorr account contract.
|
|
28
|
-
* @param
|
|
28
|
+
* @param signingPrivateKey - The account's signing private key.
|
|
29
29
|
* @param salt - The contract address salt.
|
|
30
|
-
* @param
|
|
31
|
-
*/ export async function getSchnorrAccountContractAddress(
|
|
32
|
-
const
|
|
33
|
-
const accountContract = new SchnorrAccountContract(
|
|
34
|
-
return await getAccountContractAddress(accountContract,
|
|
30
|
+
* @param secretKey - Seed for the account's privacy keys. Derived from the signing key when omitted.
|
|
31
|
+
*/ export async function getSchnorrAccountContractAddress(signingPrivateKey, salt, secretKey) {
|
|
32
|
+
const resolvedSecretKey = secretKey ?? await deriveSecretKeyFromSigningKey(signingPrivateKey);
|
|
33
|
+
const accountContract = new SchnorrAccountContract(signingPrivateKey);
|
|
34
|
+
return await getAccountContractAddress(accountContract, resolvedSecretKey, salt);
|
|
35
35
|
}
|
|
@@ -19,9 +19,9 @@ export declare class SchnorrAccountContract extends SchnorrBaseAccountContract {
|
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Compute the address of a schnorr account contract.
|
|
22
|
-
* @param
|
|
22
|
+
* @param signingPrivateKey - The account's signing private key.
|
|
23
23
|
* @param salt - The contract address salt.
|
|
24
|
-
* @param
|
|
24
|
+
* @param secretKey - Seed for the account's privacy keys. Derived from the signing key when omitted.
|
|
25
25
|
*/
|
|
26
|
-
export declare function getSchnorrAccountContractAddress(
|
|
27
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
26
|
+
export declare function getSchnorrAccountContractAddress(signingPrivateKey: GrumpkinScalar, salt: Fr, secretKey?: Fr): Promise<AztecAddress>;
|
|
27
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3NjaG5vcnIvcHJpdmF0ZV9pbW11dGFibGUvbGF6eS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFPQSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLG1DQUFtQyxDQUFDO0FBQ25FLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFFMUQsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0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","sourceRoot":"","sources":["../../../src/schnorr/private_immutable/lazy.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGhE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEpE;;;GAGG;AACH,wBAAsB,iCAAiC,8BAQtD;AAED;;;;GAIG;AACH,qBAAa,sBAAuB,SAAQ,0BAA0B;IACpE,YAAY,iBAAiB,EAAE,cAAc,EAE5C;IAEQ,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAExD;CACF;AAED;;;;;GAKG;AACH,wBAAsB,gCAAgC,CACpD,iBAAiB,EAAE,cAAc,EACjC,IAAI,EAAE,EAAE,EACR,SAAS,CAAC,EAAE,EAAE,GACb,OAAO,CAAC,YAAY,CAAC,CAIvB"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @packageDocumentation
|
|
6
6
|
*/ import { getAccountContractAddress } from '@aztec/aztec.js/account';
|
|
7
7
|
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
8
|
-
import {
|
|
8
|
+
import { deriveSecretKeyFromSigningKey } from '../../utils/key_derivation.js';
|
|
9
9
|
import { SchnorrBaseAccountContract } from '../account_contract.js';
|
|
10
10
|
/**
|
|
11
11
|
* Lazily loads the contract artifact
|
|
@@ -33,11 +33,11 @@ import { SchnorrBaseAccountContract } from '../account_contract.js';
|
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Compute the address of a schnorr account contract.
|
|
36
|
-
* @param
|
|
36
|
+
* @param signingPrivateKey - The account's signing private key.
|
|
37
37
|
* @param salt - The contract address salt.
|
|
38
|
-
* @param
|
|
39
|
-
*/ export async function getSchnorrAccountContractAddress(
|
|
40
|
-
const
|
|
41
|
-
const accountContract = new SchnorrAccountContract(
|
|
42
|
-
return await getAccountContractAddress(accountContract,
|
|
38
|
+
* @param secretKey - Seed for the account's privacy keys. Derived from the signing key when omitted.
|
|
39
|
+
*/ export async function getSchnorrAccountContractAddress(signingPrivateKey, salt, secretKey) {
|
|
40
|
+
const resolvedSecretKey = secretKey ?? await deriveSecretKeyFromSigningKey(signingPrivateKey);
|
|
41
|
+
const accountContract = new SchnorrAccountContract(signingPrivateKey);
|
|
42
|
+
return await getAccountContractAddress(accountContract, resolvedSecretKey, salt);
|
|
43
43
|
}
|
|
@@ -34,4 +34,4 @@ export interface InitialAccountData {
|
|
|
34
34
|
*/
|
|
35
35
|
type?: InitialAccountType;
|
|
36
36
|
}
|
|
37
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
37
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlndXJhdGlvbi5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Rlc3RpbmcvY29uZmlndXJhdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLG1DQUFtQyxDQUFDO0FBQ25FLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBR2hFLGVBQU8sTUFBTSx3QkFBd0IsTUFJcEMsQ0FBQztBQUVGLGVBQU8sTUFBTSw0QkFBNEIsK0NBRXhDLENBQUM7QUFFRixlQUFPLE1BQU0seUJBQXlCLCtDQUlyQyxDQUFDO0FBRUYsZUFBTyxNQUFNLDBCQUEwQixNQUE4QixDQUFDO0FBRXRFOztHQUVHO0FBQ0gsTUFBTSxNQUFNLGtCQUFrQixHQUFHLFNBQVMsR0FBRyx5QkFBeUIsQ0FBQztBQUV2RTs7R0FFRztBQUNILE1BQU0sV0FBVyxrQkFBa0I7SUFDakM7O09BRUc7SUFDSCxNQUFNLEVBQUUsRUFBRSxDQUFDO0lBQ1g7O09BRUc7SUFDSCxVQUFVLEVBQUUsY0FBYyxDQUFDO0lBQzNCOztPQUVHO0lBQ0gsSUFBSSxFQUFFLEVBQUUsQ0FBQztJQUNUOztPQUVHO0lBQ0gsT0FBTyxFQUFFLFlBQVksQ0FBQztJQUN0Qjs7T0FFRztJQUNILElBQUksQ0FBQyxFQUFFLGtCQUFrQixDQUFDO0NBQzNCIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../src/testing/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGhE,eAAO,MAAM,wBAAwB,MAIpC,CAAC;AAEF,eAAO,MAAM,4BAA4B,+CAExC,CAAC;AAEF,eAAO,MAAM,yBAAyB,+
|
|
1
|
+
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../src/testing/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGhE,eAAO,MAAM,wBAAwB,MAIpC,CAAC;AAEF,eAAO,MAAM,4BAA4B,+CAExC,CAAC;AAEF,eAAO,MAAM,yBAAyB,+CAIrC,CAAC;AAEF,eAAO,MAAM,0BAA0B,MAA8B,CAAC;AAEtE;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,yBAAyB,CAAC;AAEvE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,MAAM,EAAE,EAAE,CAAC;IACX;;OAEG;IACH,UAAU,EAAE,cAAc,CAAC;IAC3B;;OAEG;IACH,IAAI,EAAE,EAAE,CAAC;IACT;;OAEG;IACH,OAAO,EAAE,YAAY,CAAC;IACtB;;OAEG;IACH,IAAI,CAAC,EAAE,kBAAkB,CAAC;CAC3B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
|
|
2
3
|
import { deriveMasterIncomingViewingSecretKey } from '@aztec/stdlib/keys';
|
|
3
4
|
export const INITIAL_TEST_SECRET_KEYS = [
|
|
4
5
|
Fr.fromHexString('2153536ff6628eee01cf4024889ff977a18d9fa61d0e414422f7681cf085c281'),
|
|
@@ -6,8 +7,11 @@ export const INITIAL_TEST_SECRET_KEYS = [
|
|
|
6
7
|
Fr.fromHexString('0f6addf0da06c33293df974a565b03d1ab096090d907d98055a8b7f4954e120c')
|
|
7
8
|
];
|
|
8
9
|
export const INITIAL_TEST_ENCRYPTION_KEYS = INITIAL_TEST_SECRET_KEYS.map((secretKey)=>deriveMasterIncomingViewingSecretKey(secretKey));
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
export const INITIAL_TEST_SIGNING_KEYS = [
|
|
11
|
+
GrumpkinScalar.fromHexString('0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f'),
|
|
12
|
+
GrumpkinScalar.fromHexString('202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e'),
|
|
13
|
+
GrumpkinScalar.fromHexString('404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e')
|
|
14
|
+
];
|
|
11
15
|
export const INITIAL_TEST_ACCOUNT_SALTS = [
|
|
12
16
|
Fr.ZERO,
|
|
13
17
|
Fr.ZERO,
|
package/dest/testing/index.d.ts
CHANGED
|
@@ -8,4 +8,4 @@ export declare function getInitialTestAccountsData(): Promise<InitialAccountData
|
|
|
8
8
|
* Generate a fixed amount of random schnorr account contract instances of the given type
|
|
9
9
|
*/
|
|
10
10
|
export declare function generateSchnorrAccounts(numberOfAccounts: number, type?: InitialAccountType): Promise<InitialAccountData[]>;
|
|
11
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0aW5nL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVdBLE9BQU8sRUFJTCxLQUFLLGtCQUFrQixFQUN2QixLQUFLLGtCQUFrQixFQUN4QixNQUFNLG9CQUFvQixDQUFDO0FBRTVCLE9BQU8sRUFDTCwwQkFBMEIsRUFDMUIsNEJBQTRCLEVBQzVCLHdCQUF3QixFQUN4Qix5QkFBeUIsRUFDekIsS0FBSyxrQkFBa0IsRUFDdkIsS0FBSyxrQkFBa0IsR0FDeEIsTUFBTSxvQkFBb0IsQ0FBQztBQVM1Qjs7R0FFRztBQUNILHdCQUFnQiwwQkFBMEIsSUFBSSxPQUFPLENBQUMsa0JBQWtCLEVBQUUsQ0FBQyxDQWMxRTtBQUVEOztHQUVHO0FBQ0gsd0JBQXNCLHVCQUF1QixDQUMzQyxnQkFBZ0IsRUFBRSxNQUFNLEVBQ3hCLElBQUksR0FBRSxrQkFBOEMsR0FDbkQsT0FBTyxDQUFDLGtCQUFrQixFQUFFLENBQUMsQ0FlL0IifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAWA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAIL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,EACzB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,GACxB,MAAM,oBAAoB,CAAC;AAS5B;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAc1E;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,gBAAgB,EAAE,MAAM,EACxB,IAAI,GAAE,kBAA8C,GACnD,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAe/B"}
|
package/dest/testing/index.js
CHANGED
|
@@ -3,39 +3,41 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/ import { Fr } from '@aztec/aztec.js/fields';
|
|
6
|
-
import {
|
|
6
|
+
import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
|
|
7
7
|
import { getSchnorrInitializerlessAccountContractAddress } from '../schnorr/initializerless/index.js';
|
|
8
8
|
import { getSchnorrAccountContractAddress } from '../schnorr/private_immutable/index.js';
|
|
9
|
-
import {
|
|
9
|
+
import { deriveSecretKeyFromSigningKey } from '../utils/key_derivation.js';
|
|
10
|
+
import { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_SECRET_KEYS, INITIAL_TEST_SIGNING_KEYS } from './configuration.js';
|
|
10
11
|
export { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_ENCRYPTION_KEYS, INITIAL_TEST_SECRET_KEYS, INITIAL_TEST_SIGNING_KEYS } from './configuration.js';
|
|
11
|
-
/** Derives the account contract address for the given type */ function getTestAccountAddress(type,
|
|
12
|
-
return type === 'schnorr' ? getSchnorrAccountContractAddress(
|
|
12
|
+
/** Derives the account contract address for the given type */ function getTestAccountAddress(type, signingKey, salt, secret) {
|
|
13
|
+
return type === 'schnorr' ? getSchnorrAccountContractAddress(signingKey, salt, secret) : getSchnorrInitializerlessAccountContractAddress(signingKey, salt, secret);
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
16
|
* Gets the basic information for initial test accounts.
|
|
16
17
|
*/ export function getInitialTestAccountsData() {
|
|
17
18
|
return Promise.all(INITIAL_TEST_SECRET_KEYS.map(async (secret, i)=>({
|
|
18
19
|
secret,
|
|
19
|
-
signingKey:
|
|
20
|
+
signingKey: INITIAL_TEST_SIGNING_KEYS[i],
|
|
20
21
|
salt: INITIAL_TEST_ACCOUNT_SALTS[i],
|
|
21
22
|
type: 'schnorr_initializerless',
|
|
22
|
-
address: await getSchnorrInitializerlessAccountContractAddress(
|
|
23
|
+
address: await getSchnorrInitializerlessAccountContractAddress(INITIAL_TEST_SIGNING_KEYS[i], INITIAL_TEST_ACCOUNT_SALTS[i], secret)
|
|
23
24
|
})));
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
26
27
|
* Generate a fixed amount of random schnorr account contract instances of the given type
|
|
27
28
|
*/ export async function generateSchnorrAccounts(numberOfAccounts, type = 'schnorr_initializerless') {
|
|
28
|
-
const
|
|
29
|
+
const signingKeys = Array.from({
|
|
29
30
|
length: numberOfAccounts
|
|
30
|
-
}, ()=>
|
|
31
|
-
return await Promise.all(
|
|
31
|
+
}, ()=>GrumpkinScalar.random());
|
|
32
|
+
return await Promise.all(signingKeys.map(async (signingKey)=>{
|
|
32
33
|
const salt = Fr.random();
|
|
34
|
+
const secret = await deriveSecretKeyFromSigningKey(signingKey);
|
|
33
35
|
return {
|
|
34
36
|
secret,
|
|
35
|
-
signingKey
|
|
37
|
+
signingKey,
|
|
36
38
|
salt,
|
|
37
39
|
type,
|
|
38
|
-
address: await getTestAccountAddress(type,
|
|
40
|
+
address: await getTestAccountAddress(type, signingKey, salt, secret)
|
|
39
41
|
};
|
|
40
42
|
}));
|
|
41
43
|
}
|
package/dest/testing/lazy.d.ts
CHANGED
|
@@ -8,4 +8,4 @@ export declare function getInitialTestAccountsData(): Promise<InitialAccountData
|
|
|
8
8
|
* Generate a fixed amount of random schnorr account contract instances of the given type
|
|
9
9
|
*/
|
|
10
10
|
export declare function generateSchnorrAccounts(numberOfAccounts: number, type?: InitialAccountType): Promise<InitialAccountData[]>;
|
|
11
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Rlc3RpbmcvbGF6eS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFXQSxPQUFPLEVBSUwsS0FBSyxrQkFBa0IsRUFDdkIsS0FBSyxrQkFBa0IsRUFDeEIsTUFBTSxvQkFBb0IsQ0FBQztBQUU1QixPQUFPLEVBQUUsMEJBQTBCLEVBQUUsd0JBQXdCLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQVMxRjs7R0FFRztBQUNILHdCQUFnQiwwQkFBMEIsSUFBSSxPQUFPLENBQUMsa0JBQWtCLEVBQUUsQ0FBQyxDQWMxRTtBQUVEOztHQUVHO0FBQ0gsd0JBQXNCLHVCQUF1QixDQUMzQyxnQkFBZ0IsRUFBRSxNQUFNLEVBQ3hCLElBQUksR0FBRSxrQkFBOEMsR0FDbkQsT0FBTyxDQUFDLGtCQUFrQixFQUFFLENBQUMsQ0FlL0IifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/testing/lazy.ts"],"names":[],"mappings":"AAWA,OAAO,
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/testing/lazy.ts"],"names":[],"mappings":"AAWA,OAAO,EAIL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAS1F;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAc1E;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,gBAAgB,EAAE,MAAM,EACxB,IAAI,GAAE,kBAA8C,GACnD,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAe/B"}
|
package/dest/testing/lazy.js
CHANGED
|
@@ -3,39 +3,41 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/ import { Fr } from '@aztec/aztec.js/fields';
|
|
6
|
-
import {
|
|
6
|
+
import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
|
|
7
7
|
import { getSchnorrInitializerlessAccountContractAddress } from '../schnorr/initializerless/lazy.js';
|
|
8
8
|
import { getSchnorrAccountContractAddress } from '../schnorr/private_immutable/lazy.js';
|
|
9
|
-
import {
|
|
9
|
+
import { deriveSecretKeyFromSigningKey } from '../utils/key_derivation.js';
|
|
10
|
+
import { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_SECRET_KEYS, INITIAL_TEST_SIGNING_KEYS } from './configuration.js';
|
|
10
11
|
export { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_SECRET_KEYS } from './configuration.js';
|
|
11
|
-
/** Derives the account contract address for the given type */ function getTestAccountAddress(type,
|
|
12
|
-
return type === 'schnorr' ? getSchnorrAccountContractAddress(
|
|
12
|
+
/** Derives the account contract address for the given type */ function getTestAccountAddress(type, signingKey, salt, secret) {
|
|
13
|
+
return type === 'schnorr' ? getSchnorrAccountContractAddress(signingKey, salt, secret) : getSchnorrInitializerlessAccountContractAddress(signingKey, salt, secret);
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
16
|
* Gets the basic information for initial test accounts.
|
|
16
17
|
*/ export function getInitialTestAccountsData() {
|
|
17
18
|
return Promise.all(INITIAL_TEST_SECRET_KEYS.map(async (secret, i)=>({
|
|
18
19
|
secret,
|
|
19
|
-
signingKey:
|
|
20
|
+
signingKey: INITIAL_TEST_SIGNING_KEYS[i],
|
|
20
21
|
salt: INITIAL_TEST_ACCOUNT_SALTS[i],
|
|
21
22
|
type: 'schnorr_initializerless',
|
|
22
|
-
address: await getSchnorrInitializerlessAccountContractAddress(
|
|
23
|
+
address: await getSchnorrInitializerlessAccountContractAddress(INITIAL_TEST_SIGNING_KEYS[i], INITIAL_TEST_ACCOUNT_SALTS[i], secret)
|
|
23
24
|
})));
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
26
27
|
* Generate a fixed amount of random schnorr account contract instances of the given type
|
|
27
28
|
*/ export async function generateSchnorrAccounts(numberOfAccounts, type = 'schnorr_initializerless') {
|
|
28
|
-
const
|
|
29
|
+
const signingKeys = Array.from({
|
|
29
30
|
length: numberOfAccounts
|
|
30
|
-
}, ()=>
|
|
31
|
-
return await Promise.all(
|
|
31
|
+
}, ()=>GrumpkinScalar.random());
|
|
32
|
+
return await Promise.all(signingKeys.map(async (signingKey)=>{
|
|
32
33
|
const salt = Fr.random();
|
|
34
|
+
const secret = await deriveSecretKeyFromSigningKey(signingKey);
|
|
33
35
|
return {
|
|
34
36
|
secret,
|
|
35
|
-
signingKey
|
|
37
|
+
signingKey,
|
|
36
38
|
salt,
|
|
37
39
|
type,
|
|
38
|
-
address: await getTestAccountAddress(type,
|
|
40
|
+
address: await getTestAccountAddress(type, signingKey, salt, secret)
|
|
39
41
|
};
|
|
40
42
|
}));
|
|
41
43
|
}
|
package/dest/utils/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
export * from './key_derivation.js';
|
|
1
2
|
export * from './ssh_agent.js';
|
|
2
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLHFCQUFxQixDQUFDO0FBQ3BDLGNBQWMsZ0JBQWdCLENBQUMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC"}
|
package/dest/utils/index.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import type { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
|
|
3
|
+
/**
|
|
4
|
+
* Derives the privacy secret key (the seed for the viewing/nullifier keyset that PXE holds) from the account's signing
|
|
5
|
+
* key. The signing key is the ownership root the user controls; the privacy keyset hangs off it through this one-way
|
|
6
|
+
* hash, so a value handled by PXE can never be used to recover the signing key.
|
|
7
|
+
*/
|
|
8
|
+
export declare function deriveSecretKeyFromSigningKey(signingKey: GrumpkinScalar): Promise<Fr>;
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoia2V5X2Rlcml2YXRpb24uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9rZXlfZGVyaXZhdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFQSxPQUFPLEtBQUssRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUN6RCxPQUFPLEtBQUssRUFBRSxjQUFjLEVBQUUsTUFBTSxtQ0FBbUMsQ0FBQztBQUl4RTs7OztHQUlHO0FBQ0gsd0JBQWdCLDZCQUE2QixDQUFDLFVBQVUsRUFBRSxjQUFjLEdBQUcsT0FBTyxDQUFDLEVBQUUsQ0FBQyxDQUVyRiJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key_derivation.d.ts","sourceRoot":"","sources":["../../src/utils/key_derivation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAIxE;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,UAAU,EAAE,cAAc,GAAG,OAAO,CAAC,EAAE,CAAC,CAErF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { poseidon2Hash } from '@aztec/foundation/crypto/poseidon';
|
|
2
|
+
import { sha256ToField } from '@aztec/foundation/crypto/sha256';
|
|
3
|
+
const SIGNING_KEY_TO_SECRET_KEY_SEPARATOR = sha256ToField([
|
|
4
|
+
Buffer.from('@aztec/accounts/signing_key_to_secret_key')
|
|
5
|
+
]);
|
|
6
|
+
/**
|
|
7
|
+
* Derives the privacy secret key (the seed for the viewing/nullifier keyset that PXE holds) from the account's signing
|
|
8
|
+
* key. The signing key is the ownership root the user controls; the privacy keyset hangs off it through this one-way
|
|
9
|
+
* hash, so a value handled by PXE can never be used to recover the signing key.
|
|
10
|
+
*/ export function deriveSecretKeyFromSigningKey(signingKey) {
|
|
11
|
+
return poseidon2Hash([
|
|
12
|
+
SIGNING_KEY_TO_SECRET_KEY_SEPARATOR,
|
|
13
|
+
signingKey.hi,
|
|
14
|
+
signingKey.lo
|
|
15
|
+
]);
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@aztec/accounts",
|
|
3
3
|
"homepage": "https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/accounts",
|
|
4
4
|
"description": "Implementation of sample account contracts for Aztec Network",
|
|
5
|
-
"version": "5.0.0
|
|
5
|
+
"version": "5.0.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
8
8
|
"./defaults": "./dest/defaults/index.js",
|
|
@@ -79,11 +79,11 @@
|
|
|
79
79
|
]
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@aztec/aztec.js": "5.0.0
|
|
83
|
-
"@aztec/entrypoints": "5.0.0
|
|
84
|
-
"@aztec/ethereum": "5.0.0
|
|
85
|
-
"@aztec/foundation": "5.0.0
|
|
86
|
-
"@aztec/stdlib": "5.0.0
|
|
82
|
+
"@aztec/aztec.js": "5.0.0",
|
|
83
|
+
"@aztec/entrypoints": "5.0.0",
|
|
84
|
+
"@aztec/ethereum": "5.0.0",
|
|
85
|
+
"@aztec/foundation": "5.0.0",
|
|
86
|
+
"@aztec/stdlib": "5.0.0",
|
|
87
87
|
"tslib": "^2.4.0"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
@@ -11,10 +11,10 @@ import { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
11
11
|
import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
|
|
12
12
|
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
13
13
|
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
14
|
-
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
15
14
|
import type { NoirCompiledContract } from '@aztec/stdlib/noir';
|
|
16
15
|
|
|
17
16
|
import SchnorrInitializerlessAccountContractJson from '../../../artifacts/SchnorrInitializerlessAccount.json' with { type: 'json' };
|
|
17
|
+
import { deriveSecretKeyFromSigningKey } from '../../utils/key_derivation.js';
|
|
18
18
|
import { SchnorrBaseAccountContract } from '../account_contract.js';
|
|
19
19
|
|
|
20
20
|
export const SchnorrInitializerlessAccountContractArtifact = loadContractArtifact(
|
|
@@ -47,16 +47,16 @@ export class SchnorrInitializerlessAccountContract extends SchnorrBaseAccountCon
|
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* Compute the address of a schnorr account contract.
|
|
50
|
-
* @param
|
|
50
|
+
* @param signingPrivateKey - The account's signing private key.
|
|
51
51
|
* @param salt - The contract address salt.
|
|
52
|
-
* @param
|
|
52
|
+
* @param secretKey - Seed for the account's privacy keys. Derived from the signing key when omitted.
|
|
53
53
|
*/
|
|
54
54
|
export async function getSchnorrInitializerlessAccountContractAddress(
|
|
55
|
-
|
|
55
|
+
signingPrivateKey: GrumpkinScalar,
|
|
56
56
|
salt: Fr,
|
|
57
|
-
|
|
57
|
+
secretKey?: Fr,
|
|
58
58
|
): Promise<AztecAddress> {
|
|
59
|
-
const
|
|
60
|
-
const accountContract = new SchnorrInitializerlessAccountContract(
|
|
61
|
-
return await getAccountContractAddress(accountContract,
|
|
59
|
+
const resolvedSecretKey = secretKey ?? (await deriveSecretKeyFromSigningKey(signingPrivateKey));
|
|
60
|
+
const accountContract = new SchnorrInitializerlessAccountContract(signingPrivateKey);
|
|
61
|
+
return await getAccountContractAddress(accountContract, resolvedSecretKey, salt);
|
|
62
62
|
}
|
|
@@ -11,8 +11,8 @@ import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
|
|
|
11
11
|
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
12
12
|
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
13
13
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
14
|
-
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
15
14
|
|
|
15
|
+
import { deriveSecretKeyFromSigningKey } from '../../utils/key_derivation.js';
|
|
16
16
|
import { SchnorrBaseAccountContract } from '../account_contract.js';
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -55,16 +55,16 @@ export class SchnorrInitializerlessAccountContract extends SchnorrBaseAccountCon
|
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
57
|
* Compute the address of a schnorr account contract.
|
|
58
|
-
* @param
|
|
58
|
+
* @param signingPrivateKey - The account's signing private key.
|
|
59
59
|
* @param salt - The contract address salt.
|
|
60
|
-
* @param
|
|
60
|
+
* @param secretKey - Seed for the account's privacy keys. Derived from the signing key when omitted.
|
|
61
61
|
*/
|
|
62
62
|
export async function getSchnorrInitializerlessAccountContractAddress(
|
|
63
|
-
|
|
63
|
+
signingPrivateKey: GrumpkinScalar,
|
|
64
64
|
salt: Fr,
|
|
65
|
-
|
|
65
|
+
secretKey?: Fr,
|
|
66
66
|
): Promise<AztecAddress> {
|
|
67
|
-
const
|
|
68
|
-
const accountContract = new SchnorrInitializerlessAccountContract(
|
|
69
|
-
return await getAccountContractAddress(accountContract,
|
|
67
|
+
const resolvedSecretKey = secretKey ?? (await deriveSecretKeyFromSigningKey(signingPrivateKey));
|
|
68
|
+
const accountContract = new SchnorrInitializerlessAccountContract(signingPrivateKey);
|
|
69
|
+
return await getAccountContractAddress(accountContract, resolvedSecretKey, salt);
|
|
70
70
|
}
|
|
@@ -10,10 +10,10 @@ import { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
10
10
|
import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
|
|
11
11
|
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
12
12
|
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
13
|
-
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
14
13
|
import type { NoirCompiledContract } from '@aztec/stdlib/noir';
|
|
15
14
|
|
|
16
15
|
import SchnorrAccountContractJson from '../../../artifacts/SchnorrAccount.json' with { type: 'json' };
|
|
16
|
+
import { deriveSecretKeyFromSigningKey } from '../../utils/key_derivation.js';
|
|
17
17
|
import { SchnorrBaseAccountContract } from '../account_contract.js';
|
|
18
18
|
|
|
19
19
|
export const SchnorrAccountContractArtifact = loadContractArtifact(SchnorrAccountContractJson as NoirCompiledContract);
|
|
@@ -35,16 +35,16 @@ export class SchnorrAccountContract extends SchnorrBaseAccountContract {
|
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* Compute the address of a schnorr account contract.
|
|
38
|
-
* @param
|
|
38
|
+
* @param signingPrivateKey - The account's signing private key.
|
|
39
39
|
* @param salt - The contract address salt.
|
|
40
|
-
* @param
|
|
40
|
+
* @param secretKey - Seed for the account's privacy keys. Derived from the signing key when omitted.
|
|
41
41
|
*/
|
|
42
42
|
export async function getSchnorrAccountContractAddress(
|
|
43
|
-
|
|
43
|
+
signingPrivateKey: GrumpkinScalar,
|
|
44
44
|
salt: Fr,
|
|
45
|
-
|
|
45
|
+
secretKey?: Fr,
|
|
46
46
|
): Promise<AztecAddress> {
|
|
47
|
-
const
|
|
48
|
-
const accountContract = new SchnorrAccountContract(
|
|
49
|
-
return await getAccountContractAddress(accountContract,
|
|
47
|
+
const resolvedSecretKey = secretKey ?? (await deriveSecretKeyFromSigningKey(signingPrivateKey));
|
|
48
|
+
const accountContract = new SchnorrAccountContract(signingPrivateKey);
|
|
49
|
+
return await getAccountContractAddress(accountContract, resolvedSecretKey, salt);
|
|
50
50
|
}
|