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

Cometa.Pool.Metadata

Description

Off-chain stake-pool metadata references. Locations are not fetched. Validate external input once, then assemble with the total constructor.

Metadata location digest associates a location with its expected hash.

Synopsis

Documentation

data Url Source #

Pool metadata location of 0 through 128 UTF-8 bytes with no NUL. No URI syntax or reachability check is implied. Comparison uses text.

Instances

Instances details
Show Url Source # 
Instance details

Defined in Cometa.Internal.Pool

Methods

showsPrec :: Int -> Url -> ShowS #

show :: Url -> String #

showList :: [Url] -> ShowS #

Eq Url Source # 
Instance details

Defined in Cometa.Internal.Pool

Methods

(==) :: Url -> Url -> Bool #

(/=) :: Url -> Url -> Bool #

Ord Url Source # 
Instance details

Defined in Cometa.Internal.Pool

Methods

compare :: Url -> Url -> Ordering #

(<) :: Url -> Url -> Bool #

(<=) :: Url -> Url -> Bool #

(>) :: Url -> Url -> Bool #

(>=) :: Url -> Url -> Bool #

max :: Url -> Url -> Url #

min :: Url -> Url -> Url #

mkUrl :: Text -> Either Error Url Source #

Validate at most 128 UTF-8 bytes without NUL. Empty is valid in this pool schema. Violations return InvalidPoolMetadataUrl.

urlText :: Url -> Text Source #

Exact original location text.

data MetadataHash Source #

Exact 32-byte BLAKE2b-256 metadata digest. Comparison uses bytes.

Instances

Instances details
Show MetadataHash Source # 
Instance details

Defined in Cometa.Internal.Pool

Eq MetadataHash Source # 
Instance details

Defined in Cometa.Internal.Pool

Ord MetadataHash Source # 
Instance details

Defined in Cometa.Internal.Pool

metadataHashFromBytes :: ByteString -> Either Error MetadataHash Source #

Import exactly 32 metadata digest bytes without hashing; other lengths return InvalidPoolMetadataHashLength with the actual byte count.

metadataHashBytes :: MetadataHash -> ByteString Source #

Exact metadata digest bytes.

data Metadata Source #

Metadata reference. Fetching and checking the payload is a caller operation.

Constructors

Metadata 

Fields

Instances

Instances details
Show Metadata Source # 
Instance details

Defined in Cometa.Internal.Pool

Eq Metadata Source # 
Instance details

Defined in Cometa.Internal.Pool

Ord Metadata Source # 
Instance details

Defined in Cometa.Internal.Pool

hashData :: ByteString -> IO (Either Error MetadataHash) Source #

Compute the BLAKE2b-256 digest of the exact metadata payload bytes. No JSON parsing or normalization occurs. Empty input or native hashing failures return NativeError, following the BLAKE2b boundary.

encodeCbor :: Metadata -> ByteString Source #

Fresh definite CBOR with shortest integer encodings. Re-encoding semantic data may change transaction identity.

decodeCbor :: ByteString -> Either Error Metadata Source #

Decode the complete value. Definite or indefinite arrays and nonminimal unsigned integers are accepted. All field bounds, arities, UTF-8 and trailing bytes are checked; violations return InvalidPoolCbor. The original encoding is not retained.