Skip to main content

Secp256r1PrivateKey

Secp256r1PrivateKey Objects

class Secp256r1PrivateKey(Secp256r1PrivateKeyProtocol)

from_bech32

@classmethod
def from_bech32(cls, value: str) -> Secp256r1PrivateKey

Decode a private key from flag || privkey in Bech32 starting with "iotaprivkey".

from_der

@classmethod
def from_der(cls, bytes: bytes) -> Secp256r1PrivateKey

Deserialize PKCS#8 private key from ASN.1 DER-encoded data (binary format).

from_mnemonic

@classmethod
def from_mnemonic(cls,
phrase: str,
account_index: int = 0,
password: str = "") -> Secp256r1PrivateKey

Construct the private key from a mnemonic phrase

from_mnemonic_with_path

@classmethod
def from_mnemonic_with_path(cls,
phrase: str,
path: str,
password: str = "") -> Secp256r1PrivateKey

Create an instance from a mnemonic phrase and a derivation path like "m/74'/4218'/0'/0/0"

from_pem

@classmethod
def from_pem(cls, s: str) -> Secp256r1PrivateKey

Deserialize PKCS#8-encoded private key from PEM.

random

@classmethod
def random(cls) -> Secp256r1PrivateKey

Generate a new random Secp256r1PrivateKey

public_key

def public_key() -> Secp256r1PublicKey

Get the public key corresponding to this private key.

sign_personal_message

def sign_personal_message(message: PersonalMessage) -> UserSignature

Sign a personal message and return a UserSignature.

sign_transaction

def sign_transaction(transaction: Transaction) -> UserSignature

Sign a transaction and return a UserSignature.

to_bech32

def to_bech32() -> str

Encode this private key as flag || privkey in Bech32 starting with "iotaprivkey" to a string.

to_bytes

def to_bytes() -> bytes

Serialize this private key to bytes.

to_der

def to_der() -> bytes

Serialize this private key as DER-encoded PKCS#8

to_pem

def to_pem() -> str

Serialize this private key as PEM-encoded PKCS#8

try_sign

def try_sign(message: bytes) -> Secp256r1Signature

Sign a message and return a Secp256r1Signature.

try_sign_simple

def try_sign_simple(message: bytes) -> SimpleSignature

Sign a message and return a SimpleSignature.

try_sign_user

def try_sign_user(message: bytes) -> UserSignature

Sign a message and return a UserSignature.