in src/nova_act/impl/message_encrypter.py [0:0]
def encrypt(self, message: dict) -> dict:
"""Encrypt a message using the key"""
# Generate a random 96-bit IV (12 bytes)
iv = os.urandom(12)
# Encode the message to bytes
message_bytes = json.dumps(message).encode("utf-8")
# Encrypt the message
encrypted = self._aesgcm.encrypt(iv, message_bytes, None)
# Construct the encrypted message dictionary
encrypted_message = {
"encrypted": list(encrypted),
"iv": list(iv),
"type": ENCRYPTED_MESSAGE_TYPE,
}
return encrypted_message