Secret¶
-
class
covata.delta.
Secret
(parent, secret_id, created, rsa_key_owner, created_by, encryption_details, base_secret_id=None)[source]¶ An instance of this class encapsulates a secret in Covata Delta. A secret has contents, which is encrypted by a symmetric key algorithm as defined in the immutable EncryptionDetails class, holding information such as the symmetric (secret) key, initialisation vector and algorithm. The symmetric key is encrypted with the public encryption key of the RSA key owner. This class will return the decrypted contents and symmetric key if returned as a result of Client.
Creates a new secret with the given parameters.
Parameters: - parent (
Client
) – the Delta client that constructed this instance - secret_id (str) – the id of the secret
- created (str) – the created date
- rsa_key_owner (str) – the identity id of the RSA key owner
- created_by (str) – the identity id of the secret creator
- encryption_details (
EncryptionDetails
) – the encryption details of the secret
-
add_metadata
(metadata)[source]¶ Adds the key and value pairs in the provided map as metadata for this secret. If the metadata previously contained a mapping for the key, the old value is replaced by the specified value.
Parameters: metadata (dict[str, str]) – a map of metadata key and value pairs
-
get_content
()[source]¶ Gets the content of a secret, encrypted with the details defined in the encryption_details of this secret and encoded in base64.
Returns: the content of the secret encoded in base64 Return type: str
-
get_derived_secrets
(page=None, page_size=None)[source]¶ Gets a list of secrets derived from this secret, bound by the pagination parameters.
The credentials of the secret creator be present in the local key store.
Parameters: - page (int | None) – the page number
- page_size (int | None) – the page size
Returns: a generator of secrets
Return type: generator of
Secret
-
get_events
(rsa_key_owner_id=None)[source]¶ Gets a list of events associated filtered by this secret id or both this secret id and RSA key owner.
The credentials of the secret creator must be present in the local key store.
Parameters: rsa_key_owner_id (str | None) – the rsa key owner id of interest Returns: a generator of audit events Return type: generator of Event
-
get_metadata
()[source]¶ Gets the metadata for this secret. Metadata are key-value pairs of strings that can be added to a secret to facilitate description and lookup. Secrets can support any number of metadata elements, but each key or value has a limit of 256 characters.
Returns: the metadata for this secret Return type: dict[str, str]
Shares this secret with the target recipient identity. This action will create a new (derived) secret in Covata Delta, and the new secret will be returned to the caller.
The credentials of the RSA key owner must be present in the local key store.
Parameters: identity_id (str) – the recipient identity id Returns: the derived secret Return type: Secret
- parent (