Skip to main content

Module cid

Module cid 

Source
Expand description

The cid string format: a content identifier, checked by shape only.

This project emits no CIDs at all — didbot-pds’s RecordStore::put says why — so the only CIDs it will ever see are ones a client wrote into a record. The check is therefore the lenient one atproto specifies: an ASCII string of plausible length in the multibase alphabets, not a decode. Decoding would mean a multibase and multihash implementation for a value nothing here dereferences.

One version rule is enforced rather than left to shape. CIDv0 — 46 characters of base58 opening with Qm — is a valid IPFS identifier and is not permitted in atproto, and it passes every length and alphabet test, so nothing but naming it would catch it.

Enums§

CidError
Why a string is not a usable CID.

Constants§

CID_V0_LENGTH 🔒
How long a CIDv0 is: Qm plus a base58-encoded 32-byte multihash.
MAX_CID_LENGTH
Longest a CID may be.
MIN_CID_LENGTH
Shortest a CID may be.

Functions§

validate
Checks a string against the lenient CID rules.