nucypher.blockchain.eth.signers¶
Submodules¶
-
class
Signer
¶ Bases:
abc.ABC
-
log
¶ Drop-in replacement of Twisted’s Logger, patching the emit() method to tolerate inputs with curly braces, i.e., not compliant with PEP 3101.
See Issue #724 and, particularly, https://github.com/nucypher/nucypher/issues/724#issuecomment-600190455
-
exception
InvalidSignerURI
¶ Bases:
nucypher.blockchain.eth.signers.base.Signer.SignerError
Raised when an invalid signer URI is detected
-
exception
AccountLocked
(account: str)¶ Bases:
nucypher.blockchain.eth.signers.base.Signer.SignerError
-
exception
UnknownAccount
(account: str)¶ Bases:
nucypher.blockchain.eth.signers.base.Signer.SignerError
-
exception
AuthenticationFailed
¶ Bases:
nucypher.blockchain.eth.signers.base.Signer.SignerError
Raised when ACCESS DENIED
-
classmethod
from_signer_uri
(uri: str, testnet: bool = False) → nucypher.blockchain.eth.signers.base.Signer¶
-
abstract
is_device
(account: str) → bool¶ Some signing client support both software and hardware wallets, this method is implemented as a boolean to tell the difference.
-
abstract property
accounts
¶
-
-
handle_trezor_call
(device_func)¶ Decorator for calls to trezorlib that require physical device interactions.
-
class
TrezorSigner
(testnet: bool = False)¶ Bases:
nucypher.blockchain.eth.signers.base.Signer
A trezor message and transaction signing client.
-
DEFAULT_ACCOUNT_INDEX
= 0¶
-
ADDRESS_CACHE_SIZE
= 10¶
-
exception
NoDeviceDetected
¶ Bases:
nucypher.blockchain.eth.signers.hardware.TrezorSigner.DeviceError
Raised when an operation requires a device but none are available
-
property
derivation_root
¶
-
classmethod
from_signer_uri
(uri: str, testnet: bool = False) → nucypher.blockchain.eth.signers.hardware.TrezorSigner¶ Return a trezor signer from URI string i.e. trezor:///my/trezor/path
-
unlock_account
(account: str, password: str, duration: int = None) → bool¶ Defer account unlocking to the trezor, do not indicate application level unlocking logic.
-
lock_account
(account: str) → bool¶ Defer account locking to the trezor, do not indicate application level unlocking logic.
-
property
accounts
¶ Returns a list of cached trezor checksum addresses from initial derivation.
-
sign_message
(message: bytes, checksum_address: str) → hexbytes.main.HexBytes¶ Signs a message via the TREZOR ethereum sign_message API and returns a named tuple containing the signature and the address used to sign it. This method requires interaction between the TREZOR and the user.
-
sign_transaction
(transaction_dict: dict, rlp_encoded: bool = True) → Union[hexbytes.main.HexBytes, eth_account._utils.legacy_transactions.Transaction]¶ Sign a transaction with a trezor hardware wallet.
This non-mutative method handles transaction validation, field formatting, signing, and outgoing serialization. Accepts a standard transaction dictionary as input, and produces an RLP encoded raw signed transaction by default.
Internally the standard transaction dictionary is reformatted for trezor API consumption via calls trezorlib.client.ethereum.sign_tx.
WARNING: This function returns a raw signed transaction which can be broadcast by anyone with a connection to the ethereum network.
*Treat pre-signed raw transactions produced by this function like money.*
-
-
class
Web3Signer
(client)¶ Bases:
nucypher.blockchain.eth.signers.base.Signer
-
classmethod
from_signer_uri
(uri: str, testnet: bool = False) → nucypher.blockchain.eth.signers.software.Web3Signer¶
-
property
accounts
¶
-
classmethod
-
class
ClefSigner
(ipc_path: pathlib.Path = PosixPath('~/.clef/clef.ipc'), timeout: int = 180, testnet: bool = False)¶ Bases:
nucypher.blockchain.eth.signers.base.Signer
-
DEFAULT_IPC_PATH
= PosixPath('~/.clef/clef.ipc')¶
-
SIGN_DATA_FOR_VALIDATOR
= 'data/validator'¶
-
SIGN_DATA_FOR_CLIQUE
= 'application/clique'¶
-
SIGN_DATA_FOR_ECRECOVER
= 'text/plain'¶
-
DEFAULT_CONTENT_TYPE
= 'text/plain'¶
-
SIGN_DATA_CONTENT_TYPES
= ('data/validator', 'application/clique', 'text/plain')¶
-
TIMEOUT
= 180¶
-
classmethod
from_signer_uri
(uri: str, testnet: bool = False) → nucypher.blockchain.eth.signers.software.ClefSigner¶
-
is_device
(account: str)¶ Some signing client support both software and hardware wallets, this method is implemented as a boolean to tell the difference.
-
property
accounts
¶
-
-
class
KeystoreSigner
(path: pathlib.Path, testnet: bool = False)¶ Bases:
nucypher.blockchain.eth.signers.base.Signer
Local Web3 signer implementation supporting keystore files
-
exception
InvalidKeyfile
¶ Bases:
nucypher.blockchain.eth.signers.base.Signer.SignerError
,RuntimeError
Raised when a keyfile is corrupt or otherwise invalid. Keystore must be in the geth wallet format.
-
property
path
¶ Read only access to the keystore path
-
classmethod
from_signer_uri
(uri: str, testnet: bool = False) → nucypher.blockchain.eth.signers.base.Signer¶ Return a keystore signer from URI string i.e. keystore:///my/path/keystore
-
is_device
(account: str) → bool¶ Some signing client support both software and hardware wallets, this method is implemented as a boolean to tell the difference.
-
property
accounts
¶ Return a list of known keystore accounts read from
-
unlock_account
(account: str, password: str, duration: int = None) → bool¶ Decrypt the signing material from the key metadata file and cache it on the keystore instance is decryption is successful.
-
lock_account
(account: str) → bool¶ Deletes a local signer by its checksum address or raises UnknownAccount if the address is not a member of this keystore. Returns True if the account is no longer tracked and was successfully locked.
-
exception