@aztec-labs/accounts 6.0.0-nightly.20260829
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 +40 -0
- package/artifacts/EcdsaKAccount.d.json.ts +3 -0
- package/artifacts/EcdsaKAccount.json +12861 -0
- package/artifacts/EcdsaRAccount.d.json.ts +3 -0
- package/artifacts/EcdsaRAccount.json +12861 -0
- package/artifacts/SchnorrAccount.d.json.ts +3 -0
- package/artifacts/SchnorrAccount.json +12914 -0
- package/artifacts/SchnorrInitializerlessAccount.d.json.ts +3 -0
- package/artifacts/SchnorrInitializerlessAccount.json +8530 -0
- package/artifacts/SimulatedEcdsaAccount.d.json.ts +3 -0
- package/artifacts/SimulatedEcdsaAccount.json +10980 -0
- package/artifacts/SimulatedSchnorrAccount.d.json.ts +3 -0
- package/artifacts/SimulatedSchnorrAccount.json +11092 -0
- package/dest/defaults/account_contract.d.ts +26 -0
- package/dest/defaults/account_contract.d.ts.map +1 -0
- package/dest/defaults/account_contract.js +18 -0
- package/dest/defaults/index.d.ts +9 -0
- package/dest/defaults/index.d.ts.map +1 -0
- package/dest/defaults/index.js +7 -0
- package/dest/defaults/stub_account_contract.d.ts +29 -0
- package/dest/defaults/stub_account_contract.d.ts.map +1 -0
- package/dest/defaults/stub_account_contract.js +30 -0
- package/dest/ecdsa/ecdsa_k/account_contract.d.ts +19 -0
- package/dest/ecdsa/ecdsa_k/account_contract.d.ts.map +1 -0
- package/dest/ecdsa/ecdsa_k/account_contract.js +45 -0
- package/dest/ecdsa/ecdsa_k/index.d.ts +19 -0
- package/dest/ecdsa/ecdsa_k/index.d.ts.map +1 -0
- package/dest/ecdsa/ecdsa_k/index.js +23 -0
- package/dest/ecdsa/ecdsa_k/lazy.d.ts +23 -0
- package/dest/ecdsa/ecdsa_k/lazy.d.ts.map +1 -0
- package/dest/ecdsa/ecdsa_k/lazy.js +31 -0
- package/dest/ecdsa/ecdsa_r/account_contract.d.ts +19 -0
- package/dest/ecdsa/ecdsa_r/account_contract.d.ts.map +1 -0
- package/dest/ecdsa/ecdsa_r/account_contract.js +45 -0
- package/dest/ecdsa/ecdsa_r/index.d.ts +19 -0
- package/dest/ecdsa/ecdsa_r/index.d.ts.map +1 -0
- package/dest/ecdsa/ecdsa_r/index.js +23 -0
- package/dest/ecdsa/ecdsa_r/lazy.d.ts +23 -0
- package/dest/ecdsa/ecdsa_r/lazy.d.ts.map +1 -0
- package/dest/ecdsa/ecdsa_r/lazy.js +31 -0
- package/dest/ecdsa/index.d.ts +4 -0
- package/dest/ecdsa/index.d.ts.map +1 -0
- package/dest/ecdsa/index.js +3 -0
- package/dest/ecdsa/lazy.d.ts +4 -0
- package/dest/ecdsa/lazy.d.ts.map +1 -0
- package/dest/ecdsa/lazy.js +3 -0
- package/dest/ecdsa/ssh_ecdsa_r/account_contract.d.ts +22 -0
- package/dest/ecdsa/ssh_ecdsa_r/account_contract.d.ts.map +1 -0
- package/dest/ecdsa/ssh_ecdsa_r/account_contract.js +87 -0
- package/dest/ecdsa/ssh_ecdsa_r/index.d.ts +21 -0
- package/dest/ecdsa/ssh_ecdsa_r/index.d.ts.map +1 -0
- package/dest/ecdsa/ssh_ecdsa_r/index.js +22 -0
- package/dest/ecdsa/ssh_ecdsa_r/lazy.d.ts +21 -0
- package/dest/ecdsa/ssh_ecdsa_r/lazy.d.ts.map +1 -0
- package/dest/ecdsa/ssh_ecdsa_r/lazy.js +22 -0
- 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 +32 -0
- package/dest/schnorr/account_contract.d.ts.map +1 -0
- package/dest/schnorr/account_contract.js +41 -0
- package/dest/schnorr/index.d.ts +3 -0
- package/dest/schnorr/index.d.ts.map +1 -0
- package/dest/schnorr/index.js +2 -0
- 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 -0
- package/dest/schnorr/lazy.d.ts.map +1 -0
- package/dest/schnorr/lazy.js +2 -0
- 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 +37 -0
- package/dest/testing/configuration.d.ts.map +1 -0
- package/dest/testing/configuration.js +19 -0
- package/dest/testing/index.d.ts +11 -0
- package/dest/testing/index.d.ts.map +1 -0
- package/dest/testing/index.js +43 -0
- package/dest/testing/lazy.d.ts +11 -0
- package/dest/testing/lazy.d.ts.map +1 -0
- package/dest/testing/lazy.js +43 -0
- package/dest/utils/index.d.ts +3 -0
- package/dest/utils/index.d.ts.map +1 -0
- package/dest/utils/index.js +2 -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 +19 -0
- package/dest/utils/ssh_agent.d.ts +33 -0
- package/dest/utils/ssh_agent.d.ts.map +1 -0
- package/dest/utils/ssh_agent.js +155 -0
- package/package.json +108 -0
- package/src/defaults/account_contract.ts +47 -0
- package/src/defaults/index.ts +9 -0
- package/src/defaults/stub_account_contract.ts +39 -0
- package/src/ecdsa/ecdsa_k/account_contract.ts +42 -0
- package/src/ecdsa/ecdsa_k/index.ts +31 -0
- package/src/ecdsa/ecdsa_k/lazy.ts +39 -0
- package/src/ecdsa/ecdsa_r/account_contract.ts +42 -0
- package/src/ecdsa/ecdsa_r/index.ts +31 -0
- package/src/ecdsa/ecdsa_r/lazy.ts +39 -0
- package/src/ecdsa/index.ts +3 -0
- package/src/ecdsa/lazy.ts +3 -0
- package/src/ecdsa/ssh_ecdsa_r/account_contract.ts +92 -0
- package/src/ecdsa/ssh_ecdsa_r/index.ts +28 -0
- package/src/ecdsa/ssh_ecdsa_r/lazy.ts +28 -0
- package/src/ecdsa/stub/index.ts +28 -0
- package/src/ecdsa/stub/lazy.ts +34 -0
- package/src/schnorr/account_contract.ts +53 -0
- package/src/schnorr/index.ts +2 -0
- package/src/schnorr/initializerless/index.ts +62 -0
- package/src/schnorr/initializerless/lazy.ts +70 -0
- package/src/schnorr/lazy.ts +2 -0
- 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 +53 -0
- package/src/testing/index.ts +76 -0
- package/src/testing/lazy.ts +69 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/key_derivation.ts +18 -0
- package/src/utils/ssh_agent.ts +138 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { EcdsaSignature } from '@aztec-labs/foundation/crypto/ecdsa';
|
|
2
|
+
import { AuthWitness } from '@aztec-labs/stdlib/auth-witness';
|
|
3
|
+
import { DefaultAccountContract } from '../../defaults/account_contract.js';
|
|
4
|
+
import { signWithAgent } from '../../utils/ssh_agent.js';
|
|
5
|
+
const secp256r1N = 115792089210356248762697446949407573529996955224135760342422259061068512044369n;
|
|
6
|
+
/**
|
|
7
|
+
* Account contract that authenticates transactions using ECDSA signatures
|
|
8
|
+
* verified against a secp256r1 public key stored in an immutable encrypted note.
|
|
9
|
+
* Since this implementation relays signatures to an SSH agent, we provide the
|
|
10
|
+
* public key here not for signature verification, but to identify actual identity
|
|
11
|
+
* that will be used to sign authwitnesses.
|
|
12
|
+
* This abstract version does not provide a way to retrieve the artifact, as it
|
|
13
|
+
* can be implemented with or without lazy loading.
|
|
14
|
+
*/ export class EcdsaRSSHBaseAccountContract extends DefaultAccountContract {
|
|
15
|
+
signingPublicKey;
|
|
16
|
+
constructor(signingPublicKey){
|
|
17
|
+
super(), this.signingPublicKey = signingPublicKey;
|
|
18
|
+
}
|
|
19
|
+
getInitializationFunctionAndArgs() {
|
|
20
|
+
return Promise.resolve({
|
|
21
|
+
constructorName: 'constructor',
|
|
22
|
+
constructorArgs: [
|
|
23
|
+
[
|
|
24
|
+
...this.signingPublicKey.subarray(0, 32)
|
|
25
|
+
],
|
|
26
|
+
[
|
|
27
|
+
...this.signingPublicKey.subarray(32, 64)
|
|
28
|
+
]
|
|
29
|
+
]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
getAuthWitnessProvider(_address) {
|
|
33
|
+
return new SSHEcdsaRAuthWitnessProvider(this.signingPublicKey);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/** Creates auth witnesses using ECDSA signatures. */ class SSHEcdsaRAuthWitnessProvider {
|
|
37
|
+
signingPublicKey;
|
|
38
|
+
constructor(signingPublicKey){
|
|
39
|
+
this.signingPublicKey = signingPublicKey;
|
|
40
|
+
}
|
|
41
|
+
#parseECDSASignature(data) {
|
|
42
|
+
// Extract ECDSA signature components
|
|
43
|
+
let offset = 0;
|
|
44
|
+
const sigTypeLen = data.readUInt32BE(offset);
|
|
45
|
+
offset += 4;
|
|
46
|
+
const sigType = data.subarray(offset, offset + sigTypeLen).toString();
|
|
47
|
+
offset += sigTypeLen;
|
|
48
|
+
if (sigType !== 'ecdsa-sha2-nistp256') {
|
|
49
|
+
throw new Error(`Unexpected signature type: ${sigType}`);
|
|
50
|
+
}
|
|
51
|
+
offset += 4;
|
|
52
|
+
const rLen = data.readUInt32BE(offset);
|
|
53
|
+
offset += 4;
|
|
54
|
+
let r = data.subarray(offset, offset + rLen);
|
|
55
|
+
offset += rLen;
|
|
56
|
+
const sLen = data.readUInt32BE(offset);
|
|
57
|
+
offset += 4;
|
|
58
|
+
let s = data.subarray(offset, offset + sLen);
|
|
59
|
+
// R and S are encoded using ASN.1 DER format, which may include a leading zero byte to avoid interpreting the value as negative
|
|
60
|
+
if (r.length > 32) {
|
|
61
|
+
r = Buffer.from(Uint8Array.prototype.slice.call(r, 1));
|
|
62
|
+
}
|
|
63
|
+
if (s.length > 32) {
|
|
64
|
+
s = Buffer.from(Uint8Array.prototype.slice.call(s, 1));
|
|
65
|
+
}
|
|
66
|
+
const maybeHighS = BigInt(`0x${s.toString('hex')}`);
|
|
67
|
+
// ECDSA signatures must have a low S value so they can be used as a nullifier. BB forces a value of 27 for v, so
|
|
68
|
+
// only one PublicKey can verify the signature (and not its negated counterpart) https://ethereum.stackexchange.com/a/55728
|
|
69
|
+
if (maybeHighS > secp256r1N / 2n + 1n) {
|
|
70
|
+
s = Buffer.from((secp256r1N - maybeHighS).toString(16), 'hex');
|
|
71
|
+
}
|
|
72
|
+
return new EcdsaSignature(r, s, Buffer.from([
|
|
73
|
+
0
|
|
74
|
+
]));
|
|
75
|
+
}
|
|
76
|
+
async createAuthWit(messageHash) {
|
|
77
|
+
// Key type and curve name
|
|
78
|
+
const keyType = Buffer.from('ecdsa-sha2-nistp256');
|
|
79
|
+
const curveName = Buffer.from('nistp256');
|
|
80
|
+
const data = await signWithAgent(keyType, curveName, this.signingPublicKey, messageHash.toBuffer());
|
|
81
|
+
const signature = this.#parseECDSASignature(data);
|
|
82
|
+
return new AuthWitness(messageHash, [
|
|
83
|
+
...signature.r,
|
|
84
|
+
...signature.s
|
|
85
|
+
]);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `@aztec-labs/accounts/ecdsa` export provides an ECDSA account contract implementation, that uses an ECDSA private key for authentication, and a Grumpkin key for encryption.
|
|
3
|
+
* Consider using this account type when working with integrations with Ethereum wallets.
|
|
4
|
+
*
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/
|
|
7
|
+
import type { ContractArtifact } from '@aztec-labs/stdlib/abi';
|
|
8
|
+
import { EcdsaRSSHBaseAccountContract } from './account_contract.js';
|
|
9
|
+
/**
|
|
10
|
+
* Account contract that authenticates transactions using ECDSA signatures
|
|
11
|
+
* verified against a secp256r1 public key stored in an immutable encrypted note.
|
|
12
|
+
* Since this implementation relays signatures to an SSH agent, we provide the
|
|
13
|
+
* public key here not for signature verification, but to identify actual identity
|
|
14
|
+
* that will be used to sign authwitnesses.
|
|
15
|
+
* Eagerly loads the contract artifact
|
|
16
|
+
*/
|
|
17
|
+
export declare class EcdsaRSSHAccountContract extends EcdsaRSSHBaseAccountContract {
|
|
18
|
+
constructor(signingPublicKey: Buffer);
|
|
19
|
+
getContractArtifact(): Promise<ContractArtifact>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9lY2RzYS9zc2hfZWNkc2Ffci9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7R0FLRztBQUNILE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFHL0QsT0FBTyxFQUFFLDRCQUE0QixFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFFckU7Ozs7Ozs7R0FPRztBQUNILHFCQUFhLHdCQUF5QixTQUFRLDRCQUE0QjtJQUN4RSxZQUFZLGdCQUFnQixFQUFFLE1BQU0sRUFFbkM7SUFFUSxtQkFBbUIsSUFBSSxPQUFPLENBQUMsZ0JBQWdCLENBQUMsQ0FFeEQ7Q0FDRiJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ecdsa/ssh_ecdsa_r/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAErE;;;;;;;GAOG;AACH,qBAAa,wBAAyB,SAAQ,4BAA4B;IACxE,YAAY,gBAAgB,EAAE,MAAM,EAEnC;IAEQ,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAExD;CACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `@aztec-labs/accounts/ecdsa` export provides an ECDSA account contract implementation, that uses an ECDSA private key for authentication, and a Grumpkin key for encryption.
|
|
3
|
+
* Consider using this account type when working with integrations with Ethereum wallets.
|
|
4
|
+
*
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/ import { EcdsaRAccountContractArtifact } from '../ecdsa_r/index.js';
|
|
7
|
+
import { EcdsaRSSHBaseAccountContract } from './account_contract.js';
|
|
8
|
+
/**
|
|
9
|
+
* Account contract that authenticates transactions using ECDSA signatures
|
|
10
|
+
* verified against a secp256r1 public key stored in an immutable encrypted note.
|
|
11
|
+
* Since this implementation relays signatures to an SSH agent, we provide the
|
|
12
|
+
* public key here not for signature verification, but to identify actual identity
|
|
13
|
+
* that will be used to sign authwitnesses.
|
|
14
|
+
* Eagerly loads the contract artifact
|
|
15
|
+
*/ export class EcdsaRSSHAccountContract extends EcdsaRSSHBaseAccountContract {
|
|
16
|
+
constructor(signingPublicKey){
|
|
17
|
+
super(signingPublicKey);
|
|
18
|
+
}
|
|
19
|
+
getContractArtifact() {
|
|
20
|
+
return Promise.resolve(EcdsaRAccountContractArtifact);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `@aztec-labs/accounts/ecdsa` export provides an ECDSA account contract implementation, that uses an ECDSA private key for authentication, and a Grumpkin key for encryption.
|
|
3
|
+
* Consider using this account type when working with integrations with Ethereum wallets.
|
|
4
|
+
*
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/
|
|
7
|
+
import type { ContractArtifact } from '@aztec-labs/stdlib/abi';
|
|
8
|
+
import { EcdsaRSSHBaseAccountContract } from './account_contract.js';
|
|
9
|
+
/**
|
|
10
|
+
* Account contract that authenticates transactions using ECDSA signatures
|
|
11
|
+
* verified against a secp256r1 public key stored in an immutable encrypted note.
|
|
12
|
+
* Since this implementation relays signatures to an SSH agent, we provide the
|
|
13
|
+
* public key here not for signature verification, but to identify actual identity
|
|
14
|
+
* that will be used to sign authwitnesses.
|
|
15
|
+
* Lazily loads the contract artifact
|
|
16
|
+
*/
|
|
17
|
+
export declare class EcdsaRSSHAccountContract extends EcdsaRSSHBaseAccountContract {
|
|
18
|
+
constructor(signingPublicKey: Buffer);
|
|
19
|
+
getContractArtifact(): Promise<ContractArtifact>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2VjZHNhL3NzaF9lY2RzYV9yL2xhenkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7O0dBS0c7QUFDSCxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBRy9ELE9BQU8sRUFBRSw0QkFBNEIsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBRXJFOzs7Ozs7O0dBT0c7QUFDSCxxQkFBYSx3QkFBeUIsU0FBUSw0QkFBNEI7SUFDeEUsWUFBWSxnQkFBZ0IsRUFBRSxNQUFNLEVBRW5DO0lBRVEsbUJBQW1CLElBQUksT0FBTyxDQUFDLGdCQUFnQixDQUFDLENBRXhEO0NBQ0YifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../../src/ecdsa/ssh_ecdsa_r/lazy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAErE;;;;;;;GAOG;AACH,qBAAa,wBAAyB,SAAQ,4BAA4B;IACxE,YAAY,gBAAgB,EAAE,MAAM,EAEnC;IAEQ,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAExD;CACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `@aztec-labs/accounts/ecdsa` export provides an ECDSA account contract implementation, that uses an ECDSA private key for authentication, and a Grumpkin key for encryption.
|
|
3
|
+
* Consider using this account type when working with integrations with Ethereum wallets.
|
|
4
|
+
*
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/ import { getEcdsaRAccountContractArtifact } from '../ecdsa_r/lazy.js';
|
|
7
|
+
import { EcdsaRSSHBaseAccountContract } from './account_contract.js';
|
|
8
|
+
/**
|
|
9
|
+
* Account contract that authenticates transactions using ECDSA signatures
|
|
10
|
+
* verified against a secp256r1 public key stored in an immutable encrypted note.
|
|
11
|
+
* Since this implementation relays signatures to an SSH agent, we provide the
|
|
12
|
+
* public key here not for signature verification, but to identify actual identity
|
|
13
|
+
* that will be used to sign authwitnesses.
|
|
14
|
+
* Lazily loads the contract artifact
|
|
15
|
+
*/ export class EcdsaRSSHAccountContract extends EcdsaRSSHBaseAccountContract {
|
|
16
|
+
constructor(signingPublicKey){
|
|
17
|
+
super(signingPublicKey);
|
|
18
|
+
}
|
|
19
|
+
getContractArtifact() {
|
|
20
|
+
return getEcdsaRAccountContractArtifact();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseAccount } from '@aztec-labs/aztec.js/account';
|
|
2
|
+
import type { CompleteAddress } from '@aztec-labs/aztec.js/addresses';
|
|
3
|
+
import { StubBaseAccountContract } from '../../defaults/stub_account_contract.js';
|
|
4
|
+
export declare const StubEcdsaAccountContractArtifact: import("@aztec-labs/stdlib/abi").ContractArtifact;
|
|
5
|
+
/** Stub account contract for ECDSA accounts (secp256k1 and secp256r1). Eagerly loads the contract artifact. */
|
|
6
|
+
export declare class StubEcdsaAccountContract extends StubBaseAccountContract {
|
|
7
|
+
getContractArtifact(): Promise<import("@aztec-labs/stdlib/abi").ContractArtifact>;
|
|
8
|
+
}
|
|
9
|
+
/** Creates an ECDSA stub account that impersonates the one with the provided address. */
|
|
10
|
+
export declare function createStubEcdsaAccount(originalAddress: CompleteAddress): BaseAccount;
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9lY2RzYS9zdHViL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSw4QkFBOEIsQ0FBQztBQUMzRCxPQUFPLEtBQUssRUFBRSxlQUFlLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQU10RSxPQUFPLEVBQUUsdUJBQXVCLEVBQUUsTUFBTSx5Q0FBeUMsQ0FBQztBQUVsRixlQUFPLE1BQU0sZ0NBQWdDLG1EQUEwRSxDQUFDO0FBRXhILCtHQUErRztBQUMvRyxxQkFBYSx3QkFBeUIsU0FBUSx1QkFBdUI7SUFDMUQsbUJBQW1CLCtEQUUzQjtDQUNGO0FBRUQseUZBQXlGO0FBQ3pGLHdCQUFnQixzQkFBc0IsQ0FBQyxlQUFlLEVBQUUsZUFBZSxlQVF0RSJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ecdsa/stub/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAMtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAElF,eAAO,MAAM,gCAAgC,mDAA0E,CAAC;AAExH,+GAA+G;AAC/G,qBAAa,wBAAyB,SAAQ,uBAAuB;IAC1D,mBAAmB,+DAE3B;CACF;AAED,yFAAyF;AACzF,wBAAgB,sBAAsB,CAAC,eAAe,EAAE,eAAe,eAQtE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseAccount } from '@aztec-labs/aztec.js/account';
|
|
2
|
+
import { DefaultAccountEntrypoint } from '@aztec-labs/entrypoints/account';
|
|
3
|
+
import { loadContractArtifact } from '@aztec-labs/stdlib/abi';
|
|
4
|
+
import SimulatedEcdsaAccountJson from '../../../artifacts/SimulatedEcdsaAccount.json' with {
|
|
5
|
+
type: 'json'
|
|
6
|
+
};
|
|
7
|
+
import { StubBaseAccountContract } from '../../defaults/stub_account_contract.js';
|
|
8
|
+
export const StubEcdsaAccountContractArtifact = loadContractArtifact(SimulatedEcdsaAccountJson);
|
|
9
|
+
/** Stub account contract for ECDSA accounts (secp256k1 and secp256r1). Eagerly loads the contract artifact. */ export class StubEcdsaAccountContract extends StubBaseAccountContract {
|
|
10
|
+
getContractArtifact() {
|
|
11
|
+
return Promise.resolve(StubEcdsaAccountContractArtifact);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/** Creates an ECDSA stub account that impersonates the one with the provided address. */ export function createStubEcdsaAccount(originalAddress) {
|
|
15
|
+
const accountContract = new StubEcdsaAccountContract();
|
|
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-labs/aztec.js/account';
|
|
2
|
+
import type { CompleteAddress } from '@aztec-labs/aztec.js/addresses';
|
|
3
|
+
import { StubBaseAccountContract } from '../../defaults/stub_account_contract.js';
|
|
4
|
+
/**
|
|
5
|
+
* Lazily loads the ECDSA stub contract artifact (browser-compatible).
|
|
6
|
+
*/
|
|
7
|
+
export declare function getStubEcdsaAccountContractArtifact(): Promise<import("@aztec-labs/stdlib/abi").ContractArtifact>;
|
|
8
|
+
/** Stub account contract for ECDSA accounts (secp256k1 and secp256r1). Lazily loads the contract artifact. */
|
|
9
|
+
export declare class StubEcdsaAccountContract extends StubBaseAccountContract {
|
|
10
|
+
getContractArtifact(): Promise<import("@aztec-labs/stdlib/abi").ContractArtifact>;
|
|
11
|
+
}
|
|
12
|
+
/** Creates an ECDSA stub account that impersonates the one with the provided address. */
|
|
13
|
+
export declare function createStubEcdsaAccount(originalAddress: CompleteAddress): BaseAccount;
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2VjZHNhL3N0dWIvbGF6eS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0sOEJBQThCLENBQUM7QUFDM0QsT0FBTyxLQUFLLEVBQUUsZUFBZSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFJdEUsT0FBTyxFQUFFLHVCQUF1QixFQUFFLE1BQU0seUNBQXlDLENBQUM7QUFFbEY7O0dBRUc7QUFDSCx3QkFBc0IsbUNBQW1DLCtEQUt4RDtBQUVELDhHQUE4RztBQUM5RyxxQkFBYSx3QkFBeUIsU0FBUSx1QkFBdUI7SUFDMUQsbUJBQW1CLCtEQUUzQjtDQUNGO0FBRUQseUZBQXlGO0FBQ3pGLHdCQUFnQixzQkFBc0IsQ0FBQyxlQUFlLEVBQUUsZUFBZSxlQVF0RSJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../../src/ecdsa/stub/lazy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAItE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAElF;;GAEG;AACH,wBAAsB,mCAAmC,+DAKxD;AAED,8GAA8G;AAC9G,qBAAa,wBAAyB,SAAQ,uBAAuB;IAC1D,mBAAmB,+DAE3B;CACF;AAED,yFAAyF;AACzF,wBAAgB,sBAAsB,CAAC,eAAe,EAAE,eAAe,eAQtE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BaseAccount } from '@aztec-labs/aztec.js/account';
|
|
2
|
+
import { DefaultAccountEntrypoint } from '@aztec-labs/entrypoints/account';
|
|
3
|
+
import { loadContractArtifact } from '@aztec-labs/stdlib/abi';
|
|
4
|
+
import { StubBaseAccountContract } from '../../defaults/stub_account_contract.js';
|
|
5
|
+
/**
|
|
6
|
+
* Lazily loads the ECDSA stub contract artifact (browser-compatible).
|
|
7
|
+
*/ export async function getStubEcdsaAccountContractArtifact() {
|
|
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/SimulatedEcdsaAccount.json');
|
|
11
|
+
return loadContractArtifact(json);
|
|
12
|
+
}
|
|
13
|
+
/** Stub account contract for ECDSA accounts (secp256k1 and secp256r1). Lazily loads the contract artifact. */ export class StubEcdsaAccountContract extends StubBaseAccountContract {
|
|
14
|
+
getContractArtifact() {
|
|
15
|
+
return getStubEcdsaAccountContractArtifact();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/** Creates an ECDSA stub account that impersonates the one with the provided address. */ export function createStubEcdsaAccount(originalAddress) {
|
|
19
|
+
const accountContract = new StubEcdsaAccountContract();
|
|
20
|
+
const authWitnessProvider = accountContract.getAuthWitnessProvider(originalAddress);
|
|
21
|
+
return new BaseAccount(new DefaultAccountEntrypoint(originalAddress.address, authWitnessProvider), authWitnessProvider, originalAddress);
|
|
22
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { AuthWitnessProvider } from '@aztec-labs/aztec.js/account';
|
|
2
|
+
import { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
3
|
+
import { GrumpkinScalar } from '@aztec-labs/foundation/curves/grumpkin';
|
|
4
|
+
import { AuthWitness } from '@aztec-labs/stdlib/auth-witness';
|
|
5
|
+
import { CompleteAddress } from '@aztec-labs/stdlib/contract';
|
|
6
|
+
import { DefaultAccountContract } from '../defaults/account_contract.js';
|
|
7
|
+
/**
|
|
8
|
+
* Account contract that authenticates transactions using Schnorr signatures
|
|
9
|
+
* verified against a Grumpkin public key stored in an immutable encrypted note.
|
|
10
|
+
* This abstract version does not provide a way to retrieve the artifact, as it
|
|
11
|
+
* can be implemented with or without lazy loading.
|
|
12
|
+
*/
|
|
13
|
+
export declare abstract class SchnorrBaseAccountContract extends DefaultAccountContract {
|
|
14
|
+
protected signingPrivateKey: GrumpkinScalar;
|
|
15
|
+
constructor(signingPrivateKey: GrumpkinScalar);
|
|
16
|
+
/** The Grumpkin public key this account verifies signatures against. */
|
|
17
|
+
getSigningPublicKey(): Promise<import("@aztec-labs/foundation/curves/grumpkin").Point>;
|
|
18
|
+
getInitializationFunctionAndArgs(): Promise<{
|
|
19
|
+
/** The name of the function used to initialize the contract */
|
|
20
|
+
constructorName: string;
|
|
21
|
+
/** The args to the function used to initialize the contract */
|
|
22
|
+
constructorArgs: any[];
|
|
23
|
+
} | undefined>;
|
|
24
|
+
getAuthWitnessProvider(_address: CompleteAddress): AuthWitnessProvider;
|
|
25
|
+
}
|
|
26
|
+
/** Creates auth witnesses using Schnorr signatures. */
|
|
27
|
+
export declare class SchnorrAuthWitnessProvider implements AuthWitnessProvider {
|
|
28
|
+
private signingPrivateKey;
|
|
29
|
+
constructor(signingPrivateKey: GrumpkinScalar);
|
|
30
|
+
createAuthWit(messageHash: Fr): Promise<AuthWitness>;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWNjb3VudF9jb250cmFjdC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NjaG5vcnIvYWNjb3VudF9jb250cmFjdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxtQkFBbUIsRUFBRSxNQUFNLDhCQUE4QixDQUFDO0FBRXhFLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxxQ0FBcUMsQ0FBQztBQUN6RCxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0sd0NBQXdDLENBQUM7QUFDeEUsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQzlELE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUU5RCxPQUFPLEVBQUUsc0JBQXNCLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUV6RTs7Ozs7R0FLRztBQUNILDhCQUF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SAAQ,sBAAsB;IACjE,SAAS,CAAC,iBAAiB,EAAE,cAAc;IAAvD,YAAsB,iBAAiB,EAAE,cAAc,EAEtD;IAED,wEAAwE;IACxE,mBAAmB,oEAElB;IAEK,gCAAgC,IAAI,OAAO,CAC7C;QACE,+DAA+D;QAC/D,eAAe,EAAE,MAAM,CAAC;QACxB,+DAA+D;QAC/D,eAAe,EAAE,GAAG,EAAE,CAAC;KACxB,GACD,SAAS,CACZ,CAGA;IAED,sBAAsB,CAAC,QAAQ,EAAE,eAAe,GAAG,mBAAmB,CAErE;CACF;AAED,uDAAuD;AACvD,qBAAa,0BAA2B,YAAW,mBAAmB;IACxD,OAAO,CAAC,iBAAiB;IAArC,YAAoB,iBAAiB,EAAE,cAAc,EAAI;IAEnD,aAAa,CAAC,WAAW,EAAE,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAIzD;CACF"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Schnorr } from '@aztec-labs/foundation/crypto/schnorr';
|
|
2
|
+
import { AuthWitness } from '@aztec-labs/stdlib/auth-witness';
|
|
3
|
+
import { DefaultAccountContract } from '../defaults/account_contract.js';
|
|
4
|
+
/**
|
|
5
|
+
* Account contract that authenticates transactions using Schnorr signatures
|
|
6
|
+
* verified against a Grumpkin public key stored in an immutable encrypted note.
|
|
7
|
+
* This abstract version does not provide a way to retrieve the artifact, as it
|
|
8
|
+
* can be implemented with or without lazy loading.
|
|
9
|
+
*/ export class SchnorrBaseAccountContract extends DefaultAccountContract {
|
|
10
|
+
signingPrivateKey;
|
|
11
|
+
constructor(signingPrivateKey){
|
|
12
|
+
super(), this.signingPrivateKey = signingPrivateKey;
|
|
13
|
+
}
|
|
14
|
+
/** The Grumpkin public key this account verifies signatures against. */ getSigningPublicKey() {
|
|
15
|
+
return new Schnorr().computePublicKey(this.signingPrivateKey);
|
|
16
|
+
}
|
|
17
|
+
async getInitializationFunctionAndArgs() {
|
|
18
|
+
const signingPublicKey = await this.getSigningPublicKey();
|
|
19
|
+
return {
|
|
20
|
+
constructorName: 'constructor',
|
|
21
|
+
constructorArgs: [
|
|
22
|
+
signingPublicKey.x,
|
|
23
|
+
signingPublicKey.y
|
|
24
|
+
]
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
getAuthWitnessProvider(_address) {
|
|
28
|
+
return new SchnorrAuthWitnessProvider(this.signingPrivateKey);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** Creates auth witnesses using Schnorr signatures. */ export class SchnorrAuthWitnessProvider {
|
|
32
|
+
signingPrivateKey;
|
|
33
|
+
constructor(signingPrivateKey){
|
|
34
|
+
this.signingPrivateKey = signingPrivateKey;
|
|
35
|
+
}
|
|
36
|
+
async createAuthWit(messageHash) {
|
|
37
|
+
const schnorr = new Schnorr();
|
|
38
|
+
const signature = await schnorr.constructSignature(messageHash, this.signingPrivateKey);
|
|
39
|
+
return new AuthWitness(messageHash, signature.toLimbFields());
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export * from './private_immutable/index.js';
|
|
2
|
+
export * from './initializerless/index.js';
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY2hub3JyL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsOEJBQThCLENBQUM7QUFDN0MsY0FBYyw0QkFBNEIsQ0FBQyJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schnorr/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { AztecAddress } from '@aztec-labs/aztec.js/addresses';
|
|
2
|
+
import { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
3
|
+
import { GrumpkinScalar } from '@aztec-labs/foundation/curves/grumpkin';
|
|
4
|
+
import type { ContractArtifact } from '@aztec-labs/stdlib/abi';
|
|
5
|
+
import { SchnorrBaseAccountContract } from '../account_contract.js';
|
|
6
|
+
export declare const SchnorrInitializerlessAccountContractArtifact: 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 SchnorrInitializerlessAccountContract extends SchnorrBaseAccountContract {
|
|
13
|
+
constructor(signingPrivateKey: GrumpkinScalar);
|
|
14
|
+
getInitializationFunctionAndArgs(): Promise<undefined>;
|
|
15
|
+
getImmutablesHash(): Promise<Fr>;
|
|
16
|
+
getContractArtifact(): Promise<ContractArtifact>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Compute the address of a schnorr account contract.
|
|
20
|
+
* @param signingPrivateKey - The account's signing private key.
|
|
21
|
+
* @param salt - The contract address salt.
|
|
22
|
+
* @param secretKey - Seed for the account's privacy keys. Derived from the signing key when omitted.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getSchnorrInitializerlessAccountContractAddress(signingPrivateKey: GrumpkinScalar, salt: Fr, secretKey?: Fr): Promise<AztecAddress>;
|
|
25
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zY2hub3JyL2luaXRpYWxpemVybGVzcy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFPQSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUVuRSxP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C;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"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `@aztec-labs/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-labs/aztec.js/account';
|
|
7
|
+
import { poseidon2Hash } from '@aztec-labs/foundation/crypto/poseidon';
|
|
8
|
+
import { loadContractArtifact } from '@aztec-labs/stdlib/abi';
|
|
9
|
+
import SchnorrInitializerlessAccountContractJson from '../../../artifacts/SchnorrInitializerlessAccount.json' with {
|
|
10
|
+
type: 'json'
|
|
11
|
+
};
|
|
12
|
+
import { deriveSecretKeyFromSigningKey } from '../../utils/key_derivation.js';
|
|
13
|
+
import { SchnorrBaseAccountContract } from '../account_contract.js';
|
|
14
|
+
export const SchnorrInitializerlessAccountContractArtifact = loadContractArtifact(SchnorrInitializerlessAccountContractJson);
|
|
15
|
+
/**
|
|
16
|
+
* Account contract that authenticates transactions using Schnorr signatures
|
|
17
|
+
* verified against a Grumpkin public key stored in an immutable encrypted note.
|
|
18
|
+
* Eagerly loads the contract artifact
|
|
19
|
+
*/ export class SchnorrInitializerlessAccountContract extends SchnorrBaseAccountContract {
|
|
20
|
+
constructor(signingPrivateKey){
|
|
21
|
+
super(signingPrivateKey);
|
|
22
|
+
}
|
|
23
|
+
getInitializationFunctionAndArgs() {
|
|
24
|
+
return Promise.resolve(undefined);
|
|
25
|
+
}
|
|
26
|
+
async getImmutablesHash() {
|
|
27
|
+
const signingPublicKey = await this.getSigningPublicKey();
|
|
28
|
+
return poseidon2Hash([
|
|
29
|
+
signingPublicKey.x,
|
|
30
|
+
signingPublicKey.y
|
|
31
|
+
]);
|
|
32
|
+
}
|
|
33
|
+
getContractArtifact() {
|
|
34
|
+
return Promise.resolve(SchnorrInitializerlessAccountContractArtifact);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Compute the address of a schnorr account contract.
|
|
39
|
+
* @param signingPrivateKey - The account's signing private key.
|
|
40
|
+
* @param salt - The contract address salt.
|
|
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
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
2
|
+
import { GrumpkinScalar } from '@aztec-labs/foundation/curves/grumpkin';
|
|
3
|
+
import type { ContractArtifact } from '@aztec-labs/stdlib/abi';
|
|
4
|
+
import type { AztecAddress } from '@aztec-labs/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 getSchnorrInitializerlessAccountContractArtifact(): 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 SchnorrInitializerlessAccountContract extends SchnorrBaseAccountContract {
|
|
17
|
+
constructor(signingPrivateKey: GrumpkinScalar);
|
|
18
|
+
getInitializationFunctionAndArgs(): Promise<undefined>;
|
|
19
|
+
getImmutablesHash(): Promise<Fr>;
|
|
20
|
+
getContractArtifact(): Promise<ContractArtifact>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Compute the address of a schnorr account contract.
|
|
24
|
+
* @param signingPrivateKey - The account's signing private key.
|
|
25
|
+
* @param salt - The contract address salt.
|
|
26
|
+
* @param secretKey - Seed for the account's privacy keys. Derived from the signing key when omitted.
|
|
27
|
+
*/
|
|
28
|
+
export declare function getSchnorrInitializerlessAccountContractAddress(signingPrivateKey: GrumpkinScalar, salt: Fr, secretKey?: Fr): Promise<AztecAddress>;
|
|
29
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3NjaG5vcnIvaW5pdGlhbGl6ZXJsZXNzL2xhenkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBUUEsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLHFDQUFxQyxDQUFDO0FBQ3pELE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSx3Q0FBd0MsQ0FBQztBQUN4RSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBRS9ELE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxN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,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"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `@aztec-labs/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-labs/aztec.js/account';
|
|
7
|
+
import { poseidon2Hash } from '@aztec-labs/foundation/crypto/poseidon';
|
|
8
|
+
import { loadContractArtifact } from '@aztec-labs/stdlib/abi';
|
|
9
|
+
import { deriveSecretKeyFromSigningKey } from '../../utils/key_derivation.js';
|
|
10
|
+
import { SchnorrBaseAccountContract } from '../account_contract.js';
|
|
11
|
+
/**
|
|
12
|
+
* Lazily loads the contract artifact
|
|
13
|
+
* @returns The contract artifact for the schnorr account contract
|
|
14
|
+
*/ export async function getSchnorrInitializerlessAccountContractArtifact() {
|
|
15
|
+
// Cannot assert this import as it's incompatible with bundlers like vite
|
|
16
|
+
// https://github.com/vitejs/vite/issues/19095#issuecomment-2566074352
|
|
17
|
+
// Even if now supported by all major browsers, the MIME type is replaced with
|
|
18
|
+
// "text/javascript"
|
|
19
|
+
// In the meantime, this lazy import is INCOMPATIBLE WITH NODEJS
|
|
20
|
+
const { default: schnorrAccountContractJson } = await import('../../../artifacts/SchnorrInitializerlessAccount.json');
|
|
21
|
+
return loadContractArtifact(schnorrAccountContractJson);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Account contract that authenticates transactions using Schnorr signatures
|
|
25
|
+
* verified against a Grumpkin public key stored in an immutable encrypted note.
|
|
26
|
+
* Lazily loads the contract artifact
|
|
27
|
+
*/ export class SchnorrInitializerlessAccountContract extends SchnorrBaseAccountContract {
|
|
28
|
+
constructor(signingPrivateKey){
|
|
29
|
+
super(signingPrivateKey);
|
|
30
|
+
}
|
|
31
|
+
getInitializationFunctionAndArgs() {
|
|
32
|
+
return Promise.resolve(undefined);
|
|
33
|
+
}
|
|
34
|
+
async getImmutablesHash() {
|
|
35
|
+
const signingPublicKey = await this.getSigningPublicKey();
|
|
36
|
+
return poseidon2Hash([
|
|
37
|
+
signingPublicKey.x,
|
|
38
|
+
signingPublicKey.y
|
|
39
|
+
]);
|
|
40
|
+
}
|
|
41
|
+
getContractArtifact() {
|
|
42
|
+
return getSchnorrInitializerlessAccountContractArtifact();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Compute the address of a schnorr account contract.
|
|
47
|
+
* @param signingPrivateKey - The account's signing private key.
|
|
48
|
+
* @param salt - The contract address salt.
|
|
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
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export * from './private_immutable/lazy.js';
|
|
2
|
+
export * from './initializerless/lazy.js';
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NjaG5vcnIvbGF6eS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLDZCQUE2QixDQUFDO0FBQzVDLGNBQWMsMkJBQTJCLENBQUMifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/schnorr/lazy.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { AztecAddress } from '@aztec-labs/aztec.js/addresses';
|
|
2
|
+
import { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
3
|
+
import { GrumpkinScalar } from '@aztec-labs/foundation/curves/grumpkin';
|
|
4
|
+
import type { ContractArtifact } from '@aztec-labs/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 signingPrivateKey - The account's signing private key.
|
|
19
|
+
* @param salt - The contract address salt.
|
|
20
|
+
* @param secretKey - Seed for the account's privacy keys. Derived from the signing key when omitted.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getSchnorrAccountContractAddress(signingPrivateKey: GrumpkinScalar, salt: Fr, secretKey?: Fr): Promise<AztecAddress>;
|
|
23
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5k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D,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAM/D,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"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `@aztec-labs/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-labs/aztec.js/account';
|
|
7
|
+
import { loadContractArtifact } from '@aztec-labs/stdlib/abi';
|
|
8
|
+
import SchnorrAccountContractJson from '../../../artifacts/SchnorrAccount.json' with {
|
|
9
|
+
type: 'json'
|
|
10
|
+
};
|
|
11
|
+
import { deriveSecretKeyFromSigningKey } from '../../utils/key_derivation.js';
|
|
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 signingPrivateKey - The account's signing private key.
|
|
29
|
+
* @param salt - The contract address salt.
|
|
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
|
+
}
|