Crates.io | ghostkey_lib |
lib.rs | ghostkey_lib |
version | 0.1.3 |
source | src |
created_at | 2024-08-06 19:01:43.775303 |
updated_at | 2024-08-12 20:50:11.757141 |
description | A library for working with Freenet's Ghost Keys |
homepage | |
repository | https://github.com/freenet/freenet-core |
max_upload_size | |
id | 1327643 |
size | 31,795 |
A Rust library for creating and managing ghost keys and certificates in the Freenet ecosystem.
DelegateCertificateV1
: Represents a delegate certificate signed by a master keyGhostkeyCertificateV1
: Represents a ghost key certificate signed by a delegate keyArmorable
: Trait for serializing and deserializing objects to/from bytes and armored stringsAdd this to your Cargo.toml
:
[dependencies]
ghostkey_lib = "0.1.2" # Replace with the latest version
Example usage:
use ghostkey_lib::{DelegateCertificateV1, GhostkeyCertificateV1, util::create_keypair};
use rand_core::OsRng;
// Create a master key pair
let (master_signing_key, master_verifying_key) = create_keypair(&mut OsRng).unwrap();
// Create a delegate certificate
let info = "Test Delegate".to_string();
let (delegate_certificate, delegate_signing_key) =
DelegateCertificateV1::new(&master_signing_key, &info).unwrap();
// Create a ghost key certificate
let (ghost_key_certificate, ghost_key_signing_key) =
GhostkeyCertificateV1::new(&delegate_certificate, &delegate_signing_key);
// Verify the ghost key certificate
let verified_info = ghost_key_certificate
.verify(&Some(master_verifying_key))
.unwrap();
assert_eq!(verified_info, info);
ghostkey_lib
is released under the
GNU Lesser General Public License v3.0.