safe-global / safe-client-gateway

Serves as a bridge for the Safe{Wallet} clients (Android, iOS, Web)
https://docs.safe.global
MIT License
27 stars 64 forks source link

Add Blob Encryption #2130

Closed hectorgomezv closed 3 days ago

hectorgomezv commented 3 days ago

Summary

This PR adds JSON encryption/decryption to IEncryptionApi.

It adds two functions: encryptBlob and decryptBlob. Since the key to encrypt the blob is a one-use key, the return of encryptBlob will be an EncryptedBlob, which holds:

  1. The encrypted data.
  2. The key used to encrypt (also encrypted).
  3. The iv used in the process.

Also, this EncryptedBlob will be used as an input parameter for decryptBlob, which needs to decrypt the key first, and then, using that key and the iv, it can decrypt the data.

Changes