holochain_keystore

Crates.ioholochain_keystore
lib.rsholochain_keystore
version0.5.0-dev.9
sourcesrc
created_at2021-06-30 21:02:59.523389
updated_at2024-12-11 02:41:41.628922
descriptionkeystore for libsodium keypairs
homepagehttps://github.com/holochain/holochain
repository
max_upload_size
id417128
size145,594
Holochain Release Automation (holochain-release-automation2)

documentation

https://docs.rs/holochain_keystore

README

holochain_keystore

A Keystore is a secure repository of private keys. MetaLairClient is a reference to a Keystore. MetaLairClient allows async generation of keypairs, and usage of those keypairs, reference by the public AgentPubKey.

Examples

use holo_hash::AgentPubKey;
use holochain_keystore::*;
use holochain_serialized_bytes::prelude::*;

#[tokio::main(flavor = "multi_thread")]
async fn main() {
    tokio::task::spawn(async move {
        let keystore = holochain_keystore::spawn_test_keystore().await.unwrap();
        let agent_pubkey = AgentPubKey::new_random(&keystore).await.unwrap();

        #[derive(Debug, serde::Serialize, serde::Deserialize, SerializedBytes)]
        struct MyData(Vec<u8>);

        let my_data_1 = MyData(b"signature test data 1".to_vec());

        let signature = agent_pubkey.sign(&keystore, &my_data_1).await.unwrap();

        assert!(agent_pubkey.verify_signature(&signature, &my_data_1).await.unwrap());
    }).await.unwrap();
}

License: CAL-1.0

Commit count: 0

cargo fmt