Struct Key

Source
pub struct Key {}

Implementations§

Source§

impl Key

Source

pub fn create( wallet_handle: IndyHandle, my_key_json: Option<&str>, ) -> Result<String, ErrorCode>

Creates key pair in wallet

§Arguments
  • wallet_handle - wallet handle (created by Wallet::open)
  • my_key_json - Optional key information as json. If none then defaults are used.
§Example

my_key_json { “seed”: string, // Optional (if not set random one will be used); Seed information that allows deterministic key creation. “crypto_type”: string, // Optional (if not set then ed25519 curve is used); Currently only ‘ed25519’ value is supported for this field. }

§Returns

verkey of generated key pair, also used as key identifier

Source

pub fn create_timeout( wallet_handle: IndyHandle, my_key_json: Option<&str>, timeout: Duration, ) -> Result<String, ErrorCode>

Creates key pair in wallet

§Arguments
  • wallet_handle - wallet handle (created by Wallet::open)
  • my_key_json - key information as json
  • timeout - the maximum time this function waits for a response
§Example

my_key_json { “seed”: string, // Optional (if not set random one will be used); Seed information that allows deterministic key creation. “crypto_type”: string, // Optional (if not set then ed25519 curve is used); Currently only ‘ed25519’ value is supported for this field. }

§Returns

verkey of generated key pair, also used as key identifier

Source

pub fn create_async<F>( wallet_handle: IndyHandle, my_key_json: Option<&str>, closure: F, ) -> ErrorCode
where F: FnMut(ErrorCode, String) + Send + 'static,

Creates key pair in wallet

§Arguments
  • wallet_handle - wallet handle (created by Wallet::open)
  • my_key_json - Optional key information as json. If none then defaults are used.
  • closure - The closure that is called when finished
§Example

my_key_json { “seed”: string, // Optional (if not set random one will be used); Seed information that allows deterministic key creation. “crypto_type”: string, // Optional (if not set then ed25519 curve is used); Currently only ‘ed25519’ value is supported for this field. }

§Returns

errorcode from calling ffi function. The closure receives the return result

Source

pub fn set_metadata( wallet_handle: IndyHandle, verkey: &str, metadata: &str, ) -> Result<(), ErrorCode>

Saves/replaces the metadata for the verkey in the wallet

§Arguments
  • wallet_handle - wallet handle (created by Wallet::open)
  • verkey - the public key or key id where to store the metadata
  • metadata - the metadata that will be stored with the key, can be empty string
Source

pub fn set_metadata_timeout( wallet_handle: IndyHandle, verkey: &str, metadata: &str, timeout: Duration, ) -> Result<(), ErrorCode>

Saves/replaces the metadata for the verkey in the wallet

§Arguments
  • wallet_handle - wallet handle (created by Wallet::open)
  • verkey - the public key or key id where to store the metadata
  • metadata - the metadata that will be stored with the key, can be empty string
  • timeout - the maximum time this function waits for a response
Source

pub fn set_metadata_async<F>( wallet_handle: IndyHandle, verkey: &str, metadata: &str, closure: F, ) -> ErrorCode
where F: FnMut(ErrorCode) + Send + 'static,

Saves/replaces the metadata for the verkey in the wallet

§Arguments
  • wallet_handle - wallet handle (created by Wallet::open)
  • verkey - the public key or key id where to store the metadata
  • metadata - the metadata that will be stored with the key, can be empty string
  • closure - The closure that is called when finished
Source

pub fn get_metadata( wallet_handle: IndyHandle, verkey: &str, ) -> Result<String, ErrorCode>

Retrieves the metadata for the verkey in the wallet

§Argument
  • wallet_handle - wallet handle (created by Wallet::open)
  • verkey - the public key or key id to retrieve metadata
§Returns

metadata currently stored with the key; Can be empty if no metadata was saved for this key

Source

pub fn get_metadata_timeout( wallet_handle: IndyHandle, verkey: &str, timeout: Duration, ) -> Result<String, ErrorCode>

Retrieves the metadata for the verkey in the wallet

§Argument
  • wallet_handle - wallet handle (created by Wallet::open)
  • verkey - the public key or key id to retrieve metadata
  • timeout - the maximum time this function waits for a response
§Returns

metadata currently stored with the key; Can be empty if no metadata was saved for this key

Source

pub fn get_metadata_async<F>( wallet_handle: IndyHandle, verkey: &str, closure: F, ) -> ErrorCode
where F: FnMut(ErrorCode, String) + Send + 'static,

Retrieves the metadata for the verkey in the wallet

§Argument
  • wallet_handle - wallet handle (created by Wallet::open)
  • verkey - the public key or key id to retrieve metadata
  • closure - The closure that is called when finished
§Returns

errorcode from calling ffi function

Auto Trait Implementations§

§

impl Freeze for Key

§

impl RefUnwindSafe for Key

§

impl Send for Key

§

impl Sync for Key

§

impl Unpin for Key

§

impl UnwindSafe for Key

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