| Crates.io | ubl-codec |
| lib.rs | ubl-codec |
| version | 0.1.0 |
| created_at | 2026-01-10 16:35:34.662233+00 |
| updated_at | 2026-01-10 16:35:34.662233+00 |
| description | UBL codec: Canonical JSON✯Atomic encode/decode + binary TLV for Universal Business Ledger. |
| homepage | https://logline.foundation |
| repository | https://github.com/LogLine-Foundation/logline-workspace |
| max_upload_size | |
| id | 2034412 |
| size | 52,474 |
Canonical encoding for the LogLine Workspace — two complementary codecs:
to_canon_vec / from_canon_slice — Serialize/deserialize with key sortingto_cid_hex — BLAKE3 CID of canonical bytesCanonical<T> — Value + precomputed canonical bytesis_canonical — Check if JSON string is already canonicalyaml_to_canon_vec — YAML → canonical JSONCID32, PUBKEY32, SIG64, BYTES, STR, U64typ (u8) + len (varint) + payloaduse ubl_codec::{Encoder, Decoder, encode_frame, decode_frame};
use ubl_crypto::blake3_cid;
let cid = blake3_cid(b"hello");
let mut enc = Encoder::new();
enc.cid32(&cid);
enc.str("hi");
let payload = enc.finish();
let frame = encode_frame(0x42, &payload);
let (typ, body) = decode_frame(&frame).unwrap();
let mut dec = Decoder::new(body);
let cid2 = dec.cid32().unwrap();
let msg = dec.str().unwrap();
[dependencies]
ubl-codec = "0.3"
Proteções DoS integradas:
| Limite | Valor | Erro |
|---|---|---|
MAX_FRAME_LEN |
1 MiB | BinaryCodecError::SizeLimit |
MAX_VARINT_BYTES |
10 | BinaryCodecError::VarintOverflow |
cargo test --test tlv_adversarial
MIT OR Apache-2.0 © LogLine Foundation