mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-17 01:52:02 +00:00
core/cardano: reuse derived Shamir seed (fixes #1007)
This commit is contained in:
parent
09667a676e
commit
19461398d7
@ -4,6 +4,7 @@ from trezor.crypto import bip32
|
|||||||
|
|
||||||
from apps.common import mnemonic
|
from apps.common import mnemonic
|
||||||
from apps.common.passphrase import get as get_passphrase
|
from apps.common.passphrase import get as get_passphrase
|
||||||
|
from apps.common.seed import get_seed
|
||||||
|
|
||||||
from .helpers import seed_namespaces
|
from .helpers import seed_namespaces
|
||||||
|
|
||||||
@ -68,13 +69,13 @@ async def get_keychain(ctx: wire.Context) -> Keychain:
|
|||||||
if not device.is_initialized():
|
if not device.is_initialized():
|
||||||
raise wire.NotInitialized("Device is not initialized")
|
raise wire.NotInitialized("Device is not initialized")
|
||||||
|
|
||||||
passphrase = await get_passphrase(ctx)
|
|
||||||
if mnemonic.is_bip39():
|
if mnemonic.is_bip39():
|
||||||
|
passphrase = await get_passphrase(ctx)
|
||||||
# derive the root node from mnemonic and passphrase via Cardano Icarus algorithm
|
# derive the root node from mnemonic and passphrase via Cardano Icarus algorithm
|
||||||
root = bip32.from_mnemonic_cardano(mnemonic.get_secret().decode(), passphrase)
|
root = bip32.from_mnemonic_cardano(mnemonic.get_secret().decode(), passphrase)
|
||||||
else:
|
else:
|
||||||
# derive the root node via SLIP-0023
|
# derive the root node via SLIP-0023
|
||||||
seed = mnemonic.get_seed(passphrase)
|
seed = await get_seed(ctx)
|
||||||
root = bip32.from_seed(seed, "ed25519 cardano seed")
|
root = bip32.from_seed(seed, "ed25519 cardano seed")
|
||||||
|
|
||||||
keychain = Keychain(root)
|
keychain = Keychain(root)
|
||||||
|
Loading…
Reference in New Issue
Block a user