1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 14:28:07 +00:00

docs(core): Add references to SLIPs in the code.

This commit is contained in:
Andrew Kozlik 2021-03-09 20:01:27 +01:00
parent 5cff6ac964
commit 850aa56691
7 changed files with 23 additions and 3 deletions

View File

@ -20,7 +20,9 @@ if False:
from trezor.messages.TxInputType import EnumTypeInputScriptType
from apps.common.coininfo import CoinInfo
# This module implements the SLIP-0019 proof of ownership format.
# This module implements the SLIP-0019 proof of ownership format, see
# https://github.com/satoshilabs/slips/blob/master/slip-0019.md.
_VERSION_MAGIC = b"SL\x00\x19"
_FLAG_USER_CONFIRMED = 0x01

View File

@ -83,7 +83,7 @@ async def get_keychain(ctx: wire.Context) -> Keychain:
assert secret_bytes is not None
root = bip32.from_mnemonic_cardano(secret_bytes.decode(), passphrase)
else:
# derive the root node via SLIP-0023
# derive the root node via SLIP-0023 https://github.com/satoshilabs/slips/blob/master/slip-0022.md
seed = await get_seed(ctx)
root = bip32.from_seed(seed, "ed25519 cardano seed")

View File

@ -10,6 +10,11 @@ if False:
class Slip21Node:
"""
This class implements the SLIP-0021 hierarchical derivation of symmetric keys, see
https://github.com/satoshilabs/slips/blob/master/slip-0021.md.
"""
def __init__(self, seed: bytes = None, data: bytes = None) -> None:
assert seed is None or data is None, "Specify exactly one of: seed, data"
if data is not None:

View File

@ -11,6 +11,9 @@ if False:
from trezor.messages.CipherKeyValue import CipherKeyValue
from trezor.wire import Context
# This module implements the SLIP-0011 symmetric encryption of key-value pairs using a
# deterministic hierarchy, see https://github.com/satoshilabs/slips/blob/master/slip-0011.md.
async def cipher_key_value(ctx: Context, msg: CipherKeyValue) -> CipheredKeyValue:
keychain = await get_keychain(ctx, "secp256k1", [AlwaysMatchingSchema])

View File

@ -19,6 +19,9 @@ if False:
from apps.common.paths import Bip32Path
# This module implements the SLIP-0017 Elliptic Curve Diffie-Hellman algorithm, using a
# determinstic hierarchy, see https://github.com/satoshilabs/slips/blob/master/slip-0017.md.
async def get_ecdh_session_key(
ctx: wire.Context, msg: GetECDHSessionKey

View File

@ -20,6 +20,9 @@ if False:
from apps.common.paths import Bip32Path
# This module implements the SLIP-0013 authentication using a deterministic hierarchy, see
# https://github.com/satoshilabs/slips/blob/master/slip-0013.md.
async def sign_identity(ctx: wire.Context, msg: SignIdentity) -> SignedIdentity:
if msg.ecdsa_curve_name is None:

View File

@ -103,8 +103,12 @@ class Credential:
return U2fCredential.from_key_handle(data, rp_id_hash)
# SLIP-0022: FIDO2 credential ID format for HD wallets
class Fido2Credential(Credential):
"""
This class implements the SLIP-0022 FIDO2 Credential ID format for HD wallets, see
https://github.com/satoshilabs/slips/blob/master/slip-0022.md.
"""
def __init__(self) -> None:
super().__init__()
self.rp_name: Optional[str] = None