Skip to content

Commit

Permalink
feat: store root account public key
Browse files Browse the repository at this point in the history
  • Loading branch information
emccorson committed Oct 31, 2023
1 parent 055524d commit c267c06
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions apps/extension/src/background/keyring/crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type CryptoArgs = {
password: string;
text: string;
type: AccountType;
publicKey?: string;
};

export class Crypto {
Expand All @@ -38,6 +39,7 @@ export class Crypto {
password,
text,
type,
publicKey,
} = args;

const { params, key, iv, salt } = this.encryptionParams(password);
Expand All @@ -54,6 +56,7 @@ export class Crypto {
path,
crypto,
type,
publicKey
};
}

Expand Down
10 changes: 7 additions & 3 deletions apps/extension/src/background/keyring/keyring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,10 @@ export class KeyRing {
const account = hdWallet.derive(bip44Path);
const stringPointer = account.private().to_hex();
const sk = readStringPointer(stringPointer, this._cryptoMemory);
const address = new Address(sk).implicit();
const address = new Address(sk);
const implicitAddress = address.implicit();
const publicKey = address.public();

const { chainId } = this;

// Generate unique ID for new parent account:
Expand All @@ -253,13 +256,14 @@ export class KeyRing {
const mnemonicStore = crypto.encrypt({
id,
alias,
address,
owner: address,
address: implicitAddress,
owner: implicitAddress,
chainId,
password,
path,
text: phrase,
type: AccountType.Mnemonic,
publicKey,
});

await this._keyStore.append(mnemonicStore);
Expand Down

0 comments on commit c267c06

Please sign in to comment.