Expand description
§p2panda-rs
This library provides all tools required to write a client for the p2panda network. It is
shipped both as a Rust crate p2panda-rs
with WebAssembly bindings and a NPM package
p2panda-js
with TypeScript definitions running in NodeJS or any modern web browser.
§Example
Creates and signs data which can be sent to a p2panda node.
// Generate new Ed25519 key pair
let key_pair = KeyPair::new();
// Add field data to "create" operation
let operation = OperationBuilder::new(&profile_schema_id)
.fields(&[("username", "panda".into())])
.build()?;
// Encode operation into bytes
let encoded_operation = encode_operation(&operation)?;
// Create Bamboo entry (append-only log data type) with operation as payload
let entry = EntryBuilder::new()
.sign(&encoded_operation, &key_pair)?;
// Encode entry into bytes
let encoded_entry = encode_entry(&entry)?;
println!("{} {}", encoded_entry, encoded_operation);
Modules§
- api
- Common validation and API methods following the p2panda specification.
- document
- High-level datatype representing data published to the p2panda network as key-value pairs.
- entry
- Create, sign, encode and decode
Bamboo
entries. - graph
- Generic structs which can be used for building a graph structure and sorting it’s nodes in a topological depth-first manner.
- hash
- Hash type of p2panda using BLAKE3 algorithm wrapped in
YASMF
“Yet-Another-Smol-Multi-Format”. - identity
- Generates and maintains Ed25519 key pairs with the secret and public (PublicKey) counterparts.
- operation
- Create, encode and decode p2panda operations.
- schema
- Schemas describe the format of data used in operation fields.
- secret_
group - Create and moderate large secret groups to maintain key material for secure messaging.
- serde
- Commonly used functions for serialization and deserialization of values.
- storage_
provider - Storage provider traits needed for implementing custom p2panda storage solutions.