@aztec/accounts 0.0.1-commit.a072138 → 0.0.1-commit.a4600f49
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 +0 -1
- package/artifacts/EcdsaKAccount.json +7851 -2035
- package/artifacts/EcdsaRAccount.json +7851 -2035
- package/artifacts/SchnorrAccount.json +7835 -2053
- package/artifacts/SchnorrInitializerlessAccount.json +8460 -0
- package/artifacts/SimulatedEcdsaAccount.json +10610 -0
- package/artifacts/SimulatedSchnorrAccount.d.json.ts +3 -0
- package/artifacts/SimulatedSchnorrAccount.json +10722 -0
- package/dest/defaults/account_contract.d.ts +7 -1
- package/dest/defaults/account_contract.d.ts.map +1 -1
- package/dest/defaults/account_contract.js +6 -0
- package/dest/{stub/account_contract.d.ts → defaults/stub_account_contract.d.ts} +1 -1
- package/dest/defaults/stub_account_contract.d.ts.map +1 -0
- package/dest/ecdsa/ecdsa_k/account_contract.d.ts +1 -1
- package/dest/ecdsa/ecdsa_k/account_contract.js +6 -2
- package/dest/ecdsa/ecdsa_k/lazy.js +1 -1
- package/dest/ecdsa/ecdsa_r/account_contract.d.ts +1 -1
- package/dest/ecdsa/ecdsa_r/account_contract.js +6 -2
- package/dest/ecdsa/ecdsa_r/lazy.js +1 -1
- package/dest/ecdsa/ssh_ecdsa_r/account_contract.d.ts +1 -1
- package/dest/ecdsa/ssh_ecdsa_r/account_contract.js +6 -2
- package/dest/ecdsa/stub/index.d.ts +11 -0
- package/dest/ecdsa/stub/index.d.ts.map +1 -0
- package/dest/ecdsa/stub/index.js +18 -0
- package/dest/ecdsa/stub/lazy.d.ts +14 -0
- package/dest/ecdsa/stub/lazy.d.ts.map +1 -0
- package/dest/ecdsa/stub/lazy.js +22 -0
- package/dest/schnorr/account_contract.d.ts +8 -4
- package/dest/schnorr/account_contract.d.ts.map +1 -1
- package/dest/schnorr/account_contract.js +6 -5
- package/dest/schnorr/index.d.ts +3 -23
- package/dest/schnorr/index.d.ts.map +1 -1
- package/dest/schnorr/index.js +2 -35
- package/dest/schnorr/initializerless/index.d.ts +25 -0
- package/dest/schnorr/initializerless/index.d.ts.map +1 -0
- package/dest/schnorr/initializerless/index.js +46 -0
- package/dest/schnorr/initializerless/lazy.d.ts +29 -0
- package/dest/schnorr/initializerless/lazy.d.ts.map +1 -0
- package/dest/schnorr/initializerless/lazy.js +54 -0
- package/dest/schnorr/lazy.d.ts +3 -27
- package/dest/schnorr/lazy.d.ts.map +1 -1
- package/dest/schnorr/lazy.js +2 -43
- package/dest/schnorr/private_immutable/index.d.ts +23 -0
- package/dest/schnorr/private_immutable/index.d.ts.map +1 -0
- package/dest/schnorr/private_immutable/index.js +35 -0
- package/dest/schnorr/private_immutable/lazy.d.ts +27 -0
- package/dest/schnorr/private_immutable/lazy.d.ts.map +1 -0
- package/dest/schnorr/private_immutable/lazy.js +43 -0
- package/dest/schnorr/stub/index.d.ts +11 -0
- package/dest/schnorr/stub/index.d.ts.map +1 -0
- package/dest/schnorr/stub/index.js +18 -0
- package/dest/schnorr/stub/lazy.d.ts +14 -0
- package/dest/schnorr/stub/lazy.d.ts.map +1 -0
- package/dest/schnorr/stub/lazy.js +22 -0
- package/dest/testing/configuration.d.ts +9 -1
- package/dest/testing/configuration.d.ts.map +1 -1
- package/dest/testing/index.d.ts +5 -5
- package/dest/testing/index.d.ts.map +1 -1
- package/dest/testing/index.js +11 -5
- package/dest/testing/lazy.d.ts +4 -4
- package/dest/testing/lazy.d.ts.map +1 -1
- package/dest/testing/lazy.js +11 -5
- package/dest/utils/ssh_agent.d.ts +1 -1
- package/dest/utils/ssh_agent.d.ts.map +1 -1
- package/dest/utils/ssh_agent.js +2 -0
- package/package.json +10 -13
- package/src/defaults/account_contract.ts +9 -0
- package/src/ecdsa/ecdsa_k/account_contract.ts +1 -1
- package/src/ecdsa/ecdsa_k/lazy.ts +1 -1
- package/src/ecdsa/ecdsa_r/account_contract.ts +1 -1
- package/src/ecdsa/ecdsa_r/lazy.ts +1 -1
- package/src/ecdsa/ssh_ecdsa_r/account_contract.ts +1 -1
- package/src/ecdsa/stub/index.ts +28 -0
- package/src/ecdsa/stub/lazy.ts +34 -0
- package/src/schnorr/account_contract.ts +18 -5
- package/src/schnorr/index.ts +2 -50
- package/src/schnorr/initializerless/index.ts +62 -0
- package/src/schnorr/initializerless/lazy.ts +70 -0
- package/src/schnorr/lazy.ts +2 -60
- package/src/schnorr/private_immutable/index.ts +50 -0
- package/src/schnorr/private_immutable/lazy.ts +60 -0
- package/src/schnorr/stub/index.ts +30 -0
- package/src/schnorr/stub/lazy.ts +34 -0
- package/src/testing/configuration.ts +9 -0
- package/src/testing/index.ts +21 -5
- package/src/testing/lazy.ts +20 -5
- package/src/utils/ssh_agent.ts +2 -0
- package/artifacts/SchnorrSingleKeyAccount.json +0 -4706
- package/artifacts/SimulatedAccount.json +0 -4483
- package/dest/single_key/account_contract.d.ts +0 -17
- package/dest/single_key/account_contract.d.ts.map +0 -1
- package/dest/single_key/account_contract.js +0 -42
- package/dest/single_key/index.d.ts +0 -20
- package/dest/single_key/index.d.ts.map +0 -1
- package/dest/single_key/index.js +0 -23
- package/dest/single_key/lazy.d.ts +0 -24
- package/dest/single_key/lazy.d.ts.map +0 -1
- package/dest/single_key/lazy.js +0 -31
- package/dest/stub/account_contract.d.ts.map +0 -1
- package/dest/stub/index.d.ts +0 -20
- package/dest/stub/index.d.ts.map +0 -1
- package/dest/stub/index.js +0 -28
- package/dest/stub/lazy.d.ts +0 -25
- package/dest/stub/lazy.d.ts.map +0 -1
- package/dest/stub/lazy.js +0 -37
- package/src/single_key/account_contract.ts +0 -47
- package/src/single_key/index.ts +0 -32
- package/src/single_key/lazy.ts +0 -40
- package/src/stub/index.ts +0 -40
- package/src/stub/lazy.ts +0 -51
- /package/artifacts/{SchnorrSingleKeyAccount.d.json.ts → SchnorrInitializerlessAccount.d.json.ts} +0 -0
- /package/artifacts/{SimulatedAccount.d.json.ts → SimulatedEcdsaAccount.d.json.ts} +0 -0
- /package/dest/{stub/account_contract.js → defaults/stub_account_contract.js} +0 -0
- /package/src/{stub/account_contract.ts → defaults/stub_account_contract.ts} +0 -0
package/dest/schnorr/lazy.js
CHANGED
|
@@ -1,43 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
* This is the suggested account contract type for most use cases within Aztec.
|
|
4
|
-
*
|
|
5
|
-
* @packageDocumentation
|
|
6
|
-
*/ import { getAccountContractAddress } from '@aztec/aztec.js/account';
|
|
7
|
-
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
8
|
-
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
9
|
-
import { SchnorrBaseAccountContract } from './account_contract.js';
|
|
10
|
-
/**
|
|
11
|
-
* Lazily loads the contract artifact
|
|
12
|
-
* @returns The contract artifact for the schnorr account contract
|
|
13
|
-
*/ export async function getSchnorrAccountContractArtifact() {
|
|
14
|
-
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
15
|
-
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
16
|
-
// Even if now supported by al major browsers, the MIME type is replaced with
|
|
17
|
-
// "text/javascript"
|
|
18
|
-
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
19
|
-
const { default: schnorrAccountContractJson } = await import('../../artifacts/SchnorrAccount.json');
|
|
20
|
-
return loadContractArtifact(schnorrAccountContractJson);
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Account contract that authenticates transactions using Schnorr signatures
|
|
24
|
-
* verified against a Grumpkin public key stored in an immutable encrypted note.
|
|
25
|
-
* Lazily loads the contract artifact
|
|
26
|
-
*/ export class SchnorrAccountContract extends SchnorrBaseAccountContract {
|
|
27
|
-
constructor(signingPrivateKey){
|
|
28
|
-
super(signingPrivateKey);
|
|
29
|
-
}
|
|
30
|
-
getContractArtifact() {
|
|
31
|
-
return getSchnorrAccountContractArtifact();
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Compute the address of a schnorr account contract.
|
|
36
|
-
* @param secret - A seed for deriving the signing key and public keys.
|
|
37
|
-
* @param salt - The contract address salt.
|
|
38
|
-
* @param signingPrivateKey - A specific signing private key that's not derived from the secret.
|
|
39
|
-
*/ export async function getSchnorrAccountContractAddress(secret, salt, signingPrivateKey) {
|
|
40
|
-
const signingKey = signingPrivateKey ?? deriveSigningKey(secret);
|
|
41
|
-
const accountContract = new SchnorrAccountContract(signingKey);
|
|
42
|
-
return await getAccountContractAddress(accountContract, secret, salt);
|
|
43
|
-
}
|
|
1
|
+
export * from './private_immutable/lazy.js';
|
|
2
|
+
export * from './initializerless/lazy.js';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
|
|
4
|
+
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
5
|
+
import { SchnorrBaseAccountContract } from '../account_contract.js';
|
|
6
|
+
export declare const SchnorrAccountContractArtifact: ContractArtifact;
|
|
7
|
+
/**
|
|
8
|
+
* Account contract that authenticates transactions using Schnorr signatures
|
|
9
|
+
* verified against a Grumpkin public key stored in an immutable encrypted note.
|
|
10
|
+
* Eagerly loads the contract artifact
|
|
11
|
+
*/
|
|
12
|
+
export declare class SchnorrAccountContract extends SchnorrBaseAccountContract {
|
|
13
|
+
constructor(signingPrivateKey: GrumpkinScalar);
|
|
14
|
+
getContractArtifact(): Promise<ContractArtifact>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Compute the address of a schnorr account contract.
|
|
18
|
+
* @param secret - A seed for deriving the signing key and public keys.
|
|
19
|
+
* @param salt - The contract address salt.
|
|
20
|
+
* @param signingPrivateKey - A specific signing private key that's not derived from the secret.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getSchnorrAccountContractAddress(secret: Fr, salt: Fr, signingPrivateKey?: GrumpkinScalar): Promise<AztecAddress>;
|
|
23
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zY2hub3JyL3ByaXZhdGVfaW1tdXRhYmxlL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU9BLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBQzlELE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUNwRCxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0sbUNBQW1DLENBQUM7QUFDbkUsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQU0xRCxPQUFPLEVBQUUsMEJBQTBCLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUVwRSxlQUFPLE1BQU0sOEJBQThCLGtCQUEyRSxDQUFDO0FBRXZIOzs7O0dBSUc7QUFDSCxxQkFBYSxzQkFBdUIsU0FBUSwwQkFBMEI7SUFDcEUsWUFBWSxpQkFBaUIsRUFBRSxjQUFjLEVBRTVDO0lBRVEsbUJBQW1CLElBQUksT0FBTyxDQUFDLGdCQUFnQixDQUFDLENBRXhEO0NBQ0Y7QUFFRDs7Ozs7R0FLRztBQUNILHdCQUFzQixnQ0FBZ0MsQ0FDcEQsTUFBTSxFQUFFLEVBQUUsRUFDVixJQUFJLEVBQUUsRUFBRSxFQUNSLGlCQUFpQixDQUFDLEVBQUUsY0FBYyxHQUNqQyxPQUFPLENBQUMsWUFBWSxDQUFDLENBSXZCIn0=
|
|
@@ -0,0 +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,MAAM,EAAE,EAAE,EACV,IAAI,EAAE,EAAE,EACR,iBAAiB,CAAC,EAAE,cAAc,GACjC,OAAO,CAAC,YAAY,CAAC,CAIvB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `@aztec/accounts/schnorr` export provides an account contract implementation that uses Schnorr signatures with a Grumpkin key for authentication, and a separate Grumpkin key for encryption.
|
|
3
|
+
* This is the suggested account contract type for most use cases within Aztec.
|
|
4
|
+
*
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/ import { getAccountContractAddress } from '@aztec/aztec.js/account';
|
|
7
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
8
|
+
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
9
|
+
import SchnorrAccountContractJson from '../../../artifacts/SchnorrAccount.json' with {
|
|
10
|
+
type: 'json'
|
|
11
|
+
};
|
|
12
|
+
import { SchnorrBaseAccountContract } from '../account_contract.js';
|
|
13
|
+
export const SchnorrAccountContractArtifact = loadContractArtifact(SchnorrAccountContractJson);
|
|
14
|
+
/**
|
|
15
|
+
* Account contract that authenticates transactions using Schnorr signatures
|
|
16
|
+
* verified against a Grumpkin public key stored in an immutable encrypted note.
|
|
17
|
+
* Eagerly loads the contract artifact
|
|
18
|
+
*/ export class SchnorrAccountContract extends SchnorrBaseAccountContract {
|
|
19
|
+
constructor(signingPrivateKey){
|
|
20
|
+
super(signingPrivateKey);
|
|
21
|
+
}
|
|
22
|
+
getContractArtifact() {
|
|
23
|
+
return Promise.resolve(SchnorrAccountContractArtifact);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Compute the address of a schnorr account contract.
|
|
28
|
+
* @param secret - A seed for deriving the signing key and public keys.
|
|
29
|
+
* @param salt - The contract address salt.
|
|
30
|
+
* @param signingPrivateKey - A specific signing private key that's not derived from the secret.
|
|
31
|
+
*/ export async function getSchnorrAccountContractAddress(secret, salt, signingPrivateKey) {
|
|
32
|
+
const signingKey = signingPrivateKey ?? deriveSigningKey(secret);
|
|
33
|
+
const accountContract = new SchnorrAccountContract(signingKey);
|
|
34
|
+
return await getAccountContractAddress(accountContract, secret, salt);
|
|
35
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
|
|
3
|
+
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
4
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
+
import { SchnorrBaseAccountContract } from '../account_contract.js';
|
|
6
|
+
/**
|
|
7
|
+
* Lazily loads the contract artifact
|
|
8
|
+
* @returns The contract artifact for the schnorr account contract
|
|
9
|
+
*/
|
|
10
|
+
export declare function getSchnorrAccountContractArtifact(): Promise<ContractArtifact>;
|
|
11
|
+
/**
|
|
12
|
+
* Account contract that authenticates transactions using Schnorr signatures
|
|
13
|
+
* verified against a Grumpkin public key stored in an immutable encrypted note.
|
|
14
|
+
* Lazily loads the contract artifact
|
|
15
|
+
*/
|
|
16
|
+
export declare class SchnorrAccountContract extends SchnorrBaseAccountContract {
|
|
17
|
+
constructor(signingPrivateKey: GrumpkinScalar);
|
|
18
|
+
getContractArtifact(): Promise<ContractArtifact>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Compute the address of a schnorr account contract.
|
|
22
|
+
* @param secret - A seed for deriving the signing key and public keys.
|
|
23
|
+
* @param salt - The contract address salt.
|
|
24
|
+
* @param signingPrivateKey - A specific signing private key that's not derived from the secret.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getSchnorrAccountContractAddress(secret: Fr, salt: Fr, signingPrivateKey?: GrumpkinScalar): Promise<AztecAddress>;
|
|
27
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3NjaG5vcnIvcHJpdmF0ZV9pbW11dGFibGUvbGF6eS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFPQSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLG1DQUFtQyxDQUFDO0FBQ25FLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFFMUQsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFHaEUsT0FBTyxFQUFFLDBCQUEwQixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFcEU7OztHQUdHO0FBQ0gsd0JBQXNCLGlDQUFpQyw4QkFRdEQ7QUFFRDs7OztHQUlHO0FBQ0gscUJBQWEsc0JBQXVCLFNBQVEsMEJBQTBCO0lBQ3BFLFlBQVksaUJBQWlCLEVBQUUsY0FBYyxFQUU1QztJQUVRLG1CQUFtQixJQUFJLE9BQU8sQ0FBQyxnQkFBZ0IsQ0FBQyxDQUV4RDtDQUNGO0FBRUQ7Ozs7O0dBS0c7QUFDSCx3QkFBc0IsZ0NBQWdDLENBQ3BELE1BQU0sRUFBRSxFQUFFLEVBQ1YsSUFBSSxFQUFFLEVBQUUsRUFDUixpQkFBaUIsQ0FBQyxFQUFFLGNBQWMsR0FDakMsT0FBTyxDQUFDLFlBQVksQ0FBQyxDQUl2QiJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","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,MAAM,EAAE,EAAE,EACV,IAAI,EAAE,EAAE,EACR,iBAAiB,CAAC,EAAE,cAAc,GACjC,OAAO,CAAC,YAAY,CAAC,CAIvB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `@aztec/accounts/schnorr` export provides an account contract implementation that uses Schnorr signatures with a Grumpkin key for authentication, and a separate Grumpkin key for encryption.
|
|
3
|
+
* This is the suggested account contract type for most use cases within Aztec.
|
|
4
|
+
*
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/ import { getAccountContractAddress } from '@aztec/aztec.js/account';
|
|
7
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
8
|
+
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
9
|
+
import { SchnorrBaseAccountContract } from '../account_contract.js';
|
|
10
|
+
/**
|
|
11
|
+
* Lazily loads the contract artifact
|
|
12
|
+
* @returns The contract artifact for the schnorr account contract
|
|
13
|
+
*/ export async function getSchnorrAccountContractArtifact() {
|
|
14
|
+
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
15
|
+
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
16
|
+
// Even if now supported by all major browsers, the MIME type is replaced with
|
|
17
|
+
// "text/javascript"
|
|
18
|
+
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
19
|
+
const { default: schnorrAccountContractJson } = await import('../../../artifacts/SchnorrAccount.json');
|
|
20
|
+
return loadContractArtifact(schnorrAccountContractJson);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Account contract that authenticates transactions using Schnorr signatures
|
|
24
|
+
* verified against a Grumpkin public key stored in an immutable encrypted note.
|
|
25
|
+
* Lazily loads the contract artifact
|
|
26
|
+
*/ export class SchnorrAccountContract extends SchnorrBaseAccountContract {
|
|
27
|
+
constructor(signingPrivateKey){
|
|
28
|
+
super(signingPrivateKey);
|
|
29
|
+
}
|
|
30
|
+
getContractArtifact() {
|
|
31
|
+
return getSchnorrAccountContractArtifact();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Compute the address of a schnorr account contract.
|
|
36
|
+
* @param secret - A seed for deriving the signing key and public keys.
|
|
37
|
+
* @param salt - The contract address salt.
|
|
38
|
+
* @param signingPrivateKey - A specific signing private key that's not derived from the secret.
|
|
39
|
+
*/ export async function getSchnorrAccountContractAddress(secret, salt, signingPrivateKey) {
|
|
40
|
+
const signingKey = signingPrivateKey ?? deriveSigningKey(secret);
|
|
41
|
+
const accountContract = new SchnorrAccountContract(signingKey);
|
|
42
|
+
return await getAccountContractAddress(accountContract, secret, salt);
|
|
43
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseAccount } from '@aztec/aztec.js/account';
|
|
2
|
+
import type { CompleteAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { StubBaseAccountContract } from '../../defaults/stub_account_contract.js';
|
|
4
|
+
export declare const StubSchnorrAccountContractArtifact: import("@aztec/stdlib/abi").ContractArtifact;
|
|
5
|
+
/** Stub account contract for Schnorr accounts. Eagerly loads the contract artifact. */
|
|
6
|
+
export declare class StubSchnorrAccountContract extends StubBaseAccountContract {
|
|
7
|
+
getContractArtifact(): Promise<import("@aztec/stdlib/abi").ContractArtifact>;
|
|
8
|
+
}
|
|
9
|
+
/** Creates a Schnorr stub account that impersonates the one with the provided address. */
|
|
10
|
+
export declare function createStubSchnorrAccount(originalAddress: CompleteAddress): BaseAccount;
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zY2hub3JyL3N0dWIvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQ3RELE9BQU8sS0FBSyxFQUFFLGVBQWUsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBTWpFLE9BQU8sRUFBRSx1QkFBdUIsRUFBRSxNQUFNLHlDQUF5QyxDQUFDO0FBRWxGLGVBQU8sTUFBTSxrQ0FBa0MsOENBRTlDLENBQUM7QUFFRix1RkFBdUY7QUFDdkYscUJBQWEsMEJBQTJCLFNBQVEsdUJBQXVCO0lBQzVELG1CQUFtQiwwREFFM0I7Q0FDRjtBQUVELDBGQUEwRjtBQUMxRix3QkFBZ0Isd0JBQXdCLENBQUMsZUFBZSxFQUFFLGVBQWUsZUFReEUifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schnorr/stub/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAMjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAElF,eAAO,MAAM,kCAAkC,8CAE9C,CAAC;AAEF,uFAAuF;AACvF,qBAAa,0BAA2B,SAAQ,uBAAuB;IAC5D,mBAAmB,0DAE3B;CACF;AAED,0FAA0F;AAC1F,wBAAgB,wBAAwB,CAAC,eAAe,EAAE,eAAe,eAQxE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseAccount } from '@aztec/aztec.js/account';
|
|
2
|
+
import { DefaultAccountEntrypoint } from '@aztec/entrypoints/account';
|
|
3
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
4
|
+
import SimulatedSchnorrAccountJson from '../../../artifacts/SimulatedSchnorrAccount.json' with {
|
|
5
|
+
type: 'json'
|
|
6
|
+
};
|
|
7
|
+
import { StubBaseAccountContract } from '../../defaults/stub_account_contract.js';
|
|
8
|
+
export const StubSchnorrAccountContractArtifact = loadContractArtifact(SimulatedSchnorrAccountJson);
|
|
9
|
+
/** Stub account contract for Schnorr accounts. Eagerly loads the contract artifact. */ export class StubSchnorrAccountContract extends StubBaseAccountContract {
|
|
10
|
+
getContractArtifact() {
|
|
11
|
+
return Promise.resolve(StubSchnorrAccountContractArtifact);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/** Creates a Schnorr stub account that impersonates the one with the provided address. */ export function createStubSchnorrAccount(originalAddress) {
|
|
15
|
+
const accountContract = new StubSchnorrAccountContract();
|
|
16
|
+
const authWitnessProvider = accountContract.getAuthWitnessProvider(originalAddress);
|
|
17
|
+
return new BaseAccount(new DefaultAccountEntrypoint(originalAddress.address, authWitnessProvider), authWitnessProvider, originalAddress);
|
|
18
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseAccount } from '@aztec/aztec.js/account';
|
|
2
|
+
import type { CompleteAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { StubBaseAccountContract } from '../../defaults/stub_account_contract.js';
|
|
4
|
+
/**
|
|
5
|
+
* Lazily loads the Schnorr stub contract artifact (browser-compatible).
|
|
6
|
+
*/
|
|
7
|
+
export declare function getStubSchnorrAccountContractArtifact(): Promise<import("@aztec/stdlib/abi").ContractArtifact>;
|
|
8
|
+
/** Stub account contract for Schnorr accounts. Lazily loads the contract artifact. */
|
|
9
|
+
export declare class StubSchnorrAccountContract extends StubBaseAccountContract {
|
|
10
|
+
getContractArtifact(): Promise<import("@aztec/stdlib/abi").ContractArtifact>;
|
|
11
|
+
}
|
|
12
|
+
/** Creates a Schnorr stub account that impersonates the one with the provided address. */
|
|
13
|
+
export declare function createStubSchnorrAccount(originalAddress: CompleteAddress): BaseAccount;
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3NjaG5vcnIvc3R1Yi9sYXp5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUN0RCxPQUFPLEtBQUssRUFBRSxlQUFlLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUlqRSxPQUFPLEVBQUUsdUJBQXVCLEVBQUUsTUFBTSx5Q0FBeUMsQ0FBQztBQUVsRjs7R0FFRztBQUNILHdCQUFzQixxQ0FBcUMsMERBSzFEO0FBRUQsc0ZBQXNGO0FBQ3RGLHFCQUFhLDBCQUEyQixTQUFRLHVCQUF1QjtJQUM1RCxtQkFBbUIsMERBRTNCO0NBQ0Y7QUFFRCwwRkFBMEY7QUFDMUYsd0JBQWdCLHdCQUF3QixDQUFDLGVBQWUsRUFBRSxlQUFlLGVBUXhFIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../../src/schnorr/stub/lazy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAIjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAElF;;GAEG;AACH,wBAAsB,qCAAqC,0DAK1D;AAED,sFAAsF;AACtF,qBAAa,0BAA2B,SAAQ,uBAAuB;IAC5D,mBAAmB,0DAE3B;CACF;AAED,0FAA0F;AAC1F,wBAAgB,wBAAwB,CAAC,eAAe,EAAE,eAAe,eAQxE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BaseAccount } from '@aztec/aztec.js/account';
|
|
2
|
+
import { DefaultAccountEntrypoint } from '@aztec/entrypoints/account';
|
|
3
|
+
import { loadContractArtifact } from '@aztec/stdlib/abi';
|
|
4
|
+
import { StubBaseAccountContract } from '../../defaults/stub_account_contract.js';
|
|
5
|
+
/**
|
|
6
|
+
* Lazily loads the Schnorr stub contract artifact (browser-compatible).
|
|
7
|
+
*/ export async function getStubSchnorrAccountContractArtifact() {
|
|
8
|
+
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
9
|
+
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
10
|
+
const { default: json } = await import('../../../artifacts/SimulatedSchnorrAccount.json');
|
|
11
|
+
return loadContractArtifact(json);
|
|
12
|
+
}
|
|
13
|
+
/** Stub account contract for Schnorr accounts. Lazily loads the contract artifact. */ export class StubSchnorrAccountContract extends StubBaseAccountContract {
|
|
14
|
+
getContractArtifact() {
|
|
15
|
+
return getStubSchnorrAccountContractArtifact();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/** Creates a Schnorr stub account that impersonates the one with the provided address. */ export function createStubSchnorrAccount(originalAddress) {
|
|
19
|
+
const accountContract = new StubSchnorrAccountContract();
|
|
20
|
+
const authWitnessProvider = accountContract.getAuthWitnessProvider(originalAddress);
|
|
21
|
+
return new BaseAccount(new DefaultAccountEntrypoint(originalAddress.address, authWitnessProvider), authWitnessProvider, originalAddress);
|
|
22
|
+
}
|
|
@@ -5,6 +5,10 @@ export declare const INITIAL_TEST_SECRET_KEYS: Fr[];
|
|
|
5
5
|
export declare const INITIAL_TEST_ENCRYPTION_KEYS: import("@aztec/foundation/curves/bn254").Fq[];
|
|
6
6
|
export declare const INITIAL_TEST_SIGNING_KEYS: import("@aztec/foundation/curves/bn254").Fq[];
|
|
7
7
|
export declare const INITIAL_TEST_ACCOUNT_SALTS: Fr[];
|
|
8
|
+
/**
|
|
9
|
+
* The schnorr account contract variant a test account uses.
|
|
10
|
+
*/
|
|
11
|
+
export type InitialAccountType = 'schnorr' | 'schnorr_initializerless';
|
|
8
12
|
/**
|
|
9
13
|
* Data for generating an initial account.
|
|
10
14
|
*/
|
|
@@ -25,5 +29,9 @@ export interface InitialAccountData {
|
|
|
25
29
|
* Address of the schnorr account contract.
|
|
26
30
|
*/
|
|
27
31
|
address: AztecAddress;
|
|
32
|
+
/**
|
|
33
|
+
* Account contract variant.
|
|
34
|
+
*/
|
|
35
|
+
type?: InitialAccountType;
|
|
28
36
|
}
|
|
29
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
37
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlndXJhdGlvbi5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Rlc3RpbmcvY29uZmlndXJhdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLG1DQUFtQyxDQUFDO0FBQ25FLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBR2hFLGVBQU8sTUFBTSx3QkFBd0IsTUFJcEMsQ0FBQztBQUVGLGVBQU8sTUFBTSw0QkFBNEIsK0NBRXhDLENBQUM7QUFFRixlQUFPLE1BQU0seUJBQXlCLCtDQUErQixDQUFDO0FBRXRFLGVBQU8sTUFBTSwwQkFBMEIsTUFBOEIsQ0FBQztBQUV0RTs7R0FFRztBQUNILE1BQU0sTUFBTSxrQkFBa0IsR0FBRyxTQUFTLEdBQUcseUJBQXlCLENBQUM7QUFFdkU7O0dBRUc7QUFDSCxNQUFNLFdBQVcsa0JBQWtCO0lBQ2pDOztPQUVHO0lBQ0gsTUFBTSxFQUFFLEVBQUUsQ0FBQztJQUNYOztPQUVHO0lBQ0gsVUFBVSxFQUFFLGNBQWMsQ0FBQztJQUMzQjs7T0FFRztJQUNILElBQUksRUFBRSxFQUFFLENBQUM7SUFDVDs7T0FFRztJQUNILE9BQU8sRUFBRSxZQUFZLENBQUM7SUFDdEI7O09BRUc7SUFDSCxJQUFJLENBQUMsRUFBRSxrQkFBa0IsQ0FBQztDQUMzQiJ9
|
|
@@ -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,+CAA+B,CAAC;AAEtE,eAAO,MAAM,0BAA0B,MAA8B,CAAC;AAEtE;;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;
|
|
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,+CAA+B,CAAC;AAEtE,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"}
|
package/dest/testing/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type InitialAccountData } from './configuration.js';
|
|
2
|
-
export { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_ENCRYPTION_KEYS, INITIAL_TEST_SECRET_KEYS, INITIAL_TEST_SIGNING_KEYS, type InitialAccountData, } from './configuration.js';
|
|
1
|
+
import { type InitialAccountData, type InitialAccountType } from './configuration.js';
|
|
2
|
+
export { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_ENCRYPTION_KEYS, INITIAL_TEST_SECRET_KEYS, INITIAL_TEST_SIGNING_KEYS, type InitialAccountData, type InitialAccountType, } from './configuration.js';
|
|
3
3
|
/**
|
|
4
4
|
* Gets the basic information for initial test accounts.
|
|
5
5
|
*/
|
|
6
6
|
export declare function getInitialTestAccountsData(): Promise<InitialAccountData[]>;
|
|
7
7
|
/**
|
|
8
|
-
* Generate a fixed amount of random schnorr account contract
|
|
8
|
+
* Generate a fixed amount of random schnorr account contract instances of the given type
|
|
9
9
|
*/
|
|
10
|
-
export declare function generateSchnorrAccounts(numberOfAccounts: number): Promise<
|
|
11
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
10
|
+
export declare function generateSchnorrAccounts(numberOfAccounts: number, type?: InitialAccountType): Promise<InitialAccountData[]>;
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0aW5nL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVdBLE9BQU8sRUFLTCxLQUFLLGtCQUFrQixFQUN2QixLQUFLLGtCQUFrQixFQUN4QixNQUFNLG9CQUFvQixDQUFDO0FBRTVCLE9BQU8sRUFDTCwwQkFBMEIsRUFDMUIsNEJBQTRCLEVBQzVCLHdCQUF3QixFQUN4Qix5QkFBeUIsRUFDekIsS0FBSyxrQkFBa0IsRUFDdkIsS0FBSyxrQkFBa0IsR0FDeEIsTUFBTSxvQkFBb0IsQ0FBQztBQVM1Qjs7R0FFRztBQUNILHdCQUFnQiwwQkFBMEIsSUFBSSxPQUFPLENBQUMsa0JBQWtCLEVBQUUsQ0FBQyxDQWMxRTtBQUVEOztHQUVHO0FBQ0gsd0JBQXNCLHVCQUF1QixDQUMzQyxnQkFBZ0IsRUFBRSxNQUFNLEVBQ3hCLElBQUksR0FBRSxrQkFBOEMsR0FDbkQsT0FBTyxDQUFDLGtCQUFrQixFQUFFLENBQUMsQ0FjL0IifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAKL,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,CAc/B"}
|
package/dest/testing/index.js
CHANGED
|
@@ -4,9 +4,13 @@
|
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/ import { Fr } from '@aztec/aztec.js/fields';
|
|
6
6
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
7
|
-
import {
|
|
7
|
+
import { getSchnorrInitializerlessAccountContractAddress } from '../schnorr/initializerless/index.js';
|
|
8
|
+
import { getSchnorrAccountContractAddress } from '../schnorr/private_immutable/index.js';
|
|
8
9
|
import { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_ENCRYPTION_KEYS, INITIAL_TEST_SECRET_KEYS, INITIAL_TEST_SIGNING_KEYS } from './configuration.js';
|
|
9
10
|
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, secret, salt, signingKey) {
|
|
12
|
+
return type === 'schnorr' ? getSchnorrAccountContractAddress(secret, salt, signingKey) : getSchnorrInitializerlessAccountContractAddress(secret, salt, signingKey);
|
|
13
|
+
}
|
|
10
14
|
/**
|
|
11
15
|
* Gets the basic information for initial test accounts.
|
|
12
16
|
*/ export function getInitialTestAccountsData() {
|
|
@@ -14,12 +18,13 @@ export { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_ENCRYPTION_KEYS, INITIAL_TEST_
|
|
|
14
18
|
secret,
|
|
15
19
|
signingKey: INITIAL_TEST_ENCRYPTION_KEYS[i],
|
|
16
20
|
salt: INITIAL_TEST_ACCOUNT_SALTS[i],
|
|
17
|
-
|
|
21
|
+
type: 'schnorr_initializerless',
|
|
22
|
+
address: await getSchnorrInitializerlessAccountContractAddress(secret, INITIAL_TEST_ACCOUNT_SALTS[i], INITIAL_TEST_SIGNING_KEYS[i])
|
|
18
23
|
})));
|
|
19
24
|
}
|
|
20
25
|
/**
|
|
21
|
-
* Generate a fixed amount of random schnorr account contract
|
|
22
|
-
*/ export async function generateSchnorrAccounts(numberOfAccounts) {
|
|
26
|
+
* Generate a fixed amount of random schnorr account contract instances of the given type
|
|
27
|
+
*/ export async function generateSchnorrAccounts(numberOfAccounts, type = 'schnorr_initializerless') {
|
|
23
28
|
const secrets = Array.from({
|
|
24
29
|
length: numberOfAccounts
|
|
25
30
|
}, ()=>Fr.random());
|
|
@@ -29,7 +34,8 @@ export { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_ENCRYPTION_KEYS, INITIAL_TEST_
|
|
|
29
34
|
secret,
|
|
30
35
|
signingKey: deriveSigningKey(secret),
|
|
31
36
|
salt,
|
|
32
|
-
|
|
37
|
+
type,
|
|
38
|
+
address: await getTestAccountAddress(type, secret, salt)
|
|
33
39
|
};
|
|
34
40
|
}));
|
|
35
41
|
}
|
package/dest/testing/lazy.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type InitialAccountData } from './configuration.js';
|
|
1
|
+
import { type InitialAccountData, type InitialAccountType } from './configuration.js';
|
|
2
2
|
export { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_SECRET_KEYS } from './configuration.js';
|
|
3
3
|
/**
|
|
4
4
|
* Gets the basic information for initial test accounts.
|
|
5
5
|
*/
|
|
6
6
|
export declare function getInitialTestAccountsData(): Promise<InitialAccountData[]>;
|
|
7
7
|
/**
|
|
8
|
-
* Generate a fixed amount of random schnorr account contract
|
|
8
|
+
* Generate a fixed amount of random schnorr account contract instances of the given type
|
|
9
9
|
*/
|
|
10
|
-
export declare function generateSchnorrAccounts(numberOfAccounts: number): Promise<InitialAccountData[]>;
|
|
11
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
10
|
+
export declare function generateSchnorrAccounts(numberOfAccounts: number, type?: InitialAccountType): Promise<InitialAccountData[]>;
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Rlc3RpbmcvbGF6eS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFXQSxPQUFPLEVBS0wsS0FBSyxrQkFBa0IsRUFDdkIsS0FBSyxrQkFBa0IsRUFDeEIsTUFBTSxvQkFBb0IsQ0FBQztBQUU1QixPQUFPLEVBQUUsMEJBQTBCLEVBQUUsd0JBQXdCLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQVMxRjs7R0FFRztBQUNILHdCQUFnQiwwQkFBMEIsSUFBSSxPQUFPLENBQUMsa0JBQWtCLEVBQUUsQ0FBQyxDQWMxRTtBQUVEOztHQUVHO0FBQ0gsd0JBQXNCLHVCQUF1QixDQUMzQyxnQkFBZ0IsRUFBRSxNQUFNLEVBQ3hCLElBQUksR0FBRSxrQkFBOEMsR0FDbkQsT0FBTyxDQUFDLGtCQUFrQixFQUFFLENBQUMsQ0FjL0IifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/testing/lazy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/testing/lazy.ts"],"names":[],"mappings":"AAWA,OAAO,EAKL,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,CAc/B"}
|
package/dest/testing/lazy.js
CHANGED
|
@@ -4,9 +4,13 @@
|
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/ import { Fr } from '@aztec/aztec.js/fields';
|
|
6
6
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
7
|
-
import {
|
|
7
|
+
import { getSchnorrInitializerlessAccountContractAddress } from '../schnorr/initializerless/lazy.js';
|
|
8
|
+
import { getSchnorrAccountContractAddress } from '../schnorr/private_immutable/lazy.js';
|
|
8
9
|
import { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_ENCRYPTION_KEYS, INITIAL_TEST_SECRET_KEYS, INITIAL_TEST_SIGNING_KEYS } from './configuration.js';
|
|
9
10
|
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, secret, salt, signingKey) {
|
|
12
|
+
return type === 'schnorr' ? getSchnorrAccountContractAddress(secret, salt, signingKey) : getSchnorrInitializerlessAccountContractAddress(secret, salt, signingKey);
|
|
13
|
+
}
|
|
10
14
|
/**
|
|
11
15
|
* Gets the basic information for initial test accounts.
|
|
12
16
|
*/ export function getInitialTestAccountsData() {
|
|
@@ -14,12 +18,13 @@ export { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_SECRET_KEYS } from './configur
|
|
|
14
18
|
secret,
|
|
15
19
|
signingKey: INITIAL_TEST_ENCRYPTION_KEYS[i],
|
|
16
20
|
salt: INITIAL_TEST_ACCOUNT_SALTS[i],
|
|
17
|
-
|
|
21
|
+
type: 'schnorr_initializerless',
|
|
22
|
+
address: await getSchnorrInitializerlessAccountContractAddress(secret, INITIAL_TEST_ACCOUNT_SALTS[i], INITIAL_TEST_SIGNING_KEYS[i])
|
|
18
23
|
})));
|
|
19
24
|
}
|
|
20
25
|
/**
|
|
21
|
-
* Generate a fixed amount of random schnorr account contract
|
|
22
|
-
*/ export async function generateSchnorrAccounts(numberOfAccounts) {
|
|
26
|
+
* Generate a fixed amount of random schnorr account contract instances of the given type
|
|
27
|
+
*/ export async function generateSchnorrAccounts(numberOfAccounts, type = 'schnorr_initializerless') {
|
|
23
28
|
const secrets = Array.from({
|
|
24
29
|
length: numberOfAccounts
|
|
25
30
|
}, ()=>Fr.random());
|
|
@@ -29,7 +34,8 @@ export { INITIAL_TEST_ACCOUNT_SALTS, INITIAL_TEST_SECRET_KEYS } from './configur
|
|
|
29
34
|
secret,
|
|
30
35
|
signingKey: deriveSigningKey(secret),
|
|
31
36
|
salt,
|
|
32
|
-
|
|
37
|
+
type,
|
|
38
|
+
address: await getTestAccountAddress(type, secret, salt)
|
|
33
39
|
};
|
|
34
40
|
}));
|
|
35
41
|
}
|
|
@@ -30,4 +30,4 @@ export declare function getIdentities(): Promise<StoredKey[]>;
|
|
|
30
30
|
*/
|
|
31
31
|
export declare function signWithAgent(keyType: Buffer, curveName: Buffer, publicKey: Buffer, data: Buffer): Promise<Buffer<ArrayBufferLike>>;
|
|
32
32
|
export {};
|
|
33
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
33
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3NoX2FnZW50LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvc3NoX2FnZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxRQUFRLENBQUM7QUFDaEMsT0FBTyxHQUFHLE1BQU0sS0FBSyxDQUFDO0FBT3RCOztHQUVHO0FBQ0gsd0JBQWdCLGNBQWMsZUFNN0I7QUFFRDs7R0FFRztBQUNILEtBQUssU0FBUyxHQUFHO0lBQ2Y7O09BRUc7SUFDSCxJQUFJLEVBQUUsTUFBTSxDQUFDO0lBQ2I7O09BRUc7SUFDSCxTQUFTLEVBQUUsTUFBTSxDQUFDO0lBQ2xCOztPQUVHO0lBQ0gsT0FBTyxFQUFFLE1BQU0sQ0FBQztDQUNqQixDQUFDO0FBRUY7O0dBRUc7QUFDSCx3QkFBZ0IsYUFBYSxJQUFJLE9BQU8sQ0FBQyxTQUFTLEVBQUUsQ0FBQyxDQW1EcEQ7QUFFRDs7R0FFRztBQUNILHdCQUFnQixhQUFhLENBQUMsT0FBTyxFQUFFLE1BQU0sRUFBRSxTQUFTLEVBQUUsTUFBTSxFQUFFLFNBQVMsRUFBRSxNQUFNLEVBQUUsSUFBSSxFQUFFLE1BQU0sb0NBeUNoRyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssh_agent.d.ts","sourceRoot":"","sources":["../../src/utils/ssh_agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,GAAG,MAAM,KAAK,CAAC;AAOtB;;GAEG;AACH,wBAAgB,cAAc,eAM7B;AAED;;GAEG;AACH,KAAK,SAAS,GAAG;IACf;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"ssh_agent.d.ts","sourceRoot":"","sources":["../../src/utils/ssh_agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,GAAG,MAAM,KAAK,CAAC;AAOtB;;GAEG;AACH,wBAAgB,cAAc,eAM7B;AAED;;GAEG;AACH,KAAK,SAAS,GAAG;IACf;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,CAmDpD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,oCAyChG"}
|
package/dest/utils/ssh_agent.js
CHANGED
|
@@ -18,6 +18,7 @@ const SSH_AGENT_SIGN_RESPONSE = 14;
|
|
|
18
18
|
*/ export function getIdentities() {
|
|
19
19
|
return new Promise((resolve, reject)=>{
|
|
20
20
|
const stream = connectToAgent();
|
|
21
|
+
stream.on('error', reject);
|
|
21
22
|
stream.on('connect', ()=>{
|
|
22
23
|
const request = Buffer.concat([
|
|
23
24
|
Buffer.from([
|
|
@@ -78,6 +79,7 @@ const SSH_AGENT_SIGN_RESPONSE = 14;
|
|
|
78
79
|
*/ export function signWithAgent(keyType, curveName, publicKey, data) {
|
|
79
80
|
return new Promise((resolve, reject)=>{
|
|
80
81
|
const stream = connectToAgent();
|
|
82
|
+
stream.on('error', reject);
|
|
81
83
|
stream.on('connect', ()=>{
|
|
82
84
|
// Construct the key blob
|
|
83
85
|
const keyBlob = Buffer.concat([
|
package/package.json
CHANGED
|
@@ -2,22 +2,20 @@
|
|
|
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": "0.0.1-commit.
|
|
5
|
+
"version": "0.0.1-commit.a4600f49",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
8
8
|
"./defaults": "./dest/defaults/index.js",
|
|
9
9
|
"./ecdsa": "./dest/ecdsa/index.js",
|
|
10
10
|
"./ecdsa/lazy": "./dest/ecdsa/lazy.js",
|
|
11
|
+
"./ecdsa/stub": "./dest/ecdsa/stub/index.js",
|
|
12
|
+
"./ecdsa/stub/lazy": "./dest/ecdsa/stub/lazy.js",
|
|
11
13
|
"./schnorr": "./dest/schnorr/index.js",
|
|
12
14
|
"./schnorr/lazy": "./dest/schnorr/lazy.js",
|
|
13
|
-
"./
|
|
14
|
-
"./
|
|
15
|
-
"./stub": "./dest/stub/index.js",
|
|
16
|
-
"./stub/lazy": "./dest/stub/lazy.js",
|
|
15
|
+
"./schnorr/stub": "./dest/schnorr/stub/index.js",
|
|
16
|
+
"./schnorr/stub/lazy": "./dest/schnorr/stub/lazy.js",
|
|
17
17
|
"./testing": "./dest/testing/index.js",
|
|
18
18
|
"./testing/lazy": "./dest/testing/lazy.js",
|
|
19
|
-
"./copy-cat": "./dest/copy_cat/index.js",
|
|
20
|
-
"./copy-cat/lazy": "./dest/copy_cat/lazy.js",
|
|
21
19
|
"./utils": "./dest/utils/index.js"
|
|
22
20
|
},
|
|
23
21
|
"typedocOptions": {
|
|
@@ -25,7 +23,6 @@
|
|
|
25
23
|
"./src/defaults/index.ts",
|
|
26
24
|
"./src/ecdsa/index.ts",
|
|
27
25
|
"./src/schnorr/index.ts",
|
|
28
|
-
"./src/single_key/index.ts",
|
|
29
26
|
"./src/testing/index.ts"
|
|
30
27
|
],
|
|
31
28
|
"name": "Accounts",
|
|
@@ -82,11 +79,11 @@
|
|
|
82
79
|
]
|
|
83
80
|
},
|
|
84
81
|
"dependencies": {
|
|
85
|
-
"@aztec/aztec.js": "0.0.1-commit.
|
|
86
|
-
"@aztec/entrypoints": "0.0.1-commit.
|
|
87
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
88
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
89
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
82
|
+
"@aztec/aztec.js": "0.0.1-commit.a4600f49",
|
|
83
|
+
"@aztec/entrypoints": "0.0.1-commit.a4600f49",
|
|
84
|
+
"@aztec/ethereum": "0.0.1-commit.a4600f49",
|
|
85
|
+
"@aztec/foundation": "0.0.1-commit.a4600f49",
|
|
86
|
+
"@aztec/stdlib": "0.0.1-commit.a4600f49",
|
|
90
87
|
"tslib": "^2.4.0"
|
|
91
88
|
},
|
|
92
89
|
"devDependencies": {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Account, type AccountContract, type AuthWitnessProvider, BaseAccount } from '@aztec/aztec.js/account';
|
|
2
2
|
import { DefaultAccountEntrypoint } from '@aztec/entrypoints/account';
|
|
3
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
4
|
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
4
5
|
import type { CompleteAddress } from '@aztec/stdlib/contract';
|
|
5
6
|
|
|
@@ -22,6 +23,14 @@ export abstract class DefaultAccountContract implements AccountContract {
|
|
|
22
23
|
|
|
23
24
|
constructor() {}
|
|
24
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Accounts without immutables (the default) contribute to their address via an on-chain
|
|
28
|
+
* initializer instead. Account contracts that commit immutables into their address override this.
|
|
29
|
+
*/
|
|
30
|
+
getImmutablesHash(): Promise<Fr | undefined> {
|
|
31
|
+
return Promise.resolve(undefined);
|
|
32
|
+
}
|
|
33
|
+
|
|
25
34
|
getAccount(completeAddress: CompleteAddress): Account {
|
|
26
35
|
const authWitnessProvider = this.getAuthWitnessProvider(completeAddress);
|
|
27
36
|
return new BaseAccount(
|
|
@@ -21,7 +21,7 @@ export abstract class EcdsaKBaseAccountContract extends DefaultAccountContract {
|
|
|
21
21
|
const signingPublicKey = await new Ecdsa().computePublicKey(this.signingPrivateKey);
|
|
22
22
|
return {
|
|
23
23
|
constructorName: 'constructor',
|
|
24
|
-
constructorArgs: [signingPublicKey.subarray(0, 32), signingPublicKey.subarray(32, 64)],
|
|
24
|
+
constructorArgs: [[...signingPublicKey.subarray(0, 32)], [...signingPublicKey.subarray(32, 64)]],
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -16,7 +16,7 @@ import { EcdsaKBaseAccountContract } from './account_contract.js';
|
|
|
16
16
|
export async function getEcdsaKAccountContractArtifact() {
|
|
17
17
|
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
18
18
|
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
19
|
-
// Even if now supported by
|
|
19
|
+
// Even if now supported by all major browsers, the MIME type is replaced with
|
|
20
20
|
// "text/javascript"
|
|
21
21
|
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
22
22
|
const { default: ecdsaKAccountContractJson } = await import('../../../artifacts/EcdsaKAccount.json');
|
|
@@ -21,7 +21,7 @@ export abstract class EcdsaRBaseAccountContract extends DefaultAccountContract {
|
|
|
21
21
|
const signingPublicKey = await new Ecdsa('secp256r1').computePublicKey(this.signingPrivateKey);
|
|
22
22
|
return {
|
|
23
23
|
constructorName: 'constructor',
|
|
24
|
-
constructorArgs: [signingPublicKey.subarray(0, 32), signingPublicKey.subarray(32, 64)],
|
|
24
|
+
constructorArgs: [[...signingPublicKey.subarray(0, 32)], [...signingPublicKey.subarray(32, 64)]],
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -16,7 +16,7 @@ import { EcdsaRBaseAccountContract } from './account_contract.js';
|
|
|
16
16
|
export async function getEcdsaRAccountContractArtifact() {
|
|
17
17
|
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
18
18
|
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
19
|
-
// Even if now supported by
|
|
19
|
+
// Even if now supported by all major browsers, the MIME type is replaced with
|
|
20
20
|
// "text/javascript"
|
|
21
21
|
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
22
22
|
const { default: ecdsaKAccountContractJson } = await import('../../../artifacts/EcdsaRAccount.json');
|
|
@@ -25,7 +25,7 @@ export abstract class EcdsaRSSHBaseAccountContract extends DefaultAccountContrac
|
|
|
25
25
|
getInitializationFunctionAndArgs() {
|
|
26
26
|
return Promise.resolve({
|
|
27
27
|
constructorName: 'constructor',
|
|
28
|
-
constructorArgs: [this.signingPublicKey.subarray(0, 32), this.signingPublicKey.subarray(32, 64)],
|
|
28
|
+
constructorArgs: [[...this.signingPublicKey.subarray(0, 32)], [...this.signingPublicKey.subarray(32, 64)]],
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
|