1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-07-02 04:42:33 +00:00
trezor-firmware/core/mocks/generated/trezorcrypto/bip340.pyi
Pavol Rusnak c6667fa0c2 feat(core): verify bip340 pubkeys used in p2tr addresses
Co-Authored-By: Ondřej Vejpustek <ondrej.vejpustek@satoshilabs.com>
2022-02-16 10:25:15 +01:00

62 lines
1.3 KiB
Python

from typing import *
# extmod/modtrezorcrypto/modtrezorcrypto-bip340.h
def generate_secret() -> bytes:
"""
Generate secret key.
"""
# extmod/modtrezorcrypto/modtrezorcrypto-bip340.h
def publickey(secret_key: bytes) -> bytes:
"""
Computes public key from secret key.
"""
# extmod/modtrezorcrypto/modtrezorcrypto-bip340.h
def sign(
secret_key: bytes,
digest: bytes,
) -> bytes:
"""
Uses secret key to produce the signature of the digest.
"""
# extmod/modtrezorcrypto/modtrezorcrypto-bip340.h
def verify_publickey(public_key: bytes) -> bool:
"""
Verifies whether the public key is valid.
Returns True on success.
"""
# extmod/modtrezorcrypto/modtrezorcrypto-bip340.h
def verify(public_key: bytes, signature: bytes, digest: bytes) -> bool:
"""
Uses public key to verify the signature of the digest.
Returns True on success.
"""
# extmod/modtrezorcrypto/modtrezorcrypto-bip340.h
def tweak_public_key(
public_key: bytes,
root_hash: bytes | None = None,
) -> bytes:
"""
Tweaks the public key with the specified root_hash.
"""
# extmod/modtrezorcrypto/modtrezorcrypto-bip340.h
def tweak_secret_key(
secret_key: bytes,
root_hash: bytes | None = None,
) -> bytes:
"""
Tweaks the secret key with the specified root_hash.
"""