twine_protocol
Official rust library for the Twine Protocol.
The twine_protocol crate is a meta crate for ease of use of
twine_lib and optionally twine_builder and twine_http_store through feature flags. Its main purpose
is to provide a prelude module to be used as: use twine_protocol::prelude::*;.
Packages
twine-rs monorepo provides many crates for various purposes:
Core libraries
- twine_protocol meta library for ease of use
- twine_lib core library for reading twine data
- twine_builder utilities for constructing twine data
Stores
These provide various ways to store twine data, all implementing the
Store trait.
- twine_http_store saving twine data to a twine http api
- twine_sql_store saving twine data to sqlite or mysql dbs
- twine_sled_store saving twine data to a Sled KV db
- twine_car_store saving twine data to a CAR file
- twine_pickledb_store saving twine data to a simple binary data file
CLI
The twine_cli is a work-in-progress commandline interface for fetching, reading, and copying twine data.
Quickstart
Reading twine data
use *;
const STRAND_JSON: &'static str = r#"{"cid":{"/":"bafyrmieej3j3sprtnbfziv6vhixzr3xxrcabnma43ajb5grhsixdvxzdvu"},"data":{"c":{"h":22,"v":"twine/2.0.0/time/1.0.0","k":{"a":"ED25519","k":{"/":{"bytes":"q0Th03lW3omSuQQSMKZZewQgmCalQLmAo3DN3M4PizM"}}},"r":32,"d":{},"g":"2024-12-20T00:00:00Z","e":null},"s":{"/":{"bytes":"hN5hlT+3+zwJzgmrej8LvtPrAnRsf0c2Qo8xZE0Bj0uY0Tudhi9CbBx/5AjPmceyYGifWb0uw5SZRLMDS15YBA"}}}}"#;
Writing twine data
use *;
use ;
use ;
Retrieving data from a store (an http store)
use *;
use ;
use ;
async
Feature flags
sha3(default): enables the sha3 family of hash functionsblake3(default): enables the blake3 family of hash functionshttp: enables functionality of the twine_http_storebuild: enables functionality for constructing twine dataripemd: enables the ripemd hash functionsblake2s: enables the blake2s hash functionsblake2b: enables the blake2b hash functionsrsa: enables RSA functionality with thebuildfeature
License
The rust twine library is distributed under the MIT license.