1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// grrr clippy... you cannot specify extra bounds with the async fn syntax...
// default implementations don't always make sense...
//! Secret lair private keystore API library.
//!
//! This library crate contains most of the logic for dealing with lair.
//!
//! - If you wish to run an in-process / in-memory keystore, or connect to
//! an external lair keystore as a client, this is the library for you.
//! - If you want to run the canonical lair-keystore, you need the [lair_keystore](https://crates.io/crates/lair_keystore) crate.
//! - If you want to run a canonical lair-keystore in-process, but using
//! the canonical sqlcipher database, you also the [lair_keystore](https://crates.io/crates/lair_keystore) crate.
//! - See the [lair_api](./lair_api/index.html) module for information about the lair_keystore_api protocol.
//! - See [LairClient](./lair_client/struct.LairClient.html) for the client struct api.
//!
//! #### Establishing a client connection to a canonical ipc keystore binary:
//!
//! ```
//! # #[tokio::main]
//! # async fn main() {
//! use lair_keystore_api::prelude::*;
//! use lair_keystore_api::ipc_keystore::*;
//! # use lair_keystore_api::dependencies::*;
//! # use lair_keystore_api::mem_store::*;
//! # use std::sync::Arc;
//! # let tmp_dir = tempdir::TempDir::new("lair_ipc_doc_test").unwrap();
//! # let passphrase = sodoken::BufRead::from(&b"passphrase"[..]);
//! # let config = Arc::new(
//! # hc_seed_bundle::PwHashLimits::Minimum
//! # .with_exec(|| {
//! # LairServerConfigInner::new(
//! # tmp_dir.path(),
//! # passphrase.clone(),
//! # )
//! # })
//! # .await
//! # .unwrap(),
//! # );
//! # let keystore = IpcKeystoreServer::new(
//! # config.clone(),
//! # create_mem_store_factory(),
//! # passphrase.clone(),
//! # )
//! # .await
//! # .unwrap();
//! # let connection_url = config.connection_url.clone();
//!
//! // create a client connection
//! let client =
//! ipc_keystore_connect(connection_url, passphrase)
//! .await
//! .unwrap();
//!
//! // create a new seed
//! let seed_info = client.new_seed("test-seed".into(), None).await.unwrap();
//!
//! // sign some data
//! let sig = client.sign_by_pub_key(
//! seed_info.ed25519_pub_key.clone(),
//! None,
//! b"test-data".to_vec().into(),
//! ).await.unwrap();
//!
//! // verify the signature
//! assert!(seed_info.ed25519_pub_key.verify_detached(
//! sig,
//! b"test-data".to_vec(),
//! ).await.unwrap());
//! # }
//! ```
include!;
/// re-exported dependencies
use *;
/// Lair Result Type
pub type LairResult<T> = ;
/// re-export module of types generally used with lair
use *;