| Copyright | 2018 Monadic GmbH |
|---|---|
| License | BSD3 |
| Maintainer | kim@monadic.xyz, team@monadic.xyz |
| Stability | provisional |
| Portability | non-portable (GHC extensions) |
| Safe Haskell | None |
| Language | Haskell2010 |
Data.IPLD.CID
Description
"CID is a format for referencing content in distributed information systems, like IPFS. It leverages content addressing, cryptographic hashing, and self-describing formats. It is the core identifier used by IPFS and IPLD."
Synopsis
- data Version
- data Codec
- = Raw
- | DagProtobuf
- | DagCbor
- | GitRaw
- data CID
- cidVersion :: CID -> Version
- cidCodec :: CID -> Codec
- cidHash :: CID -> Multihash
- newCidV0 :: Digest SHA256 -> CID
- newCidV1 :: Multihashable a => Codec -> Digest a -> CID
- buildCid :: CID -> Builder
- decodeCid :: ByteString -> Either String CID
- getCid :: Get CID
- cidFromText :: Text -> Either String CID
- cidToText :: CID -> Text
- codecToCode :: Codec -> Word8
- codecFromCode :: Word8 -> Maybe Codec
Documentation
Specification version.
Instances
| Bounded Version Source # | |
| Enum Version Source # | |
| Eq Version Source # | |
| Ord Version Source # | |
| Show Version Source # | |
| Generic Version Source # | |
| Hashable Version Source # | |
Defined in Data.IPLD.CID | |
| NFData Version Source # | |
Defined in Data.IPLD.CID | |
| type Rep Version Source # | |
The content type or format of the data being addressed, specified as a multicodec.
Note that we do not currently have a full multicodec implementation, as it is
overly complicated for our purposes. We also only support Codecs on an
as-needed basis. Future versions may utilise a separate library.
Constructors
| Raw | |
| DagProtobuf | |
| DagCbor | |
| GitRaw |
Instances
| Eq Codec Source # | |
| Ord Codec Source # | |
| Show Codec Source # | |
| Generic Codec Source # | |
| Hashable Codec Source # | |
Defined in Data.IPLD.CID | |
| NFData Codec Source # | |
Defined in Data.IPLD.CID | |
| type Rep Codec Source # | |
Defined in Data.IPLD.CID type Rep Codec = D1 (MetaData "Codec" "Data.IPLD.CID" "ipld-cid-0.1.0.0-8NZ9ygnopa7DbdvMJP5n9H" False) ((C1 (MetaCons "Raw" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "DagProtobuf" PrefixI False) (U1 :: Type -> Type)) :+: (C1 (MetaCons "DagCbor" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "GitRaw" PrefixI False) (U1 :: Type -> Type))) | |
A Content IDentifier.
Instances
| Eq CID Source # | |
| Ord CID Source # | |
| Read CID Source # | |
| Show CID Source # | |
| Generic CID Source # | |
| Hashable CID Source # | |
Defined in Data.IPLD.CID | |
| NFData CID Source # | |
Defined in Data.IPLD.CID | |
| type Rep CID Source # | |
Defined in Data.IPLD.CID type Rep CID = D1 (MetaData "CID" "Data.IPLD.CID" "ipld-cid-0.1.0.0-8NZ9ygnopa7DbdvMJP5n9H" False) (C1 (MetaCons "CID" PrefixI True) (S1 (MetaSel (Just "cidVersion") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Version) :*: (S1 (MetaSel (Just "cidCodec") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Codec) :*: S1 (MetaSel (Just "cidHash") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Multihash)))) | |
cidVersion :: CID -> Version Source #
decodeCid :: ByteString -> Either String CID Source #
Decode a CID from a strict ByteString.
decodeCid . buildCid ≡ Right
codecToCode :: Codec -> Word8 Source #
multicodec numerical code of
the given Codec.
codecFromCode :: Word8 -> Maybe Codec Source #
Attempt to convert from a multicodec
numerical code to a Codec.