Struct Did

Source
pub struct Did {}

Implementations§

Source§

impl Did

Source

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

Creates keys (signing and encryption keys) for a new DID (owned by the caller of the library). Identity’s DID must be either explicitly provided, or taken as the first 16 bit of verkey. Saves the Identity DID with keys in a secured Wallet, so that it can be used to sign and encrypt transactions.

§Arguments
  • wallet_handle - wallet handler (created by Wallet::open).
  • did_json - Identity information as json.
§Examples

did_json { “did”: string, (optional; if not provided and cid param is false then the first 16 bit of the verkey will be used as a new DID; if not provided and cid is true then the full verkey will be used as a new DID; if provided, then keys will be replaced - key rotation use case) “seed”: string, (optional; if not provide then a random one will be created) “crypto_type”: string, (optional; if not set then ed25519 curve is used; currently only ‘ed25519’ value is supported for this field) “cid”: bool, (optional; if not set then false is used;) }

§Returns
  • did - DID generated and stored in the wallet
  • verkey - The DIDs verification key
Source

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

Creates keys (signing and encryption keys) for a new DID (owned by the caller of the library). Identity’s DID must be either explicitly provided, or taken as the first 16 bit of verkey. Saves the Identity DID with keys in a secured Wallet, so that it can be used to sign and encrypt transactions.

§Arguments
  • wallet_handle - wallet handler (created by Wallet::open).
  • did_json - Identity information as json.
  • timeout - the maximum time this function waits for a response
§Examples

did_json { “did”: string, (optional; if not provided and cid param is false then the first 16 bit of the verkey will be used as a new DID; if not provided and cid is true then the full verkey will be used as a new DID; if provided, then keys will be replaced - key rotation use case) “seed”: string, (optional; if not provide then a random one will be created) “crypto_type”: string, (optional; if not set then ed25519 curve is used; currently only ‘ed25519’ value is supported for this field) “cid”: bool, (optional; if not set then false is used;) }

§Returns
  • did - DID generated and stored in the wallet
  • verkey - The DIDs verification key
Source

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

Creates keys (signing and encryption keys) for a new DID (owned by the caller of the library). Identity’s DID must be either explicitly provided, or taken as the first 16 bit of verkey. Saves the Identity DID with keys in a secured Wallet, so that it can be used to sign and encrypt transactions.

§Arguments
  • wallet_handle - wallet handler (created by Wallet::open).
  • did_json - Identity information as json.
  • closure - the closure that is called when finished
§Examples

did_json { “did”: string, (optional; if not provided and cid param is false then the first 16 bit of the verkey will be used as a new DID; if not provided and cid is true then the full verkey will be used as a new DID; if provided, then keys will be replaced - key rotation use case) “seed”: string, (optional; if not provide then a random one will be created)/**/ “crypto_type”: string, (optional; if not set then ed25519 curve is used; currently only ‘ed25519’ value is supported for this field) “cid”: bool, (optional; if not set then false is used;) }

§Returns
  • errorcode - errorcode from calling ffi function. The closure receives the return result
Source

pub fn replace_keys_start( wallet_handle: IndyHandle, tgt_did: &str, identity_json: &str, ) -> Result<String, ErrorCode>

Generated temporary keys (signing and encryption keys) for an existing DID (owned by the caller of the library).

§Arguments
  • wallet_handle - wallet handler (created by Wallet::open).
  • tgt_did - DID to replace keys.
  • identity_json - Identity information as json.
§Example
  • identity_json- { “seed”: string, (optional; if not provide then a random one will be created) “crypto_type”: string, (optional; if not set then ed25519 curve is used; currently only ‘ed25519’ value is supported for this field) }
§Returns
  • verkey - The DIDs verification key
Source

pub fn replace_keys_start_timeout( wallet_handle: IndyHandle, tgt_did: &str, identity_json: &str, timeout: Duration, ) -> Result<String, ErrorCode>

Generated temporary keys (signing and encryption keys) for an existing DID (owned by the caller of the library).

§Arguments
  • wallet_handle - wallet handler (created by Wallet::open).
  • tgt_did - DID to replace keys.
  • identity_json - Identity information as json.
  • timeout - the maximum time this function waits for a response
§Example
  • identity_json- { “seed”: string, (optional; if not provide then a random one will be created) “crypto_type”: string, (optional; if not set then ed25519 curve is used; currently only ‘ed25519’ value is supported for this field) }
§Returns
  • verkey - The DIDs verification key
Source

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

Generated temporary keys (signing and encryption keys) for an existing DID (owned by the caller of the library).

§Arguments
  • wallet_handle - wallet handler (created by Wallet::open).
  • tgt_did - DID to replace keys.
  • identity_json - Identity information as json.
  • closure - the closure that is called when finished
§Example
  • identity_json- { “seed”: string, (optional; if not provide then a random one will be created) “crypto_type”: string, (optional; if not set then ed25519 curve is used; currently only ‘ed25519’ value is supported for this field) }
§Returns
  • errorcode - errorcode from calling ffi function. The closure receives the return result
Source

pub fn replace_keys_apply( wallet_handle: IndyHandle, tgt_did: &str, ) -> Result<(), ErrorCode>

Apply temporary keys as main for an existing DID (owned by the caller of the library).

§Arguments
  • wallet_handle - wallet handler (created by Wallet::open).
  • tgt_did - DID stored in the wallet
Source

pub fn replace_keys_apply_timeout( wallet_handle: IndyHandle, tgt_did: &str, timeout: Duration, ) -> Result<(), ErrorCode>

Apply temporary keys as main for an existing DID (owned by the caller of the library).

§Arguments
  • wallet_handle - wallet handler (created by Wallet::open).
  • tgt_did - DID stored in the wallet
  • timeout - the maximum time this function waits for a response
Source

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

Apply temporary keys as main for an existing DID (owned by the caller of the library).

§Arguments
  • wallet_handle - wallet handler (created by Wallet::open).
  • tgt_did - DID stored in the wallet
  • closure - the closure that is called when finished
§Returns
  • errorcode - errorcode from calling ffi function. The closure receives the return result
Source

pub fn store_their_did( wallet_handle: IndyHandle, identity_json: &str, ) -> Result<(), ErrorCode>

Saves their DID for a pairwise connection in a secured Wallet, so that it can be used to verify transaction.

§Arguments
  • wallet_handle - wallet handler (created by Wallet::open).
  • identity_json - Identity information as json.
§Example:
  • identity_json { “did”: string, (required) “verkey”: string (optional, can be avoided if did is cryptonym: did == verkey), }
Source

pub fn store_their_did_timeout( wallet_handle: IndyHandle, identity_json: &str, timeout: Duration, ) -> Result<(), ErrorCode>

Saves their DID for a pairwise connection in a secured Wallet, so that it can be used to verify transaction.

§Arguments
  • wallet_handle - wallet handler (created by Wallet::open).
  • identity_json - Identity information as json.
  • timeout - the maximum time this function waits for a response
§Example:
  • identity_json { “did”: string, (required) “verkey”: string (optional, can be avoided if did is cryptonym: did == verkey), }
Source

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

Saves their DID for a pairwise connection in a secured Wallet, so that it can be used to verify transaction.

§Arguments
  • wallet_handle - wallet handler (created by Wallet::open).
  • identity_json - Identity information as json.
  • closure - the closure that is called when finished
§Example:
  • identity_json { “did”: string, (required) “verkey”: string (optional, can be avoided if did is cryptonym: did == verkey), }
§Returns
  • errorcode - errorcode from calling ffi function. The closure receives the return result
Source

pub fn get_ver_key( pool_handle: IndyHandle, wallet_handle: IndyHandle, did: &str, ) -> Result<String, ErrorCode>

Returns ver key (key id) for the given DID.

“Did::get_ver_key” call follow the idea that we resolve information about their DID from the ledger with cache in the local wallet. The “indy_Wallet::open” call has freshness parameter that is used for checking the freshness of cached pool value.

Note if you don’t want to resolve their DID info from the ledger you can use “Did::get_ver_key” call instead that will look only to the local wallet and skip freshness checking.

Note that “Did::new” makes similar wallet record as “Key::create”. As result we can use returned ver key in all generic crypto and messaging functions.

§Arguments
  • pool_handle - Pool handle (created by Pool::open).
  • wallet_handle - Wallet handle (created by Wallet::open).
  • did - The DID to resolve key.
§Returns
  • key - The DIDs ver key (key id).
Source

pub fn get_ver_key_timeout( pool_handle: IndyHandle, wallet_handle: IndyHandle, did: &str, timeout: Duration, ) -> Result<String, ErrorCode>

Returns ver key (key id) for the given DID.

“Did::get_ver_key” call follow the idea that we resolve information about their DID from the ledger with cache in the local wallet. The “indy_Wallet::open” call has freshness parameter that is used for checking the freshness of cached pool value.

Note if you don’t want to resolve their DID info from the ledger you can use “Did::get_ver_key” call instead that will look only to the local wallet and skip freshness checking.

Note that “Did::new” makes similar wallet record as “Key::create”. As result we can use returned ver key in all generic crypto and messaging functions.

§Arguments
  • pool_handle - Pool handle (created by Pool::open).
  • wallet_handle - Wallet handle (created by Wallet::open).
  • did - The DID to resolve key.
  • timeout - the maximum time this function waits for a response
§Returns
  • key - The DIDs ver key (key id).
Source

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

Returns ver key (key id) for the given DID.

“Did::get_ver_key” call follow the idea that we resolve information about their DID from the ledger with cache in the local wallet. The “indy_Wallet::open” call has freshness parameter that is used for checking the freshness of cached pool value.

Note if you don’t want to resolve their DID info from the ledger you can use “Did::get_ver_key” call instead that will look only to the local wallet and skip freshness checking.

Note that “Did::new” makes similar wallet record as “Key::create”. As result we can use returned ver key in all generic crypto and messaging functions.

§Arguments
  • pool_handle - Pool handle (created by Pool::open).
  • wallet_handle - Wallet handle (created by Wallet::open).
  • did - The DID to resolve key.
  • closure - the closure that is called when finished
§Returns
  • errorcode - errorcode from calling ffi function. The closure receives the return result
Source

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

Returns ver key (key id) for the given DID.

“Did::get_ver_key_did” call looks data stored in the local wallet only and skips freshness checking.

Note if you want to get fresh data from the ledger you can use “Did::get_ver_key” call instead.

Note that “Did::new” makes similar wallet record as “Key::create”. As result we can use returned ver key in all generic crypto and messaging functions.

§Arguments
  • wallet_handle - Wallet handle (created by Wallet::open).
  • did - The DID to resolve key.
§Returns
  • key - The DIDs ver key (key id).
Source

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

Returns ver key (key id) for the given DID.

“Did::get_ver_key_did” call looks data stored in the local wallet only and skips freshness checking.

Note if you want to get fresh data from the ledger you can use “Did::get_ver_key” call instead.

Note that “Did::new” makes similar wallet record as “Key::create”. As result we can use returned ver key in all generic crypto and messaging functions.

§Arguments
  • wallet_handle - Wallet handle (created by Wallet::open).
  • did - The DID to resolve key.
  • timeout - the maximum time this function waits for a response
§Returns
  • key - The DIDs ver key (key id).
Source

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

Returns ver key (key id) for the given DID.

“Did::get_ver_key_did” call looks data stored in the local wallet only and skips freshness checking.

Note if you want to get fresh data from the ledger you can use “Did::get_ver_key” call instead.

Note that “Did::new” makes similar wallet record as “Key::create”. As result we can use returned ver key in all generic crypto and messaging functions.

§Arguments
  • wallet_handle - Wallet handle (created by Wallet::open).
  • did - The DID to resolve key.
  • closure - the closure that is called when finished
§Returns
  • errorcode - errorcode from calling ffi function. The closure receives the return result
Source

pub fn set_endpoint( wallet_handle: IndyHandle, did: &str, address: &str, transport_key: &str, ) -> Result<(), ErrorCode>

Set/replaces endpoint information for the given DID.

§Arguments
  • wallet_handle - Wallet handle (created by Wallet::open).
  • did - The DID to resolve endpoint.
  • address - The DIDs endpoint address.
  • transport_key - The DIDs transport key (ver key, key id).
Source

pub fn set_endpoint_timeout( wallet_handle: IndyHandle, did: &str, address: &str, transport_key: &str, timeout: Duration, ) -> Result<(), ErrorCode>

Set/replaces endpoint information for the given DID.

§Arguments
  • wallet_handle - Wallet handle (created by Wallet::open).
  • did - The DID to resolve endpoint.
  • address - The DIDs endpoint address.
  • transport_key - The DIDs transport key (ver key, key id).
  • timeout - the maximum time this function waits for a response
Source

pub fn set_endpoint_async<F>( wallet_handle: IndyHandle, did: &str, address: &str, transport_key: &str, closure: F, ) -> ErrorCode
where F: FnMut(ErrorCode) + Send + 'static,

Set/replaces endpoint information for the given DID.

§Arguments
  • wallet_handle - Wallet handle (created by Wallet::open).
  • did - The DID to resolve endpoint.
  • address - The DIDs endpoint address.
  • transport_key - The DIDs transport key (ver key, key id).
  • closure - the closure that is called when finished
§Returns
  • errorcode - errorcode from calling ffi function. The closure receives the return result
Source

pub fn get_endpoint( wallet_handle: IndyHandle, pool_handle: IndyHandle, did: &str, ) -> Result<(String, Option<String>), ErrorCode>

Returns endpoint information for the given DID.

§Arguments
  • wallet_handle - Wallet handle (created by Wallet::open).
  • did - The DID to resolve endpoint.
§Returns
  • endpoint - The DIDs endpoint.
  • transport_vk - The DIDs transport key (ver key, key id).
Source

pub fn get_endpoint_timeout( wallet_handle: IndyHandle, pool_handle: IndyHandle, did: &str, timeout: Duration, ) -> Result<(String, Option<String>), ErrorCode>

Returns endpoint information for the given DID.

§Arguments
  • wallet_handle - Wallet handle (created by Wallet::open).
  • did - The DID to resolve endpoint.
  • timeout - the maximum time this function waits for a response
§Returns
  • endpoint - The DIDs endpoint.
  • transport_vk - The DIDs transport key (ver key, key id).
Source

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

Returns endpoint information for the given DID.

§Arguments
  • wallet_handle - Wallet handle (created by Wallet::open).
  • did - The DID to resolve endpoint.
  • closure - the closure that is called when finished
§Returns
  • errorcode - errorcode from calling ffi function. The closure receives the return result
Source

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

Saves/replaces the meta information for the giving DID in the wallet.

§Arguments
  • wallet_handle - Wallet handle (created by Wallet::open).
  • did - the DID to store metadata.
  • metadata - the meta information that will be store with the DID.
Source

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

Saves/replaces the meta information for the giving DID in the wallet.

§Arguments
  • wallet_handle - Wallet handle (created by Wallet::open).
  • did - the DID to store metadata.
  • metadata - the meta information that will be store with the DID.
  • timeout - the maximum time this function waits for a response
Source

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

Saves/replaces the meta information for the giving DID in the wallet.

§Arguments
  • wallet_handle - Wallet handle (created by Wallet::open).
  • did - the DID to store metadata.
  • metadata - the meta information that will be store with the DID.
  • closure - the closure that is called when finished
§Returns
  • errorcode - errorcode from calling ffi function. The closure receives the return result
Source

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

Retrieves the meta information for the giving DID in the wallet.

§Arguments
  • wallet_handle - Wallet handle (created by Wallet::open).
  • did - The DID to retrieve metadata.

#Returns

  • metadata - The meta information stored with the DID; Can be null if no metadata was saved for this DID.
Source

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

Retrieves the meta information for the giving DID in the wallet.

§Arguments
  • wallet_handle - Wallet handle (created by Wallet::open).
  • did - The DID to retrieve metadata.
  • timeout - the maximum time this function waits for a response

#Returns

  • metadata - The meta information stored with the DID; Can be null if no metadata was saved for this DID.
Source

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

Retrieves the meta information for the giving DID in the wallet.

§Arguments
  • wallet_handle - Wallet handle (created by Wallet::open).
  • did - The DID to retrieve metadata.
  • closure - the closure that is called when finished
§Returns
  • errorcode - errorcode from calling ffi function. The closure receives the return result
Source

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

Retrieves the information about the giving DID in the wallet.

§Arguments
  • wallet_handle - Wallet handle (created by Wallet::open).
  • did - The DID to retrieve information.
§Returns
  • did_with_meta - { “did”: string - DID stored in the wallet, “verkey”: string - The DIDs transport key (ver key, key id), “metadata”: string - The meta information stored with the DID }
Source

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

Retrieves the information about the giving DID in the wallet.

§Arguments
  • wallet_handle - Wallet handle (created by Wallet::open).
  • did - The DID to retrieve information.
  • timeout - the maximum time this function waits for a response
§Returns
  • did_with_meta - { “did”: string - DID stored in the wallet, “verkey”: string - The DIDs transport key (ver key, key id), “metadata”: string - The meta information stored with the DID }
Source

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

Retrieves the information about the giving DID in the wallet.

§Arguments
  • wallet_handle - Wallet handle (created by Wallet::open).
  • did - The DID to retrieve information.
  • closure - the closure that is called when finished
§Returns
  • errorcode - errorcode from calling ffi function. The closure receives the return result
Source

pub fn list_with_metadata( wallet_handle: IndyHandle, ) -> Result<String, ErrorCode>

Retrieves the information about all DIDs stored in the wallet.

§Arguments
  • wallet_handle - Wallet handle (created by Wallet::open).
§Returns
  • dids - [{ “did”: string - DID stored in the wallet, “verkey”: string - The DIDs transport key (ver key, key id)., “metadata”: string - The meta information stored with the DID }]
Source

pub fn list_with_metadata_timeout( wallet_handle: IndyHandle, timeout: Duration, ) -> Result<String, ErrorCode>

Retrieves the information about all DIDs stored in the wallet.

§Arguments
  • wallet_handle - Wallet handle (created by Wallet::open).
  • timeout - the maximum time this function waits for a response
§Returns
  • dids - [{ “did”: string - DID stored in the wallet, “verkey”: string - The DIDs transport key (ver key, key id)., “metadata”: string - The meta information stored with the DID }]
Source

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

Retrieves the information about all DIDs stored in the wallet.

§Arguments
  • wallet_handle - Wallet handle (created by Wallet::open).
  • closure - the closure that is called when finished
§Returns
  • errorcode - errorcode from calling ffi function. The closure receives the return result
Source

pub fn abbreviate_verkey( tgt_did: &str, verkey: &str, ) -> Result<String, ErrorCode>

Retrieves abbreviated verkey if it is possible otherwise return full verkey.

§Arguments
  • tgt_did - DID.
  • full_verkey - The DIDs verification key,

#Returns

  • verkey - The DIDs verification key in either abbreviated or full form
Source

pub fn abbreviate_verkey_timeout( tgt_did: &str, verkey: &str, timeout: Duration, ) -> Result<String, ErrorCode>

Retrieves abbreviated verkey if it is possible otherwise return full verkey.

§Arguments
  • tgt_did - DID.
  • full_verkey - The DIDs verification key,
  • timeout - the maximum time this function waits for a response

#Returns

  • verkey - The DIDs verification key in either abbreviated or full form
Source

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

Retrieves abbreviated verkey if it is possible otherwise return full verkey.

§Arguments
  • tgt_did - DID.
  • full_verkey - The DIDs verification key,
  • closure - the closure that is called when finished
§Returns
  • errorcode - errorcode from calling ffi function. The closure receives the return result

Auto Trait Implementations§

§

impl Freeze for Did

§

impl RefUnwindSafe for Did

§

impl Send for Did

§

impl Sync for Did

§

impl Unpin for Did

§

impl UnwindSafe for Did

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.