Ed25519Signature
- class cometa.cryptography.ed25519_signature.Ed25519Signature(ptr)[source]
Bases:
objectRepresents 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
- 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:
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:
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