Expand description

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

Example

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 = test_keystore::spawn_test_keystore().await.unwrap();
        let agent_pubkey = AgentPubKey::new_from_pure_entropy(&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();
}

Re-exports

pub use keystore_actor::KeystoreSender;
pub use keystore_actor::KeystoreSenderExt;

Modules

Defines a crude mock Keystore which always returns the same Error for every call. This is about as close as we can get to a true mock which would allow tweaking individual handlers, hence why this is a “crude” mock.

This module contains all the types needed to implement a keystore actor. We will re-export the main KeystoreSender usable by clients at the lib.

Keystore backed by lair_keystore_client.

DANGER! This is a mock keystore for testing, DO NOT USE THIS IN PRODUCTION!

Enums

Keystore Error Type.

Traits

Extend holo_hash::AgentPubKey with additional signature functionality from Keystore.