reallyme_codec/lib.rs
1// SPDX-FileCopyrightText: 2026 ReallyMe Technologies Limited
2//
3// SPDX-License-Identifier: MIT OR Apache-2.0
4
5//! # reallyme-codec
6//!
7//! Codec-only utilities used by ReallyMe and DID tooling: base encodings,
8//! canonical JSON/CBOR serialization, multicodec lookup, multikey handling, and
9//! PEM text armor.
10//! SHA-256 is used for content identifiers. This crate does not expose signing,
11//! encryption, or key generation.
12//!
13//! # Usage examples
14//!
15#![cfg_attr(feature = "base64url", doc = include_str!("../README.md"))]
16#![forbid(unsafe_code)]
17
18/// Standard (RFC 4648) base64 encode/decode.
19#[cfg(feature = "base64")]
20pub mod base64;
21
22/// URL-safe (RFC 4648 ยง5) base64 encode/decode without padding.
23#[cfg(feature = "base64url")]
24pub mod base64url;
25
26/// Borrowed general CBOR, deterministic CBOR, DAG-CBOR, and CID helpers.
27#[cfg(feature = "cbor")]
28pub mod cbor;
29
30/// Strict, bounded, schema-directed DER parsing for Rust consumers.
31#[cfg(feature = "der")]
32pub mod der;
33
34/// Bounded definite BER/ISO 7816 and DER header framing.
35#[cfg(feature = "tlv")]
36pub mod tlv;
37
38/// Canonical lowercase hexadecimal encode/decode helpers.
39#[cfg(feature = "hex")]
40pub mod hex;
41
42/// JSON Canonicalization Scheme helpers.
43#[cfg(feature = "jcs")]
44pub mod jcs;
45
46/// Multibase self-describing base encodings.
47#[cfg(feature = "multibase")]
48pub mod multibase;
49
50/// Semantic multicodec registry lookup, prefix handling, and metadata.
51#[cfg(feature = "multicodec")]
52pub mod multicodec;
53
54/// Multikey encoding/parsing that binds an algorithm to opaque key bytes.
55#[cfg(feature = "multikey")]
56pub mod multikey;
57
58/// PEM text armor parsing and encoding.
59#[cfg(feature = "pem")]
60pub mod pem;
61
62/// Generated protobuf operation contract lane.
63#[cfg(feature = "operation-contract")]
64pub mod operation_contract;