Class Gateway
Package: keychain.core.gateway
Inheritance: Gateway
Description
Gateway
performs application-level cryptographic operations encrypt, decrypt, sign, and verify.
Through the Gateway
users create personas and contacts, and execute the cryptographic operations with respect to those entities.
The Gateway
works together with the Monitor
. The Gateway
executes actions, and the Monitor
keeps the underlying state of personas and contacts and their associated keychains up to date.
Since: v2.0
Public Constructors
Constructor |
---|
Constructs a |
Public Member Functions
Return type | Method and Description |
---|---|
|
Seeds the private key pool and generates a mnemonic recovery string. |
|
Sets the active persona to the provided |
Returns the current active persona, if any |
|
|
Returns |
|
Returns a |
|
Returns a |
Creates a persona in the |
|
Creates a contact for the current active persona with the given identity information |
|
|
Deletes the provided |
|
Encrypts a clear text string so it can be decrypted by the provided |
|
Signs a clear text string with the current active persona’s signature |
|
Signs a clear text string with the current active persona’s signature, then encrypts for the provided contact list |
|
Adds the current active persona’s signature to an already-signed message |
|
Decrypts the cipher text into a |
|
Decrypts the cipher text into a |
|
Given a signed message that is not encrypted, returns the message payload and a |
Public Member Functions Detail
seed
|
|
Seeds the private key pool and generates a mnemonic recovery string. Should be run once a |
set_active_persona
|
|
Sets the active persona in the |
|
Parameters: |
|
|
|
Returns: |
|
|
|
Raises: |
|
|
|
|
get_active_persona
|
|
Returns the current active persona in the |
|
Returns: |
|
The current active persona |
|
Raises: |
|
|
mature_persona_exists
|
|
Checks to see if the |
|
Returns: |
|
|
get_contacts
|
|
Returns all contacts for the current active persona. |
|
Returns: |
|
a |
|
Raises: |
|
|
|
|
get_personas
|
|
Returns all personas in the |
|
Returns: |
|
a |
|
Raises: |
|
|
|
|
create_persona
|
|
Creates a new persona in the |
|
Parameters: |
|
|
|
|
|
|
|
Returns: |
|
The newly created persona |
|
Raises: |
|
|
create_contact
|
|||
Creates a new contact for the current active persona with the given identity information. The contact |
|||
Parameters: |
|||
|
|||
|
|||
|
|||
Returns: |
|||
The contact object |
|||
Raises: |
|||
|
delete_facade
|
|
Deletes a contact or persona from the |
|
Parameters: |
|
|
|
Raises: |
|
|
|
|
encrypt
|
|
Encrypts a clear text string so it can be decrypted by the provided list of contacts. It is OK to include personas in this list as well. |
|
Parameters: |
|
|
|
|
|
Returns: |
|
a bytearray which contains the encrypted message (cipher-text), original string encoding (for portability), and contact-specific encrypted versions of the symmetric key used to encrypt/decrypt the cipher-text, 1 per contact |
|
Raises: |
|
|
|
|
sign
|
|
Signs a clear text string with the current active persona’s signature. |
|
Parameters: |
|
|
|
Returns: |
|
a bytearray which is the Keychain representation of the message and persona’s signature |
|
Raises: |
|
|
|
|
sign_then_encrypt
|
|
Signs the clear text and then encrypts it for the provided contacts |
|
Parameters: |
|
|
|
|
|
Returns: |
|
a bytearray which contains the encrypted message (cipher-text), original string encoding (for portability), contact-specific encrypted versions of the symmetric key used to encrypt/decrypt the cipher-text (1 per contact), and persona signature |
|
Raises: |
|
|
|
|
add_signature
|
|
Adds the current active persona’s signature to an already-signed message. This is fundamentally different from |
|
Parameters: |
|
|
|
Returns: |
|
a new signed message where the current active persona’s signature is added alongside other signatures |
|
Raises: |
|
|
|
|
decrypt
|
|
Decrypts a cipher-text for the given persona, if the text was originally encrypted with the persona as intended recipient, yielding a bytearray or string representing the message (which may have signatures, or be wrapped further) and original |
|
Parameters: |
|
|
|
Returns: |
|
a bytearray or string which contains the unencrypted and possibly signed message, as well as the original encoding information |
|
Raises: |
|
|
|
|
decrypt_then_verify
|
|
Decrypts the cipher text into a |
|
Parameters: |
|
|
|
Returns: |
|
a bytearray or string which contains the unencrypted message, original string encoding, and list of |
|
Raises: |
|
|
|
|
verify
|
|
Given a signed message, returns the message payload and a Note that the For example
|
|
Parameters: |
|
|
|
Returns: |
|
a list of |
|
Raises: |
|
|
|
|
Static Member Functions Detail
init
|
|
Creates a Keychain |
|
Parameters: |
|
|
|
|
|
|
|
|
|
|
|
Returns: |
|
A |