Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ExodusMovement/exodus-oss
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: f35186a81b97532e8020f21ba0f821ed6dc9b0a7
Choose a base ref
..
head repository: ExodusMovement/exodus-oss
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: bec0b4439bc056ee44c19625d4ea3a337713f83a
Choose a head ref
Showing with 3 additions and 4 deletions.
  1. +3 −4 features/keychain/module/keychain.js
7 changes: 3 additions & 4 deletions features/keychain/module/keychain.js
Original file line number Diff line number Diff line change
@@ -143,20 +143,19 @@ export class Keychain {
}

#getPublicKeyFromHDKey = async ({ hdkey, keyId }) => {
const privateKey = hdkey.privateKey

let publicKey = hdkey.publicKey

if (keyId.keyType === 'legacy') {
if (keyId.assetName in this.#legacyPrivToPub) {
const legacyPrivToPub = this.#legacyPrivToPub[keyId.assetName]
publicKey = await legacyPrivToPub(privateKey)
publicKey = await legacyPrivToPub(hdkey.privateKey)
} else {
throw new Error(`asset name ${keyId.assetName} has no legacyPrivToPub mapper`)
}
} else if (keyId.derivationAlgorithm !== 'SLIP10' && keyId.keyType === 'nacl') {
// SLIP10 already produces the correct public key for curve ed25119
// so we can safely skip using the privToPub mapper.
publicKey = await sodium.privToPub(privateKey)
publicKey = await sodium.privToPub(hdkey.privateKey)
}

return publicKey