Crates.io | polyproto |
lib.rs | polyproto |
version | 0.9.0 |
source | src |
created_at | 2024-02-01 20:50:03.301803 |
updated_at | 2024-06-08 13:03:21.534339 |
description | (Generic) Rust types and traits to quickly get a polyproto implementation up and running |
homepage | |
repository | https://github.com/polyphony-chat/polyproto |
max_upload_size | |
id | 1123599 |
size | 346,650 |
Crate supplying (generic) Rust types and traits to quickly get a polyproto implementation up and running, as well as an HTTP client for the polyproto API.
Building upon types offered by the der, x509_cert and spki crates, this crate provides a set of types and traits to quickly implement the polyproto specification. Simply add cryptography and signature algorithm crates of your choice to the mix, and you are ready to go.
All polyproto certificate types can be converted to and from the types offered by the x509_cert
crate.
Start by implementing the trait [crate::signature::Signature] for a signature algorithm of your
choice. Popular crates for cryptography and signature algorithms supply their own PublicKey
and
PrivateKey
types. You should extend upon these types with your own structs and implement the
[crate::key] traits for these new structs.
You can then use the [crate::certs] types to build certificates using your implementations of the aforementioned traits.
View the examples directory for a simple example on how to implement and use this crate with the ED25519 signature algorithm.
This crate provides no cryptographic functionality whatsoever; its sole purpose is to aid in implementing polyproto by transforming the polyproto specification into well-defined yet adaptable Rust types.
Please refer to the documentation of individual functions for information on which safety guarantees they provide. Methods returning certificates, certificate requests and other types where the validity and correctness of the data has a chance of impacting the security of a system always mention the safety guarantees they provide in their respective documentation.
This crate has not undergone any security audits.
This crate is designed to work with the wasm32-unknown-unknown
target. To compile for wasm
, you
will have to use the wasm
feature:
[dependencies]
polyproto = { version = "0", features = ["wasm"] }
reqwest
If the reqwest
feature is activated, this crate offers a polyproto HTTP API client, using the
reqwest
crate.
reqwest
If you would like to implement an HTTP client using something other than reqwest
, simply enable
the types
and serde
features. Using these features, you can implement your own HTTP client, with
the polyproto crate acting as a single source of truth for request and response types, as well as
request routes and methods through the exported static
Route
s.