This repository was archived by the owner on Mar 16, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
client/services/MetaMaskService Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -24,11 +24,16 @@ const AZTECAccount = [
2424 name : 'linkedPublicKey' ,
2525 type : 'bytes' ,
2626 } ,
27+ {
28+ name : 'AZTECaddress' ,
29+ type : 'address' ,
30+ } ,
2731] ;
2832
2933export default ( {
3034 address,
3135 linkedPublicKey,
36+ aliasAddress,
3237} ) => {
3338 const accountRegistryContract = Web3Service . contract ( 'AccountRegistry' ) ;
3439
@@ -40,6 +45,7 @@ export default ({
4045
4146 const message = {
4247 account : address ,
48+ AZTECaddress : aliasAddress ,
4349 linkedPublicKey,
4450 } ;
4551
@@ -59,6 +65,7 @@ export default ({
5965export const generateTypedData = ( {
6066 address,
6167 linkedPublicKey,
68+ aliasAddress,
6269} ) => {
6370 const accountRegistryContract = Web3Service . contract ( 'AccountRegistry' ) ;
6471
@@ -70,9 +77,18 @@ export const generateTypedData = ({
7077
7178 const message = {
7279 account : address ,
80+ AZTECaddress : aliasAddress ,
7381 linkedPublicKey,
7482 } ;
75-
83+ console . log ( {
84+ types : {
85+ EIP712Domain : domainParams ,
86+ AZTECAccount,
87+ } ,
88+ domain : domainData ,
89+ primaryType : 'AZTECAccount' ,
90+ message,
91+ } ) ;
7692 return {
7793 types : {
7894 EIP712Domain : domainParams ,
Original file line number Diff line number Diff line change 1+ import secp256k1 from '@aztec/secp256k1' ;
2+ import decodePrivateKey from '~/background/utils/decodePrivateKey' ;
3+ import AuthService from '~/background/services/AuthService' ;
14import ConnectionService from '~/ui/services/ConnectionService' ;
25
36export default async function linkAccountToMetaMask ( {
47 address,
58 linkedPublicKey,
69} ) {
10+ const keyStore = await AuthService . getKeyStore ( ) ;
11+ const {
12+ pwDerivedKey,
13+ } = await AuthService . getSession ( address ) || { } ;
14+ const privateKey = '0x' . concat ( decodePrivateKey ( keyStore , pwDerivedKey ) ) ;
15+ const {
16+ address : aliasAddress ,
17+ } = secp256k1 . accountFromPrivateKey ( privateKey ) ;
718 const {
819 publicKey : spendingPublicKey ,
920 signature,
@@ -13,6 +24,7 @@ export default async function linkAccountToMetaMask({
1324 data : {
1425 address,
1526 linkedPublicKey,
27+ aliasAddress,
1628 } ,
1729 } ) || { } ;
1830
You can’t perform that action at this time.
0 commit comments