Skip to content

TypeScript implementation of deterministic CBOR (dCBOR), Uniform Resources (UR), secret sharing (SSKR / Shamir), Gordian Envelopes, provenance marks, and other crypto-utilities.

License

Notifications You must be signed in to change notification settings

leonardocustodio/bcts

Repository files navigation

Blockchain Commons - TypeScript

Version TypeScript Monorepo Package Manager Status

🔷 Community Implementation: This is an independent TypeScript monorepo implementing Blockchain Commons' open specifications and implementations. It is not an official Blockchain Commons repository.

🚧 Disclaimer: This repository is in early development stages. APIs and interfaces are subject to change.

Overview

This monorepo provides TypeScript implementations of Blockchain Commons specifications, including deterministic CBOR encoding, Gordian Envelope, Uniform Resources (URs), Sharded Secret Key Reconstruction (SSKR), and other cryptographic standards. All implementations follow the Rust reference implementations as the source of truth and maintain compatibility with the official specifications.

📦 Packages

Core Libraries

Package Description
components Shared component utilities and helpers for the Blockchain Commons ecosystem. 📖 Docs | 🦀 Rust
crypto Cryptographic primitives including symmetric encryption (ChaCha20-Poly1305), hashing (SHA-256, BLAKE3), and key derivation (HKDF, PBKDF2). 📖 Docs | 🦀 Rust
dcbor Deterministic CBOR encoding - a specification for serializing data in a canonical, reproducible format. Ensures identical byte sequences for cryptographic operations and blockchain applications. 📖 Docs | 🦀 Rust
dcbor-parse dCBOR Diagnostic Parser - parse and compose CBOR diagnostic notation into dCBOR data items. Supports booleans, numbers, strings, byte strings (hex/base64), tagged values, arrays, maps, URs, known values, and date literals. 📖 Docs | 🦀 Rust
dcbor-pattern Pattern matching for dCBOR - a powerful query language for matching and extracting data from dCBOR structures. Supports value, structure, and meta patterns with named captures and VM-based execution. 📖 Docs | 🦀 Rust
envelope Gordian Envelope - structured, privacy-focused data containers for secure information exchange. Supports encryption, elision, and cryptographic assertions. 📖 Docs | 🦀 Rust
envelope-pattern Pattern matching for Gordian Envelope - query and extract data from Envelope structures. Supports leaf, structure, and meta patterns with subject/predicate/object matching and tree traversal. 📖 Docs | 🦀 Rust
known-values Known Values - compact, deterministic identifiers for ontological concepts. More efficient than URIs for representing predicates and relationships. 📖 Docs | 🦀 Rust
provenance-mark Provenance Marks - cryptographically-secured system for establishing authenticity and provenance of digital works. Generates verifiable mark chains with configurable resolution levels. 📖 Docs | 🦀 Rust
rand Cryptographically secure random number generation utilities. Provides a consistent interface for random operations across all packages. 📖 Docs | 🦀 Rust
shamir Shamir's Secret Sharing - split secrets into shares where any threshold can reconstruct the original. Implements GF(256) arithmetic for secure secret splitting. 📖 Docs | 🦀 Rust
sskr Sharded Secret Key Reconstruction (SSKR) - hierarchical secret sharing with groups and thresholds. Encodes shares in Bytewords for human-friendly backup. 📖 Docs | 🦀 Rust
tags CBOR tag registry for Blockchain Commons specifications. Provides type-safe tag definitions for use across all packages. 📖 Docs | 🦀 Rust
uniform-resources Uniform Resources (UR) - a method for encoding binary data as URIs for transport in QR codes and other text-based channels. Includes Bytewords encoding and fountain codes for multi-part transmission. 📖 Docs | 🦀 Rust
xid Extensible Identifiers (XID) - decentralized digital identity documents supporting keys, delegates, services, and provenance. Enables self-sovereign identity management with cryptographic verification. 📖 Docs | 🦀 Rust

🎮 Applications

A collection of runnable TypeScript examples demonstrating the capabilities of this library.

An interactive web application for experimenting with dCBOR encoding, Uniform Resources decoding, and Gordian Envelope visualization.

Features:

  • Parse and visualize dCBOR data with annotated hex and diagnostic notation
  • Decode Uniform Resources (UR) with support for envelope URs
  • View Gordian Envelope tree format
  • Convert between hex, UR, and Bytewords formats
  • Live examples and interactive editing

Try it locally:

bun playground

Live Demo: https://bcts.dev

🛠️ Development

This is a monorepo managed with Turborepo. Common commands:

# Build all packages
bun run build
# Run tests across all packages
bun run test
# Lint all packages
bun run lint
# Format code
bun run format
# Run tests for a specific package
bun run test --filter=@bcts/dcbor

👥 Credits

This TypeScript implementation is a direct port from the work of @ChristopherA and @WolfMcNally.

Consider visiting Blockchain Commons to learn more about the organization and their mission.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

📄 License

This project is licensed under the BSD-2-Clause-Patent License – see the LICENSE file for details.

About

TypeScript implementation of deterministic CBOR (dCBOR), Uniform Resources (UR), secret sharing (SSKR / Shamir), Gordian Envelopes, provenance marks, and other crypto-utilities.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 5