holochain_keystore 0.0.1

keystore for libsodium keypairs
Documentation

crate

Project Forum Chat

Twitter Follow License: License: CAL 1.0

Current version: 0.0.1

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 crate::*;
use holochain_serialized_bytes::prelude::*;

#[tokio::main(flavor = "multi_thread")]
async fn main() {
    tokio::task::spawn(async move {
        let _ = holochain_crypto::crypto_init_sodium();

        let keystore = test_keystore::spawn_test_keystore(vec![]).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();
}

Contribute

Holochain is an open source project. We welcome all sorts of participation and are actively working on increasing surface area to accept it. Please see our contributing guidelines for our general practices and protocols on participating in the community, as well as specific expectations around things like code formatting, testing practices, continuous integration, etc.

  • Connect with us on our forum

License

License: CAL 1.0

Copyright (C) 2019 - 2021, Holochain Foundation

This program is free software: you can redistribute it and/or modify it under the terms of the license provided in the LICENSE file (CAL-1.0). This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.