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
[source]¶ Bases:
abc.ABC
Abstract wallet interface.
-
create_local_did
(method: aries_cloudagent.wallet.did_method.DIDMethod, key_type: aries_cloudagent.wallet.key_type.KeyType, seed: str = None, did: str = None, metadata: dict = None) → aries_cloudagent.wallet.did_info.DIDInfo[source]¶ Create and store a new local DID.
Parameters: - method – The method to use for the DID
- key_type – The key type to use for the DID
- seed – Optional seed to use for DID
- did – The DID to use
- metadata – Metadata to store with DID
Returns: The created DIDInfo
-
create_public_did
(method: aries_cloudagent.wallet.did_method.DIDMethod, key_type: aries_cloudagent.wallet.key_type.KeyType, seed: str = None, did: str = None, metadata: dict = {}) → aries_cloudagent.wallet.did_info.DIDInfo[source]¶ Create and store a new public 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_signing_key
(key_type: aries_cloudagent.wallet.key_type.KeyType, seed: str = None, metadata: dict = None) → aries_cloudagent.wallet.did_info.KeyInfo[source]¶ Create a new public/private signing keypair.
Parameters: - key_type – Key type to create
- seed – Optional seed allowing deterministic key creation
- metadata – Optional metadata to store with the keypair
Returns: A KeyInfo representing the new record
-
get_local_did
(did: str) → aries_cloudagent.wallet.did_info.DIDInfo[source]¶ Find info for a local DID.
Parameters: did – The DID for which to get info Returns: A DIDInfo instance for the DID
-
get_local_did_for_verkey
(verkey: str) → aries_cloudagent.wallet.did_info.DIDInfo[source]¶ Resolve a local DID from a verkey.
Parameters: verkey – Verkey for which to get DID info Returns: A DIDInfo instance for the DID
-
get_local_dids
() → Sequence[aries_cloudagent.wallet.did_info.DIDInfo][source]¶ Get list of defined local DIDs.
Returns: A list of DIDInfo instances
-
get_posted_dids
() → Sequence[aries_cloudagent.wallet.did_info.DIDInfo][source]¶ Get list of defined posted DIDs.
Returns: A list of DIDInfo instances
-
get_public_did
() → aries_cloudagent.wallet.did_info.DIDInfo[source]¶ Retrieve the public DID.
Returns: The currently public DIDInfo, if any
-
get_signing_key
(verkey: str) → aries_cloudagent.wallet.did_info.KeyInfo[source]¶ Fetch info for a signing keypair.
Parameters: verkey – The verification key of the keypair Returns: A KeyInfo representing the keypair
-
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.
Prefer set_did_endpoint() to set endpoint in metadata.
Parameters: - did – DID for which to replace metadata
- 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
-
rotate_did_keypair_apply
(did: str) → None[source]¶ Apply temporary keypair as main for DID that wallet owns.
Parameters: did – signing DID
Raises: WalletNotFoundError
– if wallet does not own DIDWalletError
– if wallet has not started key rotation
-
rotate_did_keypair_start
(did: str, next_seed: str = None) → str[source]¶ Begin key rotation for DID that wallet owns: generate new keypair.
Parameters: - did – signing DID
- next_seed – seed for incoming ed25519 key pair (default random)
Returns: The new verification key
Raises: WalletNotFoundError
– if wallet does not own DID
-
set_did_endpoint
(did: str, endpoint: str, _ledger: aries_cloudagent.ledger.base.BaseLedger, endpoint_type: aries_cloudagent.ledger.endpoint_type.EndpointType = None)[source]¶ Update the endpoint for a DID in the wallet, send to ledger if public or posted.
Parameters: - did – DID for which to set endpoint
- endpoint – the endpoint to set, None to clear
- ledger – the ledger to which to send endpoint update if DID is public or posted
- endpoint_type – the type of the endpoint/service. Only endpoint_type ‘endpoint’ affects local wallet
-
set_public_did
(did: Union[str, aries_cloudagent.wallet.did_info.DIDInfo]) → aries_cloudagent.wallet.did_info.DIDInfo[source]¶ Assign the public DID.
Returns: The updated DIDInfo
-
sign_message
(message: Union[List[bytes], bytes], from_verkey: str) → bytes[source]¶ Sign message(s) using the private key associated with a given verkey.
Parameters: - message – The message(s) to sign
- from_verkey – Sign using the private key related to this verkey
Returns: The signature
-
unpack_message
(enc_message: bytes) → Tuple[str, str, str][source]¶ Unpack a message.
Parameters: enc_message – The encrypted message Returns: (message, from_verkey, to_verkey) Return type: A tuple
-
verify_message
(message: Union[List[bytes], bytes], signature: bytes, from_verkey: str, key_type: aries_cloudagent.wallet.key_type.KeyType) → 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
- key_type – The key type to derive the signature verification algorithm from
Returns: True if verified, else False
-
aries_cloudagent.wallet.crypto module¶
Cryptography functions used by BasicWallet.
-
aries_cloudagent.wallet.crypto.
add_pack_recipients
(wrapper: aries_cloudagent.utils.jwe.JweEnvelope, cek: bytes, to_verkeys: Sequence[bytes], from_secret: bytes = None)[source]¶ Assemble the recipients block of a packed message.
Parameters: - wrapper – The envelope to add recipients to
- cek – The content encryption key
- to_verkeys – Verkeys of recipients
- from_secret – Secret to use for signing keys
Returns: A tuple of (json result, key)
-
aries_cloudagent.wallet.crypto.
create_ed25519_keypair
(seed: bytes = None) → Tuple[bytes, bytes][source]¶ Create a public and private ed25519 keypair from a seed value.
Parameters: seed – Seed for keypair Returns: A tuple of (public key, secret key)
-
aries_cloudagent.wallet.crypto.
create_keypair
(key_type: aries_cloudagent.wallet.key_type.KeyType, seed: bytes = None) → Tuple[bytes, bytes][source]¶ Create a public and private keypair from a seed value.
Parameters: - key_type – The type of key to generate
- seed – Seed for keypair
Raises: WalletError
– If the key type is not supportedReturns: A tuple of (public key, secret key)
-
aries_cloudagent.wallet.crypto.
decode_pack_message
(enc_message: bytes, find_key: Callable) → Tuple[str, Optional[str], 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.
decode_pack_message_outer
(enc_message: bytes) → Tuple[dict, dict, bool][source]¶ Decode the outer wrapper of a packed message and extract the recipients.
Parameters: enc_message – The encrypted message Returns: a tuple of the decoded wrapper, recipients, and authcrypt flag
-
aries_cloudagent.wallet.crypto.
decode_pack_message_payload
(wrapper: aries_cloudagent.utils.jwe.JweEnvelope, payload_key: bytes) → str[source]¶ Decode the payload of a packed message once the CEK is known.
Parameters: - wrapper – The decoded message wrapper
- payload_key – The decrypted payload key
-
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.
ed25519_pk_to_curve25519
(public_key: bytes) → bytes[source]¶ Covert a public Ed25519 key to a public Curve25519 key as bytes.
-
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) → Tuple[bytes, bytes, 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.
extract_pack_recipients
(recipients: Sequence[aries_cloudagent.utils.jwe.JweRecipient]) → dict[source]¶ Extract the pack message recipients into a dict indexed by verkey.
Parameters: recipients – Recipients to locate Raises: ValueError
– If the recipients block is mal-formatted
-
aries_cloudagent.wallet.crypto.
extract_payload_key
(sender_cek: dict, recip_secret: bytes) → Tuple[bytes, str][source]¶ Extract the payload key from pack recipient details.
Returns: A tuple of the CEK and sender verkey
-
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: Union[List[bytes], bytes], secret: bytes, key_type: aries_cloudagent.wallet.key_type.KeyType) → bytes[source]¶ Sign message(s) using a private signing key.
Parameters: - message – The message(s) to sign
- secret – The private signing key
- key_type – The key type to derive the signature algorithm from
Returns: The signature
Return type:
-
aries_cloudagent.wallet.crypto.
sign_message_ed25519
(message: bytes, secret: bytes) → bytes[source]¶ Sign message using a ed25519 private signing key.
Parameters: Returns: The signature
Return type:
-
aries_cloudagent.wallet.crypto.
sign_pk_from_sk
(secret: bytes) → bytes[source]¶ Extract the verkey from a secret signing key.
-
aries_cloudagent.wallet.crypto.
validate_seed
(seed: Union[str, bytes]) → bytes[source]¶ Convert a seed parameter to standard format and check length.
Parameters: seed – The seed to validate Returns: The validated and encoded seed
-
aries_cloudagent.wallet.crypto.
verify_signed_message
(message: Union[List[bytes], bytes], signature: bytes, verkey: bytes, key_type: aries_cloudagent.wallet.key_type.KeyType) → bool[source]¶ Verify a signed message according to a public verification key.
Parameters: - message – The message(s) to verify
- signature – The signature to verify
- verkey – The verkey to use in verification
- key_type – The key type to derive the signature verification algorithm from
Returns: True if verified, else False
-
aries_cloudagent.wallet.crypto.
verify_signed_message_ed25519
(message: bytes, signature: bytes, verkey: bytes) → bool[source]¶ Verify an ed25519 signed message according to a public verification key.
Parameters: - message – The message to verify
- signature – The signature to verify
- verkey – The verkey to use in verification
Returns: True if verified, else False
aries_cloudagent.wallet.did_posture module¶
Ledger utilities.
-
class
aries_cloudagent.wallet.did_posture.
DIDPosture
[source]¶ Bases:
enum.Enum
Enum for DID postures: public, posted but not public, or in wallet only.
-
POSTED
= DIDPostureSpec(moniker='posted', ordinal=1, public=False, posted=True)¶
-
PUBLIC
= DIDPostureSpec(moniker='public', ordinal=0, public=True, posted=True)¶
-
WALLET_ONLY
= DIDPostureSpec(moniker='wallet_only', ordinal=2, public=False, posted=False)¶
-
metadata
¶ DID metadata for DID posture.
-
moniker
¶ Name for DID posture.
-
ordinal
¶ public first, then posted and wallet-only.
Type: Ordinal for presentation
-
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.core.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.
-
exception
aries_cloudagent.wallet.error.
WalletSettingsError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.wallet.error.WalletError
Invalid settings exception.
aries_cloudagent.wallet.in_memory module¶
In-memory implementation of BaseWallet interface.
-
class
aries_cloudagent.wallet.in_memory.
InMemoryWallet
(profile: aries_cloudagent.core.in_memory.InMemoryProfile)[source]¶ Bases:
aries_cloudagent.wallet.base.BaseWallet
In-memory wallet implementation.
-
create_local_did
(method: aries_cloudagent.wallet.did_method.DIDMethod, key_type: aries_cloudagent.wallet.key_type.KeyType, seed: str = None, did: str = None, metadata: dict = None) → aries_cloudagent.wallet.did_info.DIDInfo[source]¶ Create and store a new local DID.
Parameters: - method – The method to use for the DID
- key_type – The key type to use for the DID
- 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_signing_key
(key_type: aries_cloudagent.wallet.key_type.KeyType, seed: str = None, metadata: dict = None) → aries_cloudagent.wallet.did_info.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
- key_type – Key type to generate. Default to ed25519
Returns: A KeyInfo representing the new record
Raises: WalletDuplicateError
– If the resulting verkey already exists in the wallet
-
get_local_did
(did: str) → aries_cloudagent.wallet.did_info.DIDInfo[source]¶ Find info for a local DID.
Parameters: did – The DID for which to get info 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.did_info.DIDInfo[source]¶ Resolve a local DID from a verkey.
Parameters: verkey – The verkey for which to get the local DID Returns: A DIDInfo instance representing the found DID Raises: WalletNotFoundError
– If the verkey is not found
-
get_local_dids
() → Sequence[aries_cloudagent.wallet.did_info.DIDInfo][source]¶ Get list of defined local DIDs.
Returns: A list of locally stored DIDs as DIDInfo instances
-
get_public_did
() → aries_cloudagent.wallet.did_info.DIDInfo[source]¶ Retrieve the public DID.
Returns: The currently public DIDInfo, if any
-
get_signing_key
(verkey: str) → aries_cloudagent.wallet.did_info.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
-
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 for which to pack
- from_verkey – Sender verkey from which to pack
Returns: The resulting packed message bytes
Raises: WalletError
– If the message is not provided
-
replace_local_did_metadata
(did: str, metadata: dict)[source]¶ Replace metadata for a local DID.
Parameters: - did – The DID for which to replace metadata
- metadata – The new metadata
Raises: WalletNotFoundError
– If the DID doesn’t exist
-
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
-
rotate_did_keypair_apply
(did: str) → None[source]¶ Apply temporary keypair as main for DID that wallet owns.
Parameters: did – signing DID
Raises: WalletNotFoundError
– if wallet does not own DIDWalletError
– if wallet has not started key rotation
-
rotate_did_keypair_start
(did: str, next_seed: str = None) → str[source]¶ Begin key rotation for DID that wallet owns: generate new keypair.
Parameters: - did – signing DID
- next_seed – incoming replacement seed (default random)
Returns: The new verification key
Raises: WalletNotFoundError
– if wallet does not own DID
-
set_public_did
(did: Union[str, aries_cloudagent.wallet.did_info.DIDInfo]) → aries_cloudagent.wallet.did_info.DIDInfo[source]¶ Assign the public DID.
Returns: The updated DIDInfo
-
sign_message
(message: Union[List[bytes], bytes], from_verkey: str) → bytes[source]¶ Sign message(s) using the private key associated with a given verkey.
Parameters: - message – Message(s) 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) → Tuple[str, str, 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: Union[List[bytes], bytes], signature: bytes, from_verkey: str, key_type: aries_cloudagent.wallet.key_type.KeyType) → bool[source]¶ Verify a signature against the public key of the signer.
Parameters: - message – Message(s) to verify
- signature – Signature to verify
- from_verkey – Verkey to use in verification
- key_type – The key type to derive the signature verification algorithm from
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.indy module¶
Indy implementation of BaseWallet interface.
-
class
aries_cloudagent.wallet.indy.
IndySdkWallet
(opened: aries_cloudagent.indy.sdk.wallet_setup.IndyOpenWallet)[source]¶ Bases:
aries_cloudagent.wallet.base.BaseWallet
Indy identity wallet implementation.
-
create_local_did
(method: aries_cloudagent.wallet.did_method.DIDMethod, key_type: aries_cloudagent.wallet.key_type.KeyType, seed: str = None, did: str = None, metadata: dict = None) → aries_cloudagent.wallet.did_info.DIDInfo[source]¶ Create and store a new local DID.
Parameters: - method – The method to use for the DID
- key_type – The key type to use for the DID
- 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_signing_key
(key_type: aries_cloudagent.wallet.key_type.KeyType, seed: str = None, metadata: dict = None) → aries_cloudagent.wallet.did_info.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
-
get_local_did
(did: str) → aries_cloudagent.wallet.did_info.DIDInfo[source]¶ Find info for a local DID.
Parameters: did – The DID for which to get info
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.did_info.DIDInfo[source]¶ Resolve a local DID from a verkey.
Parameters: verkey – The verkey for which to get the local DID Returns: A DIDInfo instance representing the found DID Raises: WalletNotFoundError
– If the verkey is not found
-
get_local_dids
() → Sequence[aries_cloudagent.wallet.did_info.DIDInfo][source]¶ Get list of defined local DIDs.
Returns: A list of locally stored DIDs as DIDInfo instances
-
get_public_did
() → aries_cloudagent.wallet.did_info.DIDInfo[source]¶ Retrieve the public DID.
Returns: The currently public DIDInfo, if any
-
get_signing_key
(verkey: str) → aries_cloudagent.wallet.did_info.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
-
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 for which to pack
- from_verkey – Sender verkey from which to pack
Returns: The resulting packed message bytes
Raises: WalletError
– If no message is providedWalletError
– If a libindy error occurs
-
replace_local_did_metadata
(did: str, metadata: dict)[source]¶ Replace metadata for a local DID.
Parameters: - did – The DID for which to replace metadata
- 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
-
rotate_did_keypair_apply
(did: str) → aries_cloudagent.wallet.did_info.DIDInfo[source]¶ Apply temporary keypair as main for DID that wallet owns.
Parameters: did – signing DID Returns: DIDInfo with new verification key and metadata for DID
-
rotate_did_keypair_start
(did: str, next_seed: str = None) → str[source]¶ Begin key rotation for DID that wallet owns: generate new keypair.
Parameters: - did – signing DID
- next_seed – incoming replacement seed (default random)
Returns: The new verification key
-
set_did_endpoint
(did: str, endpoint: str, ledger: aries_cloudagent.ledger.base.BaseLedger, endpoint_type: aries_cloudagent.ledger.endpoint_type.EndpointType = None)[source]¶ Update the endpoint for a DID in the wallet, send to ledger if public or posted.
Parameters: - did – DID for which to set endpoint
- endpoint – the endpoint to set, None to clear
- ledger – the ledger to which to send endpoint update if DID is public or posted
- endpoint_type – the type of the endpoint/service. Only endpoint_type ‘endpoint’ affects local wallet
-
set_public_did
(did: Union[str, aries_cloudagent.wallet.did_info.DIDInfo]) → aries_cloudagent.wallet.did_info.DIDInfo[source]¶ Assign the public DID.
Returns: The updated DIDInfo
-
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) → Tuple[str, str, 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: Union[List[bytes], bytes], signature: bytes, from_verkey: str, key_type: aries_cloudagent.wallet.key_type.KeyType) → 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.routes module¶
Wallet admin routes.
-
class
aries_cloudagent.wallet.routes.
DIDCreateOptionsSchema
(*args, **kwargs)[source]¶ Bases:
aries_cloudagent.messaging.models.openapi.OpenAPISchema
Parameters and validators for create DID options.
-
key_type
= <fields.String(default=<marshmallow.missing>, attribute=None, validate=<OneOf(choices=['ed25519', 'bls12381g2'], labels=[], error='Must be one of: {choices}.')>, required=True, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>¶
-
-
class
aries_cloudagent.wallet.routes.
DIDCreateSchema
(*args, **kwargs)[source]¶ Bases:
aries_cloudagent.messaging.models.openapi.OpenAPISchema
Parameters and validators for create DID endpoint.
-
method
= <fields.String(default='sov', attribute=None, validate=<OneOf(choices=['key', 'sov'], labels=[], error='Must be one of: {choices}.')>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>¶
-
options
= <fields.Nested(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'type': 'Invalid type.'})>¶
-
-
class
aries_cloudagent.wallet.routes.
DIDEndpointSchema
(*args, **kwargs)[source]¶ Bases:
aries_cloudagent.messaging.models.openapi.OpenAPISchema
Request schema to set DID endpoint; response schema to get DID endpoint.
-
did
= <fields.String(default=<marshmallow.missing>, attribute=None, validate=<aries_cloudagent.messaging.valid.IndyDID object>, required=True, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>¶
-
endpoint
= <fields.String(default=<marshmallow.missing>, attribute=None, validate=<aries_cloudagent.messaging.valid.Endpoint object>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>¶
-
-
class
aries_cloudagent.wallet.routes.
DIDEndpointWithTypeSchema
(*args, **kwargs)[source]¶ Bases:
aries_cloudagent.messaging.models.openapi.OpenAPISchema
Request schema to set DID endpoint of particular type.
-
did
= <fields.String(default=<marshmallow.missing>, attribute=None, validate=<aries_cloudagent.messaging.valid.IndyDID object>, required=True, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>¶
-
endpoint
= <fields.String(default=<marshmallow.missing>, attribute=None, validate=<aries_cloudagent.messaging.valid.Endpoint object>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>¶
-
endpoint_type
= <fields.String(default=<marshmallow.missing>, attribute=None, validate=<aries_cloudagent.messaging.valid.EndpointType object>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>¶
-
-
class
aries_cloudagent.wallet.routes.
DIDListQueryStringSchema
(*args, **kwargs)[source]¶ Bases:
aries_cloudagent.messaging.models.openapi.OpenAPISchema
Parameters and validators for DID list request query string.
-
did
= <fields.String(default=<marshmallow.missing>, attribute=None, validate=<aries_cloudagent.messaging.valid.IndyOrKeyDID object>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>¶
-
key_type
= <fields.String(default=<marshmallow.missing>, attribute=None, validate=<OneOf(choices=['ed25519', 'bls12381g2'], labels=[], error='Must be one of: {choices}.')>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>¶
-
method
= <fields.String(default=<marshmallow.missing>, attribute=None, validate=<OneOf(choices=['key', 'sov'], labels=[], error='Must be one of: {choices}.')>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>¶
-
posture
= <fields.String(default=<marshmallow.missing>, attribute=None, validate=<aries_cloudagent.messaging.valid.DIDPosture object>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>¶
-
verkey
= <fields.String(default=<marshmallow.missing>, attribute=None, validate=<aries_cloudagent.messaging.valid.IndyRawPublicKey object>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>¶
-
-
class
aries_cloudagent.wallet.routes.
DIDListSchema
(*args, **kwargs)[source]¶ Bases:
aries_cloudagent.messaging.models.openapi.OpenAPISchema
Result schema for connection list.
-
results
= <fields.List(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid list.'})>¶
-
-
class
aries_cloudagent.wallet.routes.
DIDQueryStringSchema
(*args, **kwargs)[source]¶ Bases:
aries_cloudagent.messaging.models.openapi.OpenAPISchema
Parameters and validators for set public DID request query string.
-
did
= <fields.String(default=<marshmallow.missing>, attribute=None, validate=<aries_cloudagent.messaging.valid.IndyDID object>, required=True, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>¶
-
-
class
aries_cloudagent.wallet.routes.
DIDResultSchema
(*args, **kwargs)[source]¶ Bases:
aries_cloudagent.messaging.models.openapi.OpenAPISchema
Result schema for a DID.
-
result
= <fields.Nested(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'type': 'Invalid type.'})>¶
-
-
class
aries_cloudagent.wallet.routes.
DIDSchema
(*args, **kwargs)[source]¶ Bases:
aries_cloudagent.messaging.models.openapi.OpenAPISchema
Result schema for a DID.
-
did
= <fields.String(default=<marshmallow.missing>, attribute=None, validate=<aries_cloudagent.messaging.valid.IndyOrKeyDID object>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>¶
-
key_type
= <fields.String(default=<marshmallow.missing>, attribute=None, validate=<OneOf(choices=['ed25519', 'bls12381g2'], labels=[], error='Must be one of: {choices}.')>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>¶
-
method
= <fields.String(default=<marshmallow.missing>, attribute=None, validate=<OneOf(choices=['sov', 'key'], labels=[], error='Must be one of: {choices}.')>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>¶
-
posture
= <fields.String(default=<marshmallow.missing>, attribute=None, validate=<aries_cloudagent.messaging.valid.DIDPosture object>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>¶
-
verkey
= <fields.String(default=<marshmallow.missing>, attribute=None, validate=<aries_cloudagent.messaging.valid.IndyRawPublicKey object>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>¶
-
-
class
aries_cloudagent.wallet.routes.
WalletModuleResponseSchema
(*args, **kwargs)[source]¶ Bases:
aries_cloudagent.messaging.models.openapi.OpenAPISchema
Response schema for Wallet Module.
-
aries_cloudagent.wallet.routes.
format_did_info
(info: aries_cloudagent.wallet.did_info.DIDInfo)[source]¶ Serialize a DIDInfo object.
-
aries_cloudagent.wallet.routes.
post_process_routes
(app: <sphinx.ext.autodoc.importer._MockObject object at 0x7fb05484c090>)[source]¶ Amend swagger API.
-
aries_cloudagent.wallet.routes.
register
(app: <sphinx.ext.autodoc.importer._MockObject object at 0x7fb05484c090>)[source]¶ Register routes.
-
aries_cloudagent.wallet.routes.
wallet_create_did
(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fb05484c090>)[source]¶ Request handler for creating a new local DID in the wallet.
Parameters: request – aiohttp request object Returns: The DID info
-
aries_cloudagent.wallet.routes.
wallet_did_list
(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fb05484c090>)[source]¶ Request handler for searching wallet DIDs.
Parameters: request – aiohttp request object Returns: The DID list response
-
aries_cloudagent.wallet.routes.
wallet_get_did_endpoint
(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fb05484c090>)[source]¶ Request handler for getting the current DID endpoint from the wallet.
Parameters: request – aiohttp request object Returns: The updated DID info
-
aries_cloudagent.wallet.routes.
wallet_get_public_did
(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fb05484c090>)[source]¶ Request handler for fetching the current public DID.
Parameters: request – aiohttp request object Returns: The DID info
-
aries_cloudagent.wallet.routes.
wallet_rotate_did_keypair
(request: <sphinx.ext.autodoc.importer._MockObject object at 0x7fb05484c090>)[source]¶ Request handler for rotating local DID keypair.
Parameters: request – aiohttp request object Returns: An empty JSON response
aries_cloudagent.wallet.util module¶
Wallet utility functions.
-
aries_cloudagent.wallet.util.
abbr_verkey
(full_verkey: str, did: str = None) → str[source]¶ Given a full verkey and DID, return the abbreviated verkey.
-
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.
-
aries_cloudagent.wallet.util.
b64_to_str
(val: str, urlsafe=False, encoding=None) → str[source]¶ Convert a base 64 string to string on input encoding (default utf-8).
-
aries_cloudagent.wallet.util.
bytes_to_b58
(val: bytes) → str[source]¶ Convert a byte string to base 58.
-
aries_cloudagent.wallet.util.
bytes_to_b64
(val: bytes, urlsafe=False, pad=True, encoding: str = 'ascii') → str[source]¶ Convert a byte string to base 64.
-
aries_cloudagent.wallet.util.
full_verkey
(did: str, abbr_verkey: str) → str[source]¶ Given a DID and abbreviated verkey, return the full verkey.
-
aries_cloudagent.wallet.util.
pad
(val: str) → str[source]¶ Pad base64 values if need be: JWT calls to omit trailing padding.
-
aries_cloudagent.wallet.util.
random_seed
() → bytes[source]¶ Generate a random seed value.
Returns: A new random seed
-
aries_cloudagent.wallet.util.
set_urlsafe_b64
(val: str, urlsafe: bool = True) → str[source]¶ Set URL safety in base64 encoding.