#certificate #public-key #traits #signature #generic #type #running

polyproto

(Generic) Rust types and traits to quickly get a polyproto implementation up and running

12 releases (6 breaking)

new 0.9.0-alpha.4 May 16, 2024
0.8.0 Apr 15, 2024
0.6.0 Mar 11, 2024

#613 in Cryptography

Download history 1/week @ 2024-01-29 215/week @ 2024-02-12 123/week @ 2024-02-19 171/week @ 2024-02-26 8/week @ 2024-03-04 181/week @ 2024-03-11 5/week @ 2024-03-18 6/week @ 2024-04-01 136/week @ 2024-04-08 277/week @ 2024-04-15 76/week @ 2024-05-06

373 downloads per month
Used in stimmgabel

MPL-2.0 license

120KB
2K SLoC

Discord Matrix Build Coverage Blue status badge, reading 'Alpha'

polyproto

Crate supplying (generic) Rust types and traits to quickly get a polyproto implementation up and running.

Implementing polyproto

The crate is currently in an alpha stage. Some functionality is missing, and things may break or change at any point in time.

This crate extends upon types offered by der and spki. As such, these crates are required dependencies for projects looking to implement polyproto.

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.

Cryptography

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.

[dependencies]
polyproto = { version = "0", features = ["wasm"] }

WebAssembly

This crate is designed to work with the wasm32-unknown-unknown target. To compile for wasm, you will have to use the wasm feature:

reqwest

By default, this crate uses reqwest for HTTP requests. reqwest is an optional dependency, and you can disable it by using polyproto with default-features = false in your Cargo.toml:

[dependencies]
polyproto = { version = "0", default-features = false, features = ["routes"] }

Disabling reqwest gives you the ability to use your own HTTP client.

Dependencies

~7–20MB
~292K SLoC