xq package
Subpackages
- xq.algorithms package
- xq.api package
- Subpackages
- Module contents
XQAPI
XQAPI.add_contact()
XQAPI.add_packet()
XQAPI.api_delete()
XQAPI.api_get()
XQAPI.api_patch()
XQAPI.api_post()
XQAPI.api_put()
XQAPI.authorize_alias()
XQAPI.authorize_user()
XQAPI.code_validate()
XQAPI.create_and_store_packet()
XQAPI.create_and_store_packets()
XQAPI.create_packet()
XQAPI.create_usergroup()
XQAPI.dashboard_login()
XQAPI.dashboard_signup()
XQAPI.delete_usergroup()
XQAPI.exchange_key()
XQAPI.get_communication_by_locator_token()
XQAPI.get_entropy()
XQAPI.get_packet()
XQAPI.get_packets()
XQAPI.get_usergroup()
XQAPI.grant_users()
XQAPI.login_verify()
XQAPI.revoke_packet()
XQAPI.revoke_users()
XQAPI.send_login_link()
XQAPI.update_usergroup()
XQAPI.validate_access_token()
XQAPI.validate_api_key()
- xq.exceptions package
Submodules
xq.config module
Module contents
- class xq.XQ(api_key=None, dashboard_api_key=None)
Bases:
object
- decrypt_file(encryptedText: bytes, key: bytes, algorithm: {'OTP': <class 'xq.algorithms.otp_encryption.OTPEncryption'>, 'AES': <class 'xq.algorithms.aes_encryption.AESEncryption'>} = 'OTP', nonce: bytearray | None = None) StringIO
decrypt a given bytes string back into a FileLike object
- Parameters:
encryptedText (bytes) – encrypted file contents
key (bytes) – encryption key
- Returns:
FileLike StringIO handle
- Return type:
StringIO
- decrypt_message(encryptedText: bytes, key: bytes, algorithm: {'OTP': <class 'xq.algorithms.otp_encryption.OTPEncryption'>, 'AES': <class 'xq.algorithms.aes_encryption.AESEncryption'>} = 'OTP', nonce: bytearray | None = None)
decrypt a previoulsy encrypted string
- Parameters:
encryptedText (bytes) – encrypted text to decrypt
key (bytes) – encryption key used to encrypt/decrypt
algorithm (Algorithms) – algorithm used to encrypt/decrypt
nonce (bytearray) – nonce provided from original encryption
- Returns:
decrypted text
- Return type:
str
- encrypt_file(fileObj: ~typing.TextIO, key: bytes, algorithm: {'OTP': <class 'xq.algorithms.otp_encryption.OTPEncryption'>, 'AES': <class 'xq.algorithms.aes_encryption.AESEncryption'>} = 'OTP') bytearray
encrypt the contents of a given file object
- Parameters:
fileObj (TextIO) – FileLike object to encrypt
key (bytes) – encryption key to use, NOTE: may be expanded
- Returns:
encrypted text, encryption key
- Return type:
tuple
- encrypt_message(text: str, key: bytes, algorithm: {'OTP': <class 'xq.algorithms.otp_encryption.OTPEncryption'>, 'AES': <class 'xq.algorithms.aes_encryption.AESEncryption'>} = 'OTP')
encrypt a string
- Parameters:
text (str) – string to encrypt
key (bytes, defaults to None) – encryption key to use to encrypted text
algorithm (Algorithms, defaults to AES) – the encryption algorithm to use
- Returns:
ciphertext, nonce, tag from encryption
- Return type:
tuple(bytes)
- expand_key(data: bytes, key: bytes) bytes
expand a key to the size of the text to be encrypted
- Parameters:
data (bytes) – data you are going to encrypt
key (bytes, defaults to None) – encryption key you were going to utilize to encrypt the data
- Returns:
expanded key to utilize for encryption
- Return type:
bytes
- generate_key_from_entropy()
helper method for automatically requesting entropy and shuffling key
- Returns:
generated encryption key from entropy
- Return type:
bytes
- magic_decrypt(magic_bundle)
easy button decryption: decrypt a magic encrypted with it’s magic bundle
- Parameters:
magic_bundle (tuple) – magic bundle created by magic_encryption
- Returns:
decrypted item
- Return type:
any
- magic_encrypt(thing_to_encrypt: any, recipients: List[str])
easy button encryption: encrypt something with an entropy generated encryption key, and store the key in XQ
- Parameters:
thing_to_encrypt (any) – something to encrypt (i.e. text, file path string, etc)
recipients (List[str]) – list of recipient emails
- Raises:
XQException – _description_
- Returns:
magic bundle, used for decryption
- Return type:
tuple