MCPcopy Create free account
hub / github.com/Drakkar-Software/OctoBot / decrypt

Method decrypt

packages/sync/octobot_sync/crypto.py:80–94  ·  view source on GitHub ↗
(self, wrapper: dict[str, typing.Any])

Source from the content-addressed store, hash-verified

78 }
79
80 def decrypt(self, wrapper: dict[str, typing.Any]) -> dict[str, typing.Any]:
81 try:
82 initialization_vector = base64.b64decode(wrapper[constants.BLOB_IV_KEY])
83 ciphertext = base64.b64decode(wrapper[constants.BLOB_DATA_KEY])
84 except (KeyError, binascii.Error, ValueError) as err:
85 raise sync_errors.OctobotSyncCryptoFormatError(
86 f"Invalid encrypted share envelope: {err}"
87 ) from err
88 try:
89 plaintext = AESGCM(self._key).decrypt(initialization_vector, ciphertext, None)
90 except InvalidTag as err:
91 raise sync_errors.OctobotSyncCryptoDecryptError(
92 "Failed to decrypt share payload"
93 ) from err
94 return json.loads(plaintext.decode("utf-8"))
95
96
97def _collection_aes_key(wallet_private_key: str, collection: str) -> bytes:

Callers 13

decryptAndVerifyFunction · 0.80
getThreadFunction · 0.80
decryptWithKeyFunction · 0.80
device-key.test.tsFile · 0.80
handle_encrypted_valueFunction · 0.80
decryptFunction · 0.80
rsa_decrypt_aes_keyFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected