pub struct LairClient(pub Arc<dyn AsLairClient>);
Expand description

A lair keystore client handle. Use this to make requests of the keystore.

Tuple Fields§

§0: Arc<dyn AsLairClient>

Implementations§

§

impl LairClient

pub fn get_enc_ctx_key(&self) -> BufReadSized<32>

Return the encryption context key for passphrases, etc.

pub fn get_dec_ctx_key(&self) -> BufReadSized<32>

Return the decryption context key for passphrases, etc.

pub fn shutdown( &self ) -> impl Future<Output = Result<(), OneErr>> + Send + 'static

Shutdown the client connection.

pub fn request<R>( &self, request: R ) -> impl Future<Output = Result<<R as AsLairRequest>::Response, OneErr>> + Send + 'static

Handle a generic lair client request.

pub fn hello( &self, expected_server_pub_key: BinDataSized<32> ) -> impl Future<Output = Result<Arc<str>, OneErr>> + Send + 'static

Send the hello message to establish server authenticity. Check with your implementation before invoking this… it likely handles this for you in its constructor.

pub fn unlock( &self, passphrase: BufRead ) -> impl Future<Output = Result<(), OneErr>> + Send + 'static

Send the unlock request to unlock / communicate with the server. (this verifies client authenticity) Check with your implementation before invoking this… it likely handles this for you in its constructor.

pub fn list_entries( &self ) -> impl Future<Output = Result<Vec<LairEntryInfo>, OneErr>> + Send + 'static

Request a list of entries from lair.

pub fn get_entry( &self, tag: Arc<str> ) -> impl Future<Output = Result<LairEntryInfo, OneErr>> + Send + 'static

Return the EntryInfo for a given tag, or error if no such tag.

pub fn new_seed( &self, tag: Arc<str>, deep_lock_passphrase: Option<BufRead>, exportable: bool ) -> impl Future<Output = Result<SeedInfo, OneErr>> + Send + 'static

Instruct lair to generate a new seed from cryptographically secure random data with given tag. If the seed should be deeply locked, supply the deep_lock_passphrase as well. Respects hc_seed_bundle::PwHashLimits.

pub fn export_seed_by_tag( &self, tag: Arc<str>, sender_pub_key: BinDataSized<32>, recipient_pub_key: BinDataSized<32>, deep_lock_passphrase: Option<BufRead> ) -> impl Future<Output = Result<([u8; 24], Arc<[u8]>), OneErr>> + Send + 'static

Export seeds (that are marked “exportable”) by using the x25519xsalsa20poly1305 “crypto_box” algorithm. Respects hc_seed_bundle::PwHashLimits.

pub fn import_seed( &self, sender_pub_key: BinDataSized<32>, recipient_pub_key: BinDataSized<32>, deep_lock_passphrase: Option<BufRead>, nonce: [u8; 24], cipher: Arc<[u8]>, tag: Arc<str>, exportable: bool ) -> impl Future<Output = Result<SeedInfo, OneErr>> + Send + 'static

Import a seed encrypted via x25519xsalsa20poly1305 secretbox. Note it is 100% valid to co-opt this function to allow importing seeds that have been generated via custom algorithms, but you take responsibility for those security concerns. Respects hc_seed_bundle::PwHashLimits.

pub fn derive_seed( &self, src_tag: Arc<str>, src_deep_lock_passphrase: Option<BufRead>, dst_tag: Arc<str>, dst_deep_lock_passphrase: Option<BufRead>, derivation_path: Box<[u32]> ) -> impl Future<Output = Result<SeedInfo, OneErr>> + Send + 'static

Derive a pre-existing key identified by given src_tag, with given derivation path, storing the final resulting sub-seed with the given dst_tag.

pub fn sign_by_pub_key( &self, pub_key: BinDataSized<32>, deep_lock_passphrase: Option<BufRead>, data: Arc<[u8]> ) -> impl Future<Output = Result<BinDataSized<64>, OneErr>> + Send + 'static

Generate a signature for given data, with the ed25519 keypair derived from seed identified by the given ed25519 pubkey. Respects hc_seed_bundle::PwHashLimits.

pub fn crypto_box_xsalsa_by_pub_key( &self, sender_pub_key: BinDataSized<32>, recipient_pub_key: BinDataSized<32>, deep_lock_passphrase: Option<BufRead>, data: Arc<[u8]> ) -> impl Future<Output = Result<([u8; 24], Arc<[u8]>), OneErr>> + Send + 'static

Encrypt data for a target recipient using the x25519xsalsa20poly1305 “crypto_box” algorithm. Respects hc_seed_bundle::PwHashLimits.

pub fn crypto_box_xsalsa_open_by_pub_key( &self, sender_pub_key: BinDataSized<32>, recipient_pub_key: BinDataSized<32>, deep_lock_passphrase: Option<BufRead>, nonce: [u8; 24], cipher: Arc<[u8]> ) -> impl Future<Output = Result<Arc<[u8]>, OneErr>> + Send + 'static

Decrypt data from a target sender using the x25519xsalsa20poly1305 “crypto_box_open” algorithm. Respects hc_seed_bundle::PwHashLimits.

pub fn new_wka_tls_cert( &self, tag: Arc<str> ) -> impl Future<Output = Result<CertInfo, OneErr>> + Send + 'static

Instruct lair to generate a new well-known-authority signed TLS cert. This is a lot like a self-signed certificate, but slightly easier to work with in that it allows registering a single well-known-authority as a certificate authority which will respect multiple certs.

pub fn get_wka_tls_cert_priv_key( &self, tag: Arc<str> ) -> impl Future<Output = Result<BufRead, OneErr>> + Send + 'static

Fetch the private key associated with a wka_tls_cert entry. Will error if the entry specified by ‘tag’ is not a wka_tls_cert.

pub fn secretbox_xsalsa_by_tag( &self, tag: Arc<str>, deep_lock_passphrase: Option<BufRead>, data: Arc<[u8]> ) -> impl Future<Output = Result<([u8; 24], Arc<[u8]>), OneErr>> + Send + 'static

Shared secret encryption using the libsodium xsalsa20poly1305 “secretbox” algorithm. Respects hc_seed_bundle::PwHashLimits.

pub fn secretbox_xsalsa_open_by_tag( &self, tag: Arc<str>, deep_lock_passphrase: Option<BufRead>, nonce: [u8; 24], cipher: Arc<[u8]> ) -> impl Future<Output = Result<Arc<[u8]>, OneErr>> + Send + 'static

Shared secret decryption using the libsodium xsalsa20poly1305 “secretbox_open” algorithm. Respects hc_seed_bundle::PwHashLimits.

Trait Implementations§

§

impl Clone for LairClient

§

fn clone(&self) -> LairClient

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Any for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

§

fn type_name(&self) -> &'static str

§

impl<T> AnySync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

§

fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcastable for T
where T: Any + Send + Sync + 'static,

§

fn upcast_any_ref(&self) -> &(dyn Any + 'static)

upcast ref
§

fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)

upcast mut ref
§

fn upcast_any_box(self: Box<T>) -> Box<dyn Any>

upcast boxed dyn
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more