Ed25519Signature

class cometa.cryptography.ed25519_signature.Ed25519Signature(ptr)[source]

Bases: object

Represents an Ed25519 digital signature.

Ed25519 signatures are 64 bytes and are used throughout Cardano for transaction signing, stake pool registration, and other cryptographic operations requiring authentication.

Example

>>> sig = Ed25519Signature.from_hex("00" * 64)
>>> len(sig.to_bytes())
64
__init__(ptr)[source]
Return type:

None

__enter__()[source]
Return type:

Ed25519Signature

__exit__(exc_type, exc_val, exc_tb)[source]
Return type:

None

__repr__()[source]

Return repr(self).

Return type:

str

classmethod from_bytes(data)[source]

Creates an Ed25519 signature from raw bytes.

Parameters:

data (bytes | bytearray) – The signature as raw bytes (64 bytes).

Returns:

A new Ed25519Signature instance.

Raises:

CardanoError – If creation fails.

Return type:

Ed25519Signature

Example

>>> sig = Ed25519Signature.from_bytes(bytes(64))
classmethod from_hex(hex_string)[source]

Creates an Ed25519 signature from a hexadecimal string.

Parameters:

hex_string (str) – The signature as a hexadecimal string (128 characters).

Returns:

A new Ed25519Signature instance.

Raises:

CardanoError – If creation fails or hex is invalid.

Return type:

Ed25519Signature

Example

>>> sig = Ed25519Signature.from_hex("00" * 64)
to_bytes()[source]

Returns the signature as raw bytes.

Returns:

The 64-byte signature.

Return type:

bytes

to_hex()[source]

Returns the signature as a hexadecimal string.

Returns:

The signature as a 128-character hex string.

Return type:

str

__eq__(other)[source]

Checks equality with another Ed25519Signature.

Parameters:

other (object)

Return type:

bool

__hash__()[source]

Returns a Python hash for use in sets and dicts.

Return type:

int

__str__()[source]

Returns the hexadecimal representation.

Return type:

str