pub struct Client { /* private fields */ }
Expand description
Client for interacting with the key management daemon
Implementations§
Source§impl Client
impl Client
pub fn new(address: &str, token: &str) -> Client
Sourcepub fn versions(&self) -> Result<VersionsResponse>
pub fn versions(&self) -> Result<VersionsResponse>
Retrieves the current version
Sourcepub fn list_wallets(&self) -> Result<ListWalletsResponse>
pub fn list_wallets(&self) -> Result<ListWalletsResponse>
List all of the wallets that kmd is aware of
Sourcepub fn create_wallet(
&self,
wallet_name: &str,
wallet_password: &str,
wallet_driver_name: &str,
master_derivation_key: MasterDerivationKey,
) -> Result<CreateWalletResponse>
pub fn create_wallet( &self, wallet_name: &str, wallet_password: &str, wallet_driver_name: &str, master_derivation_key: MasterDerivationKey, ) -> Result<CreateWalletResponse>
Creates a wallet
Sourcepub fn init_wallet_handle(
&self,
wallet_id: &str,
wallet_password: &str,
) -> Result<InitWalletHandleResponse>
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
Sourcepub fn release_wallet_handle(
&self,
wallet_handle: &str,
) -> Result<ReleaseWalletHandleResponse>
pub fn release_wallet_handle( &self, wallet_handle: &str, ) -> Result<ReleaseWalletHandleResponse>
Release a wallet handle token
Sourcepub fn renew_wallet_handle(
&self,
wallet_handle: &str,
) -> Result<RenewWalletHandleResponse>
pub fn renew_wallet_handle( &self, wallet_handle: &str, ) -> Result<RenewWalletHandleResponse>
Renew a wallet handle token
Sourcepub fn rename_wallet(
&self,
wallet_id: &str,
wallet_password: &str,
new_name: &str,
) -> Result<RenameWalletResponse>
pub fn rename_wallet( &self, wallet_id: &str, wallet_password: &str, new_name: &str, ) -> Result<RenameWalletResponse>
Rename a wallet
Sourcepub fn get_wallet(&self, wallet_handle: &str) -> Result<GetWalletResponse>
pub fn get_wallet(&self, wallet_handle: &str) -> Result<GetWalletResponse>
Get wallet info
Sourcepub fn export_master_derivation_key(
&self,
wallet_handle: &str,
wallet_password: &str,
) -> Result<ExportMasterDerivationKeyResponse>
pub fn export_master_derivation_key( &self, wallet_handle: &str, wallet_password: &str, ) -> Result<ExportMasterDerivationKeyResponse>
Export the master derivation key from a wallet
Sourcepub fn import_key(
&self,
wallet_handle: &str,
private_key: [u8; 32],
) -> Result<ImportKeyResponse>
pub fn import_key( &self, wallet_handle: &str, private_key: [u8; 32], ) -> Result<ImportKeyResponse>
Import an externally generated key into the wallet
Sourcepub fn export_key(
&self,
wallet_handle: &str,
wallet_password: &str,
address: &str,
) -> Result<ExportKeyResponse>
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
Sourcepub fn generate_key(&self, wallet_handle: &str) -> Result<GenerateKeyResponse>
pub fn generate_key(&self, wallet_handle: &str) -> Result<GenerateKeyResponse>
Generates a key and adds it to the wallet, returning the public key
Sourcepub fn delete_key(
&self,
wallet_handle: &str,
wallet_password: &str,
address: &str,
) -> Result<DeleteKeyResponse>
pub fn delete_key( &self, wallet_handle: &str, wallet_password: &str, address: &str, ) -> Result<DeleteKeyResponse>
Deletes the key from the wallet
Sourcepub fn list_keys(&self, wallet_handle: &str) -> Result<ListKeysResponse>
pub fn list_keys(&self, wallet_handle: &str) -> Result<ListKeysResponse>
List all of the public keys in the wallet
Sourcepub fn sign_transaction(
&self,
wallet_handle: &str,
wallet_password: &str,
transaction: &Transaction,
) -> Result<SignTransactionResponse>
pub fn sign_transaction( &self, wallet_handle: &str, wallet_password: &str, transaction: &Transaction, ) -> Result<SignTransactionResponse>
Sign a transaction
Sourcepub fn list_multisig(&self, wallet_handle: &str) -> Result<ListMultisigResponse>
pub fn list_multisig(&self, wallet_handle: &str) -> Result<ListMultisigResponse>
Lists all of the multisig accounts whose preimages this wallet stores
Sourcepub fn import_multisig(
&self,
wallet_handle: &str,
version: u8,
threshold: u8,
pks: &[Ed25519PublicKey],
) -> Result<ImportMultisigResponse>
pub fn import_multisig( &self, wallet_handle: &str, version: u8, threshold: u8, pks: &[Ed25519PublicKey], ) -> Result<ImportMultisigResponse>
Import a multisig account
Sourcepub fn export_multisig(
&self,
wallet_handle: &str,
address: &str,
) -> Result<ExportMultisigResponse>
pub fn export_multisig( &self, wallet_handle: &str, address: &str, ) -> Result<ExportMultisigResponse>
Export multisig address metadata
Sourcepub fn delete_multisig(
&self,
wallet_handle: &str,
wallet_password: &str,
address: &str,
) -> Result<DeleteMultisigResponse>
pub fn delete_multisig( &self, wallet_handle: &str, wallet_password: &str, address: &str, ) -> Result<DeleteMultisigResponse>
Delete a multisig from the wallet
Sourcepub fn sign_multisig_transaction(
&self,
wallet_handle: &str,
wallet_password: &str,
transaction: &Transaction,
public_key: Ed25519PublicKey,
partial_multisig: Option<MultisigSignature>,
) -> Result<SignMultisigTransactionResponse>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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