pub struct Key {}
Implementations
sourceimpl Key
impl Key
sourcepub fn create(
wallet_handle: IndyHandle,
my_key_json: Option<&str>
) -> Result<String, ErrorCode>
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) Seed that allows deterministic key creation (if not set random one will be created). Can be UTF-8, base64 or hex string. “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
sourcepub fn create_timeout(
wallet_handle: IndyHandle,
my_key_json: Option<&str>,
timeout: Duration
) -> Result<String, ErrorCode>
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 jsontimeout
- the maximum time this function waits for a response
Example
my_key_json { “seed”: string, (optional) Seed that allows deterministic key creation (if not set random one will be created). Can be UTF-8, base64 or hex string. “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
sourcepub fn create_async<F: 'static>(
wallet_handle: IndyHandle,
my_key_json: Option<&str>,
closure: F
) -> ErrorCodewhere
F: FnMut(ErrorCode, String) + Send,
pub fn create_async<F: 'static>(
wallet_handle: IndyHandle,
my_key_json: Option<&str>,
closure: F
) -> ErrorCodewhere
F: FnMut(ErrorCode, String) + Send,
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) Seed that allows deterministic key creation (if not set random one will be created). Can be UTF-8, base64 or hex string. “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
sourcepub fn set_metadata(
wallet_handle: IndyHandle,
verkey: &str,
metadata: &str
) -> Result<(), ErrorCode>
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 metadatametadata
- the metadata that will be stored with the key, can be empty string
sourcepub fn set_metadata_timeout(
wallet_handle: IndyHandle,
verkey: &str,
metadata: &str,
timeout: Duration
) -> Result<(), ErrorCode>
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 metadatametadata
- the metadata that will be stored with the key, can be empty stringtimeout
- the maximum time this function waits for a response
sourcepub fn set_metadata_async<F: 'static>(
wallet_handle: IndyHandle,
verkey: &str,
metadata: &str,
closure: F
) -> ErrorCodewhere
F: FnMut(ErrorCode) + Send,
pub fn set_metadata_async<F: 'static>(
wallet_handle: IndyHandle,
verkey: &str,
metadata: &str,
closure: F
) -> ErrorCodewhere
F: FnMut(ErrorCode) + Send,
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 metadatametadata
- the metadata that will be stored with the key, can be empty stringclosure
- The closure that is called when finished
sourcepub fn get_metadata(
wallet_handle: IndyHandle,
verkey: &str
) -> Result<String, ErrorCode>
pub fn get_metadata(
wallet_handle: IndyHandle,
verkey: &str
) -> Result<String, ErrorCode>
sourcepub fn get_metadata_timeout(
wallet_handle: IndyHandle,
verkey: &str,
timeout: Duration
) -> Result<String, ErrorCode>
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 metadatatimeout
- 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