async def get_ecdh_session_key(ctx, msg): if msg.ecdsa_curve_name is None: msg.ecdsa_curve_name = 'secp256k1' identity = serialize_identity(msg.identity) await require_confirm_ecdh_session_key(ctx, msg.identity) address_n = get_ecdh_path(identity, msg.identity.index or 0) node = await seed.derive_node(ctx, address_n, msg.ecdsa_curve_name) session_key = ecdh(seckey=node.private_key(), peer_public_key=msg.peer_public_key, curve=msg.ecdsa_curve_name) return ECDHSessionKey(session_key=session_key)
async def get_ecdh_session_key(ctx, msg): if msg.ecdsa_curve_name is None: msg.ecdsa_curve_name = "secp256k1" keychain = await get_keychain(ctx, [(msg.ecdsa_curve_name, [])]) identity = serialize_identity(msg.identity) await require_confirm_ecdh_session_key(ctx, msg.identity) address_n = get_ecdh_path(identity, msg.identity.index or 0) node = keychain.derive(address_n) session_key = ecdh( seckey=node.private_key(), peer_public_key=msg.peer_public_key, curve=msg.ecdsa_curve_name, ) return ECDHSessionKey(session_key=session_key)