cometa-0.1.0.0: Idiomatic Haskell bindings to cardano-c
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cometa.Crypto.Ed25519.Signature

Description

Ed25519 signatures as immutable 64-byte values. Import checks encoded length, not whether a signature verifies against a particular key/message.

import qualified Cometa.Crypto.Ed25519.Signature as Signature

roundTrip :: Signature.Signature -> Bool
roundTrip value = Signature.fromBytes (Signature.toBytes value) == Right value
Synopsis

Documentation

data Signature Source #

An immutable 64-byte Ed25519 signature. Equality compares bytes; ordering is lexicographic byte ordering. Show is diagnostic; use toHex for a stable textual representation.

Import

fromBytes :: ByteString -> Either Error Signature Source #

Import exactly 64 bytes. Other lengths return InvalidEd25519SignatureLength. No cryptographic verification is performed.

fromHex :: Text -> Either Error Signature Source #

Import 128 ASCII hexadecimal digits, accepting either case. No whitespace or prefix is accepted. Empty, odd-length or nonhexadecimal text returns InvalidHex; valid hex of another byte length returns InvalidEd25519SignatureLength.

Inspection

toBytes :: Signature -> ByteString Source #

Retrieve the exact encoded bytes.

toHex :: Signature -> Text Source #

Render lowercase ASCII hexadecimal digits without a prefix or whitespace.

byteLength :: Signature -> Int Source #

Encoded byte length, always 64.

hexLength :: Signature -> Int Source #

Hexadecimal digit count, always 128. No terminator is included.