| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
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
- data Url
- mkUrl :: Text -> Either Error Url
- urlText :: Url -> Text
- data MetadataHash
- metadataHashFromBytes :: ByteString -> Either Error MetadataHash
- metadataHashBytes :: MetadataHash -> ByteString
- data Metadata = Metadata {
- url :: !Url
- metadataHash :: !MetadataHash
- hashData :: ByteString -> IO (Either Error MetadataHash)
- encodeCbor :: Metadata -> ByteString
- decodeCbor :: ByteString -> Either Error Metadata
Documentation
Pool metadata location of 0 through 128 UTF-8 bytes with no NUL. No URI syntax or reachability check is implied. Comparison uses text.
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.
data MetadataHash Source #
Exact 32-byte BLAKE2b-256 metadata digest. Comparison uses bytes.
Instances
| Show MetadataHash Source # | |
Defined in Cometa.Internal.Pool Methods showsPrec :: Int -> MetadataHash -> ShowS # show :: MetadataHash -> String # showList :: [MetadataHash] -> ShowS # | |
| Eq MetadataHash Source # | |
Defined in Cometa.Internal.Pool | |
| Ord MetadataHash Source # | |
Defined in Cometa.Internal.Pool Methods compare :: MetadataHash -> MetadataHash -> Ordering # (<) :: MetadataHash -> MetadataHash -> Bool # (<=) :: MetadataHash -> MetadataHash -> Bool # (>) :: MetadataHash -> MetadataHash -> Bool # (>=) :: MetadataHash -> MetadataHash -> Bool # max :: MetadataHash -> MetadataHash -> MetadataHash # min :: MetadataHash -> MetadataHash -> MetadataHash # | |
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.
Metadata reference. Fetching and checking the payload is a caller operation.
Constructors
| Metadata | |
Fields
| |
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.