lair_keystore_api is both an executable binary that can be run, and a library that can be used in Rust programs.
Installing the fixture-sig-fallback executable
Assuming you have Rust/Cargo installed , run this command in a terminal:
cargo install lair_keystore_api
It will make the fixture-sig-fallback command available in your PATH if you've allowed the PATH to be modified when installing Rust . cargo uninstall lair_keystore_api uninstalls.
Adding lair_keystore_api library as a dependency
Run this command in a terminal, in your project's directory:
cargo add lair_keystore_api
To add it manually, edit your project's Cargo.toml file and add to the [dependencies] section:
lair_keystore_api = "0.6.3"
The lair_keystore_api library will be automatically available globally.
Read the lair_keystore_api library documentation .
Back to the crate overview .
Readme
lair_keystore_api
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, see the
lair_keystore crate.
If you want to run a canonical lair-keystore in-process, using
the canonical sqlcipher database, see the
lair_keystore crate.
See the [lair_api] module for information about the lair_keystore_api
protocol.
See [LairClient] for the client struct api.
Establishing a client connection to a canonical ipc keystore binary:
use lair_keystore_api:: prelude:: * ;
use lair_keystore_api:: ipc_keystore:: * ;
// 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 ,
false ,
) . 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 ( ) . into ( ) ,
) . await) ;
License: MIT OR Apache-2.0