296 releases

new 0.7.0-dev.14 May 4, 2026
0.7.0-dev.11 Mar 30, 2026
0.7.0-dev.2 Dec 22, 2025
0.7.0-dev.0 Nov 24, 2025
0.0.2 Jul 29, 2021

#18 in #nacl

Download history 210/week @ 2026-01-11 218/week @ 2026-01-18 273/week @ 2026-01-25 280/week @ 2026-02-01 285/week @ 2026-02-08 171/week @ 2026-02-15 201/week @ 2026-02-22 427/week @ 2026-03-01 374/week @ 2026-03-08 299/week @ 2026-03-15 661/week @ 2026-03-22 2273/week @ 2026-03-29 296/week @ 2026-04-05 364/week @ 2026-04-12 203/week @ 2026-04-19 92/week @ 2026-04-26

1,732 downloads per month
Used in 42 crates (12 directly)

Apache-2.0

365KB
7.5K SLoC

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 std::path::Path;
use std::path::PathBuf;
use holochain_keystore::*;
use holochain_keystore::lair_keystore::*;
use holochain_serialized_bytes::prelude::*;
use std::sync::{Arc, Mutex};

#[tokio::main(flavor = "multi_thread")]
async fn main() {
    tokio::task::spawn(async move {
        let mut passphrase = sodoken::LockedArray::new(32).unwrap();
        passphrase.lock().copy_from_slice(b"passphrase");

        let passphrase = Arc::new(Mutex::new(passphrase));

        let keystore = spawn_lair_keystore_in_proc(&PathBuf::from("/"), passphrase).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

Dependencies

~50–69MB
~1M SLoC