atproto_repo/cid
The “blessed” atproto CID: CIDv1, SHA-256, with the DAG-CBOR or raw
codec. Anything else is rejected at parse time, so a Cid value is
always one atproto accepts.
Types
Cid
opaquepub opaque type Cid
pub type CidError {
UnsupportedMultibase(prefix: String)
InvalidBase32
Truncated
MalformedVarint
UnsupportedVersion(Int)
UnsupportedCodec(Int)
UnsupportedHash(Int)
BadDigestLength(Int)
TrailingBytes(Int)
}
Constructors
-
UnsupportedMultibase(prefix: String) -
InvalidBase32 -
Truncated -
MalformedVarint -
UnsupportedVersion(Int) -
UnsupportedCodec(Int) -
UnsupportedHash(Int) -
BadDigestLength(Int) -
TrailingBytes(Int)
pub type Codec {
DagCbor
Raw
}
Constructors
-
DagCbor -
Raw
Values
pub fn from_bytes(bytes: BitArray) -> Result(Cid, CidError)
Parses exactly one binary CID; trailing bytes are an error.
pub fn parse(input: String) -> Result(Cid, CidError)
Parses the string form: multibase b (lowercase base32, unpadded).