Skip to main content

Module cbor

Module cbor 

Source
Expand description

Deterministic generic CBOR, DAG-CBOR, and content-identifier helpers.

Structs§

DagCborCidVerification
Validated CID comparison with canonical, input-independent diagnostics.
DagCborMultihash
SHA-256 multihash for a DAG-CBOR block.
DeterministicCborMapEntry
Entry in a deterministic-CBOR map.
DeterministicCborNegativeInteger
Validated negative integer in the deterministic-CBOR supported range.
ParsedCid
Validated CID, independent of the upstream CID type.

Enums§

CborError
Error returned when decoding fails to conform to the DAG-CBOR profile.
CborValue
A decoded DAG-CBOR value.
CidVerificationStatus
Outcome of comparing a canonical DAG-CBOR block with a CID string.
DeterministicCborError
Error returned by deterministic generic-CBOR encoding and decoding.
DeterministicCborInteger
Integer domain supported by the deterministic generic-CBOR profile.
DeterministicCborMapKey
Map key domain supported by deterministic generic CBOR.
DeterministicCborProfileError
Errors raised by deterministic-CBOR profile construction and validation.
DeterministicCborValue
Value domain supported by deterministic generic CBOR.

Constants§

DAG_CBOR_CODEC
dag-cbor multicodec code (IPLD)
DETERMINISTIC_CBOR_NEGATIVE_MAX
Largest negative integer supported by the deterministic generic profile.
DETERMINISTIC_CBOR_NEGATIVE_MIN
Smallest negative integer supported by the deterministic generic profile.
MAX_DETERMINISTIC_CBOR_AGGREGATE_BYTE_STRING_BYTES
Maximum aggregate bytes across all byte-string values.
MAX_DETERMINISTIC_CBOR_AGGREGATE_TEXT_BYTES
Maximum aggregate UTF-8 bytes across all text values and text map keys.
MAX_DETERMINISTIC_CBOR_CONTAINER_ENTRIES
Maximum entries in a single deterministic-CBOR array or map.
MAX_DETERMINISTIC_CBOR_INPUT_LEN
Maximum encoded deterministic-CBOR byte length accepted at public decode boundaries.
MAX_DETERMINISTIC_CBOR_NESTING_DEPTH
Maximum recursive array/map nesting depth for deterministic generic CBOR.
MAX_DETERMINISTIC_CBOR_NODES
Maximum semantic nodes in a deterministic-CBOR value tree.
MAX_DETERMINISTIC_CBOR_OUTPUT_LEN
Maximum deterministic-CBOR byte length the encoder may produce.

Functions§

compute_cid_dag_cbor
Computes the CIDv1 (dag-cbor, sha2-256) of bytes in canonical base32-lower string form.
dag_cbor_multihash
Returns a sha2-256 multihash of bytes for use in a CID.
decode_dag_cbor
Decode canonical DAG-CBOR bytes into a CborValue.
decode_deterministic_cbor
Decode deterministic generic-CBOR bytes into the supported semantic value.
encode_dag_cbor
Encode a value using canonical DAG-CBOR.
encode_deterministic_cbor
Encode a value using the deterministic generic-CBOR profile.
is_valid_cid_string
Returns whether s parses as a valid CID string.
sha2_256_content_hash
Returns the raw sha2-256 digest of bytes.
try_parse_cid
Parses s as a CID, returning None if it is not a valid CID string.
verify_dag_cbor_cid
Validate one canonical DAG-CBOR block and compare its CID text.

Type Aliases§

ContentHash
Hash output for sha2-256