Client

Struct Client 

Source
pub struct Client { /* private fields */ }
Expand description

Client for interacting with the key management daemon

Implementations§

Source§

impl Client

Source

pub fn new(address: &str, token: &str) -> Client

Source

pub fn versions(&self) -> Result<VersionsResponse>

Retrieves the current version

Source

pub fn list_wallets(&self) -> Result<ListWalletsResponse>

List all of the wallets that kmd is aware of

Source

pub fn create_wallet( &self, wallet_name: &str, wallet_password: &str, wallet_driver_name: &str, master_derivation_key: MasterDerivationKey, ) -> Result<CreateWalletResponse>

Creates a wallet

Source

pub fn init_wallet_handle( &self, wallet_id: &str, wallet_password: &str, ) -> Result<InitWalletHandleResponse>

Unlock the wallet and return a wallet token that can be used for subsequent operations

These tokens expire periodically and must be renewed. You can see how much time remains until expiration with get_wallet and renew it with renew_wallet_handle. When you’re done, you can invalidate the token with release_wallet_handle

Source

pub fn release_wallet_handle( &self, wallet_handle: &str, ) -> Result<ReleaseWalletHandleResponse>

Release a wallet handle token

Source

pub fn renew_wallet_handle( &self, wallet_handle: &str, ) -> Result<RenewWalletHandleResponse>

Renew a wallet handle token

Source

pub fn rename_wallet( &self, wallet_id: &str, wallet_password: &str, new_name: &str, ) -> Result<RenameWalletResponse>

Rename a wallet

Source

pub fn get_wallet(&self, wallet_handle: &str) -> Result<GetWalletResponse>

Get wallet info

Source

pub fn export_master_derivation_key( &self, wallet_handle: &str, wallet_password: &str, ) -> Result<ExportMasterDerivationKeyResponse>

Export the master derivation key from a wallet

Source

pub fn import_key( &self, wallet_handle: &str, private_key: [u8; 32], ) -> Result<ImportKeyResponse>

Import an externally generated key into the wallet

Source

pub fn export_key( &self, wallet_handle: &str, wallet_password: &str, address: &str, ) -> Result<ExportKeyResponse>

Export the Ed25519 seed associated with the passed address

Note the first 32 bytes of the returned value is the seed, the second 32 bytes is the public key

Source

pub fn generate_key(&self, wallet_handle: &str) -> Result<GenerateKeyResponse>

Generates a key and adds it to the wallet, returning the public key

Source

pub fn delete_key( &self, wallet_handle: &str, wallet_password: &str, address: &str, ) -> Result<DeleteKeyResponse>

Deletes the key from the wallet

Source

pub fn list_keys(&self, wallet_handle: &str) -> Result<ListKeysResponse>

List all of the public keys in the wallet

Source

pub fn sign_transaction( &self, wallet_handle: &str, wallet_password: &str, transaction: &Transaction, ) -> Result<SignTransactionResponse>

Sign a transaction

Source

pub fn list_multisig(&self, wallet_handle: &str) -> Result<ListMultisigResponse>

Lists all of the multisig accounts whose preimages this wallet stores

Source

pub fn import_multisig( &self, wallet_handle: &str, version: u8, threshold: u8, pks: &[Ed25519PublicKey], ) -> Result<ImportMultisigResponse>

Import a multisig account

Source

pub fn export_multisig( &self, wallet_handle: &str, address: &str, ) -> Result<ExportMultisigResponse>

Export multisig address metadata

Source

pub fn delete_multisig( &self, wallet_handle: &str, wallet_password: &str, address: &str, ) -> Result<DeleteMultisigResponse>

Delete a multisig from the wallet

Source

pub fn sign_multisig_transaction( &self, wallet_handle: &str, wallet_password: &str, transaction: &Transaction, public_key: Ed25519PublicKey, partial_multisig: Option<MultisigSignature>, ) -> Result<SignMultisigTransactionResponse>

Start a multisig signature or add a signature to a partially completed multisig signature

Auto Trait Implementations§

§

impl Freeze for Client

§

impl !RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl !UnwindSafe for Client

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
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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

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.
Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,