GitHub

SignatureService

API reference for SignatureService.

Functions

generate_key_pair

generate_key_pair[A: Algorithm](algorithm) -> Effect[KeyPair[A], CryptoError]

A new key pair for algorithm.

ParameterTypeDescription
algorithmA

Returns Effect[KeyPair[A], CryptoError]

def generate_key_pair[A: Algorithm](self, algorithm: A) -> Effect[KeyPair[A], CryptoError]:
    """A new key pair for ``algorithm``."""
    ...

sign

sign(private_key, data) -> Effect[bytes, CryptoError]

The signature of data (ECDSA in raw r‖s form).

ParameterTypeDescription
private_keyPrivateKey[Any]
dataBinary

Returns Effect[bytes, CryptoError]

def sign(self, private_key: PrivateKey[Any], data: Binary) -> Effect[bytes, CryptoError]:
    """The signature of ``data`` (ECDSA in raw ``r‖s`` form)."""
    ...

verify

verify(public_key, signature, data) -> Effect[bool, CryptoError]

Whether signature signs data; False for any problem with the signature bytes.

ParameterTypeDescription
public_keyPublicKey[Any]
signatureBinary
dataBinary

Returns Effect[bool, CryptoError]

def verify(
    self, public_key: PublicKey[Any], signature: Binary, data: Binary
) -> Effect[bool, CryptoError]:
    """Whether ``signature`` signs ``data``; ``False`` for any problem
    with the signature bytes."""
    ...

public_key_of

public_key_of[A: Algorithm](private_key) -> Effect[PublicKey[A], CryptoError]

The public key of private_key.

ParameterTypeDescription
private_keyPrivateKey[A]

Returns Effect[PublicKey[A], CryptoError]

def public_key_of[A: Algorithm](
    self, private_key: PrivateKey[A]
) -> Effect[PublicKey[A], CryptoError]:
    """The public key of ``private_key``."""
    ...