I would like to encrypt a piece of data before persisting it in publicly accessible storage (e.g. localstore, IndexedDB, smart contract etc), ideally with no user interaction for encrypting or decrypting the information once the wallet is synced.

Is this possible with Taquito, Beacon, or similar javascript library?

1 Answer 1


There are libraries for JS/TS that can manage the encryption. Do that first, then convert the encrypted binary data to hex then store that in your contract.

You will need to securely store the key somewhere so that you can later decrypt the data. You can't store the key within the contract otherwise it will be public and then encrypting would be pointless.

  • the key is the problem i am hoping a wallet can be used to solve somehow, my objective is to be able to reliably derive a key from a wallet so that users do not have to save a key it can just be determined safely on sync
    – 0x10
    Jul 11, 2022 at 4:43
  • Every wallet is different so that's a large ask to get each wallet software developer to expose some set of API functions that can do secure storage.
    – utdrmac
    Jul 12, 2022 at 12:52
  • i don't want to generate a key and store it, i want to be able to consistently determine it at runtime based on or via a users wallet in a secure way
    – 0x10
    Jul 13, 2022 at 4:23
  • 1
    Depending on what you want to do, you could hash the private key and use that as a symmetric encryption key.
    – Arthur B
    Jul 13, 2022 at 8:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.