Crates.io | blastkids |
lib.rs | blastkids |
version | 0.2.0 |
source | src |
created_at | 2023-09-20 14:18:47.48125 |
updated_at | 2024-07-01 13:51:12.851145 |
description | Derive BLS12-381 child keys using Blastkids. |
homepage | https://github.com/DougAnderson444/blastkids |
repository | https://github.com/DougAnderson444/blastkids |
max_upload_size | |
id | 978161 |
size | 26,169 |
A BLS12-381 child key derivation library written in Rust. Implements EIP-2333 and EIP-2334.
Fork of rust-bls-derivation using bls12_381_plus
instead of curv-kzen
, plus cleanup and documentation.
If you want to use Delegatable Anonymous Credentials the verification key (VK
) becomes as long as the credential entries. Since a VK
is simply several BLS12-381 public keys (PK
s) we can use a derivation algorithm such as EIP-2333 in order to derive the long VK
from a single root PK
given any length.
cargo install blastkids
See documentation on docs.rs.
See tests in lib.rs
for example usage.
use blastkids::{Manager, Zeroizing, derive};
use blastkids::{G1, G2};
// make a new manager for a G2 public key
let seed = Zeroizing::new([42u8; 32]);
let manager: Manager<G2> = Manager::from_seed(seed);
// With a Manager you can create as many account sas you need
let account_number = 1u32;
let account = manager.account(account_number);
let length = 8u8; // Specify how many Child Public Keys you need (in this case, 8). Can be up to 255.
// Anyone can use an Account Public Key and a `length` to derive an expanded account
let expanded_pk: Vec<G2> = derive(&account.pk, length);
// When you want to use the child account secret keys,
// you call `expand_to` on the account
let expanded = account.expand_to(length);
// This expand public keys are the same as the ones derived above
assert_eq!(expanded.pk, expanded_pk);
cargo test
password
+ salt
: seed-keeper-coreseed
: delanocredscurv-kzen
library which breaks with rust-nightly and appears somewhat unmaintained)Contributions are welcome! Please open an issue if you have any feature ideas or find any bugs. I also accept pull requests with open arms. Please: