aries_cloudagent.wallet package¶
Abstract and Indy wallet handling.
Subpackages¶
Submodules¶
aries_cloudagent.wallet.base module¶
Wallet base class.
-
class
aries_cloudagent.wallet.base.
BaseWallet
(config: dict)[source]¶ Bases:
abc.ABC
Abstract wallet interface.
-
WALLET_TYPE
= None¶
-
create_local_did
(seed: str = None, did: str = None, metadata: dict = None) → aries_cloudagent.wallet.base.DIDInfo[source]¶ Create and store a new local DID.
Parameters: - seed – Optional seed to use for did
- did – The DID to use
- metadata – Metadata to store with DID
Returns: The created DIDInfo
-
create_pairwise
(their_did: str, their_verkey: str, my_did: str = None, metadata: dict = None) → aries_cloudagent.wallet.base.PairwiseInfo[source]¶ Create a new pairwise DID for a secure connection.
Parameters: - their_did – Their DID
- their_verkey – Their verkey
- my_did – My DID
- metadata – Metadata for relationship
Returns: A PairwiseInfo instance representing the new relationship
-
create_public_did
(seed: str = None, did: str = None, metadata: dict = {}) → aries_cloudagent.wallet.base.DIDInfo[source]¶ Create and store a new public DID.
Implicitly flags all other dids as not public.
Parameters: - seed – Optional seed to use for did
- did – The DID to use
- metadata – Metadata to store with DID
Returns: The created DIDInfo
-
create_signing_key
(seed: str = None, metadata: dict = None) → aries_cloudagent.wallet.base.KeyInfo[source]¶ Create a new public/private signing keypair.
Parameters: - seed – Optional seed allowing deterministic key creation
- metadata – Optional metadata to store with the keypair
Returns: A KeyInfo representing the new record
-
created
¶ Check whether the wallet was created on the last open call.
-
decrypt_message
(enc_message: bytes, to_verkey: str, use_auth: bool) -> (<class 'bytes'>, <class 'str'>)[source]¶ Decrypt a message assembled by auth_crypt or anon_crypt.
Parameters: - enc_message – The encrypted message content
- to_verkey – The verkey of the recipient. If provided then auth_decrypt is used, otherwise anon_decrypt is used.
Returns: - A tuple of the decrypted message content and sender verkey
(None for anon_crypt)
-
encrypt_message
(message: bytes, to_verkey: str, from_verkey: str = None) → bytes[source]¶ Apply auth_crypt or anon_crypt to a message.
Parameters: - message – The binary message content
- to_verkey – The verkey of the recipient
- from_verkey – The verkey of the sender. If provided then auth_crypt is used, otherwise anon_crypt is used.
Returns: The encrypted message content
-
get_local_did
(did: str) → aries_cloudagent.wallet.base.DIDInfo[source]¶ Find info for a local DID.
Parameters: did – The DID to get info for Returns: A DIDInfo instance for the DID
-
get_local_did_for_verkey
(verkey: str) → aries_cloudagent.wallet.base.DIDInfo[source]¶ Resolve a local DID from a verkey.
Parameters: verkey – Verkey to get DID info for Returns: A DIDInfo instance for the DID
-
get_local_dids
() → Sequence[aries_cloudagent.wallet.base.DIDInfo][source]¶ Get list of defined local DIDs.
Returns: A list of DIDInfo instances
-
get_pairwise_for_did
(their_did: str) → aries_cloudagent.wallet.base.PairwiseInfo[source]¶ Find info for a pairwise DID.
Parameters: their_did – The DID representing the relationship Returns: A PairwiseInfo instance representing the relationship
-
get_pairwise_for_verkey
(their_verkey: str) → aries_cloudagent.wallet.base.PairwiseInfo[source]¶ Resolve a pairwise DID from a verkey.
Parameters: their_verkey – The verkey representing the relationship Returns: A PairwiseInfo instance representing the relationship
-
get_pairwise_list
() → Sequence[aries_cloudagent.wallet.base.PairwiseInfo][source]¶ Get list of defined pairwise DIDs.
Returns: A list of PairwiseInfo instances for all relationships
-
get_public_did
() → aries_cloudagent.wallet.base.DIDInfo[source]¶ Retrieve the public did.
Returns: The created DIDInfo
-
get_signing_key
(verkey: str) → aries_cloudagent.wallet.base.KeyInfo[source]¶ Fetch info for a signing keypair.
Parameters: verkey – The verification key of the keypair Returns: A KeyInfo representing the keypair
-
handle
¶ Get internal wallet reference.
Returns: Defaults to None
-
name
¶ Accessor for the wallet name.
Returns: Defaults to None
-
opened
¶ Check whether wallet is currently open.
Returns: Defaults to False
-
pack_message
(message: str, to_verkeys: Sequence[str], from_verkey: str = None) → bytes[source]¶ Pack a message for one or more recipients.
Parameters: - message – The message to pack
- to_verkeys – The verkeys to pack the message for
- from_verkey – The sender verkey
Returns: The packed message
-
replace_local_did_metadata
(did: str, metadata: dict)[source]¶ Replace the metadata associated with a local DID.
Parameters: - did – DID to replace metadata for
- metadata – The new metadata
-
replace_pairwise_metadata
(their_did: str, metadata: dict)[source]¶ Replace the metadata associated with a pairwise DID.
Parameters: - their_did – The did representing the relationship
- metadata – The new metadata
-
replace_signing_key_metadata
(verkey: str, metadata: dict)[source]¶ Replace the metadata associated with a signing keypair.
Parameters: - verkey – The verification key of the keypair
- metadata – The new metadata to store
-
set_public_did
(did: str) → aries_cloudagent.wallet.base.DIDInfo[source]¶ Assign the public did.
Returns: The created DIDInfo
-
sign_message
(message: bytes, from_verkey: str) → bytes[source]¶ Sign a message using the private key associated with a given verkey.
Parameters: - message – The message to sign
- from_verkey – Sign using the private key related to this verkey
Returns: The signature
-
type
¶ Accessor for the wallet type.
Returns: Defaults to None
-
unpack_message
(enc_message: bytes) -> (<class 'str'>, <class 'str'>, <class 'str'>)[source]¶ Unpack a message.
Parameters: enc_message – The encrypted message Returns: (message, from_verkey, to_verkey) Return type: A tuple
-
verify_message
(message: bytes, signature: bytes, from_verkey: str) → bool[source]¶ Verify a signature against the public key of the signer.
Parameters: - message – The message to verify
- signature – The signature to verify
- from_verkey – Verkey to use in verification
Returns: True if verified, else False
-
-
class
aries_cloudagent.wallet.base.
DIDInfo
(did, verkey, metadata)¶ Bases:
tuple
-
did
¶ Alias for field number 0
-
metadata
¶ Alias for field number 2
-
verkey
¶ Alias for field number 1
-
aries_cloudagent.wallet.basic module¶
In-memory implementation of BaseWallet interface.
-
class
aries_cloudagent.wallet.basic.
BasicWallet
(config: dict = None)[source]¶ Bases:
aries_cloudagent.wallet.base.BaseWallet
In-memory wallet implementation.
-
WALLET_TYPE
= 'basic'¶
-
create_local_did
(seed: str = None, did: str = None, metadata: dict = None) → aries_cloudagent.wallet.base.DIDInfo[source]¶ Create and store a new local DID.
Parameters: - seed – Optional seed to use for did
- did – The DID to use
- metadata – Metadata to store with DID
Returns: A DIDInfo instance representing the created DID
Raises: WalletDuplicateError
– If the DID already exists in the wallet
-
create_pairwise
(their_did: str, their_verkey: str, my_did: str = None, metadata: dict = None) → aries_cloudagent.wallet.base.PairwiseInfo[source]¶ Create a new pairwise DID for a secure connection.
Parameters: - their_did – The other party’s DID
- their_verkey – The other party’s verkey
- my_did – My DID
- metadata – Metadata to store with this relationship
Returns: A PairwiseInfo object representing the pairwise connection
Raises: WalletDuplicateError
– If the DID already exists in the wallet
-
create_signing_key
(seed: str = None, metadata: dict = None) → aries_cloudagent.wallet.base.KeyInfo[source]¶ Create a new public/private signing keypair.
Parameters: - seed – Seed to use for signing key
- metadata – Optional metadata to store with the keypair
Returns: A KeyInfo representing the new record
Raises: WalletDuplicateError
– If the resulting verkey already exists in the wallet
-
created
¶ Check whether the wallet was created on the last open call.
-
decrypt_message
(enc_message: bytes, to_verkey: str, use_auth: bool) -> (<class 'bytes'>, <class 'str'>)[source]¶ Decrypt a message assembled by auth_crypt or anon_crypt.
Parameters: - message – The encrypted message content
- to_verkey – The verkey of the recipient. If provided then auth_decrypt is used, otherwise anon_decrypt is used.
- use_auth – True if you would like to auth_decrypt, False for anon_decrypt
Returns: A tuple of the decrypted message content and sender verkey (None for anon_crypt)
-
encrypt_message
(message: bytes, to_verkey: str, from_verkey: str = None) → bytes[source]¶ Apply auth_crypt or anon_crypt to a message.
Parameters: - message – The binary message content
- to_verkey – The verkey of the recipient
- from_verkey – The verkey of the sender. If provided then auth_crypt is used, otherwise anon_crypt is used.
Returns: The encrypted message content
-
get_local_did
(did: str) → aries_cloudagent.wallet.base.DIDInfo[source]¶ Find info for a local DID.
Parameters: did – The DID to get info for Returns: A DIDInfo instance representing the found DID Raises: WalletNotFoundError
– If the DID is not found
-
get_local_did_for_verkey
(verkey: str) → aries_cloudagent.wallet.base.DIDInfo[source]¶ Resolve a local DID from a verkey.
Parameters: verkey – The verkey to get the local DID for Returns: A DIDInfo instance representing the found DID Raises: WalletNotFoundError
– If the verkey is not found
-
get_local_dids
() → Sequence[aries_cloudagent.wallet.base.DIDInfo][source]¶ Get list of defined local DIDs.
Returns: A list of locally stored DIDs as DIDInfo instances
-
get_pairwise_for_did
(their_did: str) → aries_cloudagent.wallet.base.PairwiseInfo[source]¶ Find info for a pairwise DID.
Parameters: their_did – The DID to get a pairwise relationship for Returns: A PairwiseInfo instance representing the relationship Raises: WalletNotFoundError
– If the DID is unknown
-
get_pairwise_for_verkey
(their_verkey: str) → aries_cloudagent.wallet.base.PairwiseInfo[source]¶ Resolve a pairwise DID from a verkey.
Parameters: their_verkey – The verkey to get a pairwise relationship for Returns: A PairwiseInfo instance for the relationship Raises: WalletNotFoundError
– If the verkey is not found
-
get_pairwise_list
() → Sequence[aries_cloudagent.wallet.base.PairwiseInfo][source]¶ Get list of defined pairwise DIDs.
Returns: A list of PairwiseInfo instances for all pairwise relationships
-
get_signing_key
(verkey: str) → aries_cloudagent.wallet.base.KeyInfo[source]¶ Fetch info for a signing keypair.
Parameters: verkey – The verification key of the keypair Returns: A KeyInfo representing the keypair Raises: WalletNotFoundError
– if no keypair is associated with the verification key
-
name
¶ Accessor for the wallet name.
-
opened
¶ Check whether wallet is currently open.
Returns: True
-
pack_message
(message: str, to_verkeys: Sequence[str], from_verkey: str = None) → bytes[source]¶ Pack a message for one or more recipients.
Parameters: - message – The message to pack
- to_verkeys – List of verkeys to pack for
- from_verkey – Sender verkey to pack from
Returns: The resulting packed message bytes
-
replace_local_did_metadata
(did: str, metadata: dict)[source]¶ Replace metadata for a local DID.
Parameters: - did – The DID to replace metadata for
- metadata – The new metadata
Raises: WalletNotFoundError
– If the DID doesn’t exist
-
replace_pairwise_metadata
(their_did: str, metadata: dict)[source]¶ Replace metadata for a pairwise DID.
Parameters: - their_did – The DID to replace metadata for
- metadata – The new metadata
Raises: WalletNotFoundError
– If the DID is unknown
-
replace_signing_key_metadata
(verkey: str, metadata: dict)[source]¶ Replace the metadata associated with a signing keypair.
Parameters: - verkey – The verification key of the keypair
- metadata – The new metadata to store
Raises: WalletNotFoundError
– if no keypair is associated with the verification key
-
sign_message
(message: bytes, from_verkey: str) → bytes[source]¶ Sign a message using the private key associated with a given verkey.
Parameters: - message – Message bytes to sign
- from_verkey – The verkey to use to sign
Returns: A signature
Raises: WalletError
– If the message is not providedWalletError
– If the verkey is not provided
-
unpack_message
(enc_message: bytes) -> (<class 'str'>, <class 'str'>, <class 'str'>)[source]¶ Unpack a message.
Parameters: enc_message – The packed message bytes
Returns: (message, from_verkey, to_verkey)
Return type: A tuple
Raises: WalletError
– If the message is not providedWalletError
– If there is a problem unpacking the message
-
verify_message
(message: bytes, signature: bytes, from_verkey: str) → bool[source]¶ Verify a signature against the public key of the signer.
Parameters: - message – Message to verify
- signature – Signature to verify
- from_verkey – Verkey to use in verification
Returns: True if verified, else False
Raises: WalletError
– If the verkey is not providedWalletError
– If the signature is not providedWalletError
– If the message is not provided
-
aries_cloudagent.wallet.crypto module¶
Cryptography functions used by BasicWallet.
-
class
aries_cloudagent.wallet.crypto.
PackMessageSchema
(*args, **kwargs)[source]¶ Bases:
sphinx.ext.autodoc.importer._MockObject
Packed message schema.
-
ciphertext
¶ Used by autodoc_mock_imports.
-
iv
¶ Used by autodoc_mock_imports.
-
protected
¶ Used by autodoc_mock_imports.
-
tag
¶ Used by autodoc_mock_imports.
-
-
class
aries_cloudagent.wallet.crypto.
PackRecipientHeaderSchema
(*args, **kwargs)[source]¶ Bases:
sphinx.ext.autodoc.importer._MockObject
Packed recipient header schema.
-
iv
¶ Used by autodoc_mock_imports.
-
kid
¶ Used by autodoc_mock_imports.
-
sender
¶ Used by autodoc_mock_imports.
-
-
class
aries_cloudagent.wallet.crypto.
PackRecipientSchema
(*args, **kwargs)[source]¶ Bases:
sphinx.ext.autodoc.importer._MockObject
Packed recipient schema.
-
encrypted_key
¶ Used by autodoc_mock_imports.
-
header
¶ Used by autodoc_mock_imports.
-
-
class
aries_cloudagent.wallet.crypto.
PackRecipientsSchema
(*args, **kwargs)[source]¶ Bases:
sphinx.ext.autodoc.importer._MockObject
Packed recipients schema.
-
alg
¶ Used by autodoc_mock_imports.
-
enc
¶ Used by autodoc_mock_imports.
-
recipients
¶ Used by autodoc_mock_imports.
-
typ
¶ Used by autodoc_mock_imports.
-
-
aries_cloudagent.wallet.crypto.
anon_crypt_message
(message: bytes, to_verkey: bytes) → bytes[source]¶ Apply anon_crypt to a binary message.
Parameters: - message – The message to encrypt
- to_verkey – The verkey to encrypt the message for
Returns: The anon encrypted message
-
aries_cloudagent.wallet.crypto.
anon_decrypt_message
(enc_message: bytes, secret: bytes) → bytes[source]¶ Apply anon_decrypt to a binary message.
Parameters: - enc_message – The encrypted message
- secret – The seed to use
Returns: The decrypted message
-
aries_cloudagent.wallet.crypto.
auth_crypt_message
(message: bytes, to_verkey: bytes, from_secret: bytes) → bytes[source]¶ Apply auth_crypt to a binary message.
Parameters: - message – The message to encrypt
- to_verkey – To recipient’s verkey
- from_secret – The seed to use
Returns: The encrypted message
-
aries_cloudagent.wallet.crypto.
auth_decrypt_message
(enc_message: bytes, secret: bytes) -> (<class 'bytes'>, <class 'str'>)[source]¶ Apply auth_decrypt to a binary message.
Parameters: - enc_message – The encrypted message
- secret – Secret for signing keys
Returns: A tuple of (decrypted message, sender verkey)
-
aries_cloudagent.wallet.crypto.
create_keypair
(seed: bytes = None) -> (<class 'bytes'>, <class 'bytes'>)[source]¶ Create a public and private signing keypair from a seed value.
Parameters: seed – Seed for keypair Returns: A tuple of (public key, secret key)
-
aries_cloudagent.wallet.crypto.
decode_pack_message
(enc_message: bytes, find_key: Callable) -> (<class 'str'>, typing.Union[str, NoneType], <class 'str'>)[source]¶ Decode a packed message.
Disassemble and unencrypt a packed message, returning the message content, verification key of the sender (if available), and verification key of the recipient.
Parameters: - enc_message – The encrypted message
- find_key – Function to retrieve private key
Returns: A tuple of (message, sender_vk, recip_vk)
Raises: ValueError
– If the packed message is invalidValueError
– If the packed message reipients are invalidValueError
– If the pack algorithm is unsupportedValueError
– If the sender’s public key was not provided
-
aries_cloudagent.wallet.crypto.
decrypt_plaintext
(ciphertext: bytes, recips_bin: bytes, nonce: bytes, key: bytes) → str[source]¶ Decrypt the payload of a packed message.
Parameters: - ciphertext –
- recips_bin –
- nonce –
- key –
Returns: The decrypted string
-
aries_cloudagent.wallet.crypto.
encode_pack_message
(message: str, to_verkeys: Sequence[bytes], from_secret: bytes = None) → bytes[source]¶ Assemble a packed message for a set of recipients, optionally including the sender.
Parameters: - message – The message to pack
- to_verkeys – The verkeys to pack the message for
- from_secret – The sender secret
Returns: The encoded message
-
aries_cloudagent.wallet.crypto.
encrypt_plaintext
(message: str, add_data: bytes, key: bytes) -> (<class 'bytes'>, <class 'bytes'>, <class 'bytes'>)[source]¶ Encrypt the payload of a packed message.
Parameters: - message – Message to encrypt
- add_data –
- key – Key used for encryption
Returns: A tuple of (ciphertext, nonce, tag)
-
aries_cloudagent.wallet.crypto.
locate_pack_recipient_key
(recipients: Sequence[dict], find_key: Callable) -> (<class 'bytes'>, <class 'str'>, <class 'str'>)[source]¶ Locate pack recipient key.
Decode the encryption key and sender verification key from a corresponding recipient block, if any is defined.
Parameters: - recipients – Recipients to locate
- find_key – Function used to find private key
Returns: A tuple of (cek, sender_vk, recip_vk_b58)
Raises: ValueError
– If no corresponding recipient key found
-
aries_cloudagent.wallet.crypto.
prepare_pack_recipient_keys
(to_verkeys: Sequence[bytes], from_secret: bytes = None) -> (<class 'str'>, <class 'bytes'>)[source]¶ Assemble the recipients block of a packed message.
Parameters: - to_verkeys – Verkeys of recipients
- from_secret – Secret to use for signing keys
Returns: A tuple of (json result, key)
-
aries_cloudagent.wallet.crypto.
random_seed
() → bytes[source]¶ Generate a random seed value.
Returns: A new random seed
-
aries_cloudagent.wallet.crypto.
seed_to_did
(seed: str) → str[source]¶ Derive a did from a seed value.
Parameters: seed – The seed to derive Returns: The did derived from the seed
-
aries_cloudagent.wallet.crypto.
sign_message
(message: bytes, secret: bytes) → bytes[source]¶ Sign a message using a private signing key.
Parameters: - message – The message to sign
- secret – The private signing key
Returns: The signature
aries_cloudagent.wallet.error module¶
Wallet-related exceptions.
-
exception
aries_cloudagent.wallet.error.
WalletDuplicateError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.wallet.error.WalletError
Duplicate record exception.
-
exception
aries_cloudagent.wallet.error.
WalletError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.error.BaseError
General wallet exception.
-
exception
aries_cloudagent.wallet.error.
WalletNotFoundError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.wallet.error.WalletError
Record not found exception.
aries_cloudagent.wallet.indy module¶
Indy implementation of BaseWallet interface.
-
class
aries_cloudagent.wallet.indy.
IndyWallet
(config: dict = None)[source]¶ Bases:
aries_cloudagent.wallet.base.BaseWallet
Indy wallet implementation.
-
DEFAULT_FRESHNESS
= 0¶
-
DEFAULT_KEY
= ''¶
-
DEFAULT_NAME
= 'default'¶
-
DEFAULT_STORAGE_TYPE
= None¶
-
WALLET_TYPE
= 'indy'¶
-
create
(replace: bool = False)[source]¶ Create a new wallet.
Parameters: replace – Removes the old wallet if True
Raises: WalletError
– If there was a problem removing the walletWalletError
– IF there was a libindy error
-
create_local_did
(seed: str = None, did: str = None, metadata: dict = None) → aries_cloudagent.wallet.base.DIDInfo[source]¶ Create and store a new local DID.
Parameters: - seed – Optional seed to use for did
- did – The DID to use
- metadata – Metadata to store with DID
Returns: A DIDInfo instance representing the created DID
Raises: WalletDuplicateError
– If the DID already exists in the walletWalletError
– If there is a libindy error
-
create_pairwise
(their_did: str, their_verkey: str, my_did: str = None, metadata: dict = None) → aries_cloudagent.wallet.base.PairwiseInfo[source]¶ Create a new pairwise DID for a secure connection.
Parameters: - their_did – The other party’s DID
- their_verkey – The other party’s verkey
- my_did – My DID
- metadata – Metadata to store with this relationship
Returns: A PairwiseInfo object representing the pairwise connection
Raises: WalletError
– If there is a libindy errorWalletDuplicateError
– If the DID already exists in the wallet
-
create_signing_key
(seed: str = None, metadata: dict = None) → aries_cloudagent.wallet.base.KeyInfo[source]¶ Create a new public/private signing keypair.
Parameters: - seed – Seed for key
- metadata – Optional metadata to store with the keypair
Returns: A KeyInfo representing the new record
Raises: WalletDuplicateError
– If the resulting verkey already exists in the walletWalletError
– If there is a libindy error
-
created
¶ Check whether the wallet was created on the last open call.
-
decrypt_message
(enc_message: bytes, to_verkey: str, use_auth: bool) -> (<class 'bytes'>, <class 'str'>)[source]¶ Decrypt a message assembled by auth_crypt or anon_crypt.
Parameters: - message – The encrypted message content
- to_verkey – The verkey of the recipient. If provided then auth_decrypt is used, otherwise anon_decrypt is used.
- use_auth – True if you would like to auth_decrypt, False for anon_decrypt
Returns: A tuple of the decrypted message content and sender verkey (None for anon_crypt)
Raises: WalletError
– If a libindy error occurs
-
encrypt_message
(message: bytes, to_verkey: str, from_verkey: str = None) → bytes[source]¶ Apply auth_crypt or anon_crypt to a message.
Parameters: - message – The binary message content
- to_verkey – The verkey of the recipient
- from_verkey – The verkey of the sender. If provided then auth_crypt is used, otherwise anon_crypt is used.
Returns: The encrypted message content
Raises: WalletError
– If a libindy error occurs
-
get_local_did
(did: str) → aries_cloudagent.wallet.base.DIDInfo[source]¶ Find info for a local DID.
Parameters: did – The DID to get info for
Returns: A DIDInfo instance representing the found DID
Raises: WalletNotFoundError
– If the DID is not foundWalletError
– If there is a libindy error
-
get_local_did_for_verkey
(verkey: str) → aries_cloudagent.wallet.base.DIDInfo[source]¶ Resolve a local DID from a verkey.
Parameters: verkey – The verkey to get the local DID for Returns: A DIDInfo instance representing the found DID Raises: WalletNotFoundError
– If the verkey is not found
-
get_local_dids
() → Sequence[aries_cloudagent.wallet.base.DIDInfo][source]¶ Get list of defined local DIDs.
Returns: A list of locally stored DIDs as DIDInfo instances
-
get_pairwise_for_did
(their_did: str) → aries_cloudagent.wallet.base.PairwiseInfo[source]¶ Find info for a pairwise DID.
Parameters: their_did – The DID to get a pairwise relationship for
Returns: A PairwiseInfo instance representing the relationship
Raises: WalletNotFoundError
– If no pairwise DID defined for targetWalletNotFoundError
– If no pairwise DID defined for target
-
get_pairwise_for_verkey
(their_verkey: str) → aries_cloudagent.wallet.base.PairwiseInfo[source]¶ Resolve a pairwise DID from a verkey.
Parameters: their_verkey – The verkey to get a pairwise relationship for Returns: A PairwiseInfo instance for the relationship Raises: WalletNotFoundError
– If no pairwise DID is defined for verkey
-
get_pairwise_list
() → Sequence[aries_cloudagent.wallet.base.PairwiseInfo][source]¶ Get list of defined pairwise DIDs.
Returns: A list of PairwiseInfo instances for all pairwise relationships
-
get_signing_key
(verkey: str) → aries_cloudagent.wallet.base.KeyInfo[source]¶ Fetch info for a signing keypair.
Parameters: verkey – The verification key of the keypair
Returns: A KeyInfo representing the keypair
Raises: WalletNotFoundError
– If no keypair is associated with the verification keyWalletError
– If there is a libindy error
-
handle
¶ Get internal wallet reference.
Returns: A handle to the wallet
-
master_secret_id
¶ Accessor for the master secret id.
Returns: The master secret id
-
name
¶ Accessor for the wallet name.
Returns: The wallet name
-
open
()[source]¶ Open wallet, removing and/or creating it if so configured.
Raises: WalletError
– If wallet not found after creationWalletNotFoundError
– If the wallet is not foundWalletError
– If the wallet is already openWalletError
– If there is a libindy error
-
opened
¶ Check whether wallet is currently open.
Returns: True if open, else False
-
pack_message
(message: str, to_verkeys: Sequence[str], from_verkey: str = None) → bytes[source]¶ Pack a message for one or more recipients.
Parameters: - message – The message to pack
- to_verkeys – List of verkeys to pack for
- from_verkey – Sender verkey to pack from
Returns: The resulting packed message bytes
Raises: WalletError
– If no message is providedWalletError
– If a libindy error occurs
-
remove
()[source]¶ Remove an existing wallet.
Raises: WalletNotFoundError
– If the wallet could not be foundWalletError
– If there was an libindy error
-
replace_local_did_metadata
(did: str, metadata: dict)[source]¶ Replace metadata for a local DID.
Parameters: - did – The DID to replace metadata for
- metadata – The new metadata
-
replace_pairwise_metadata
(their_did: str, metadata: dict)[source]¶ Replace metadata for a pairwise DID.
Parameters: - their_did – The DID to replace metadata for
- metadata – The new metadata
-
replace_signing_key_metadata
(verkey: str, metadata: dict)[source]¶ Replace the metadata associated with a signing keypair.
Parameters: - verkey – The verification key of the keypair
- metadata – The new metadata to store
Raises: WalletNotFoundError
– if no keypair is associated with the verification key
-
sign_message
(message: bytes, from_verkey: str) → bytes[source]¶ Sign a message using the private key associated with a given verkey.
Parameters: - message – Message bytes to sign
- from_verkey – The verkey to use to sign
Returns: A signature
Raises: WalletError
– If the message is not providedWalletError
– If the verkey is not providedWalletError
– If a libindy error occurs
-
unpack_message
(enc_message: bytes) -> (<class 'str'>, <class 'str'>, <class 'str'>)[source]¶ Unpack a message.
Parameters: enc_message – The packed message bytes
Returns: (message, from_verkey, to_verkey)
Return type: A tuple
Raises: WalletError
– If the message is not providedWalletError
– If a libindy error occurs
-
verify_message
(message: bytes, signature: bytes, from_verkey: str) → bool[source]¶ Verify a signature against the public key of the signer.
Parameters: - message – Message to verify
- signature – Signature to verify
- from_verkey – Verkey to use in verification
Returns: True if verified, else False
Raises: WalletError
– If the verkey is not providedWalletError
– If the signature is not providedWalletError
– If the message is not providedWalletError
– If a libindy error occurs
-
aries_cloudagent.wallet.provider module¶
Default wallet provider classes.
-
class
aries_cloudagent.wallet.provider.
WalletProvider
[source]¶ Bases:
aries_cloudagent.config.base.BaseProvider
Provider for the default configurable wallet classes.
-
WALLET_TYPES
= {'basic': 'aries_cloudagent.wallet.basic.BasicWallet', 'indy': 'aries_cloudagent.wallet.indy.IndyWallet'}¶
-
aries_cloudagent.wallet.util module¶
Wallet utility functions.
-
aries_cloudagent.wallet.util.
b58_to_bytes
(val: str) → bytes[source]¶ Convert a base 58 string to bytes.
-
aries_cloudagent.wallet.util.
b64_to_bytes
(val: str, urlsafe=False) → bytes[source]¶ Convert a base 64 string to bytes.