package cid

  1. Overview
  2. Docs

Module CidSource

Sourcemodule type S = sig ... end
Sourcemodule Make (H : Multihash.S) : S with type multihash = Cstruct.t H.t
include S with type multihash = Cstruct.t Multihash_digestif.t
Sourcetype multihash = Cstruct.t Multihash_digestif.t

The type for multihashes

Sourcetype t

A content-addressed identifier.

Sourceval v : version:[ `Cidv0 | `Cidv1 | `Cidv2 | `Cidv3 ] -> base:Multibase.Encoding.t -> codec:Multicodec.t -> hash:multihash -> t

Build a CID, this performs no checks on any of the inputs

Sourceval version : t -> [ `Cidv0 | `Cidv1 | `Cidv2 | `Cidv3 ]

The CID version.

The multibase encoding of the CID.

Sourceval codec : t -> Multicodec.t

The multicodec type of the data

Sourceval hash : t -> multihash

The multihash of the CID

Sourceval equal : t -> t -> bool

Tests the equality of two CIDs.

Sourceval of_string : string -> (t, [ `Msg of string | `Unsupported of Multibase.Encoding.t ]) result

of_string s takes an encoded string s that is the CID and pulls out each of the parts that make it up.

Sourceval of_cstruct : base:Multibase.Encoding.t -> Cstruct.t -> (t, [ `Msg of string | `Unsupported of Multibase.Encoding.t ]) result

of_cstruct ~base buf builds a value representing a CID. The buffer should not be encoded with the multibase encoding.

Sourceval to_string : t -> string

to_string t converts the CID to a multibase encoded string. Errors happen if the base encoding is not supported. This may raise an exception of the base encoding format is not supported.

Sourceval to_cstruct : t -> Cstruct.t

to_cstruct t returns a buffer with the bytes corresponding to the unencoded CID.

Sourceval pp_human : Format.formatter -> t -> unit

Pretty-prints a CID.

OCaml

Innovation. Community. Security.