I am currently working on an open source project to securely store notes, payment card numbers, etc. I would like to implement a zero knowledge encryption method so that no one but the user can decrypt this data.

Unfortunately, I am stuck on 2 things.

  1. How can I securely store the derived key in the browser? I want to avoid the situation that the user has to type the password every time he saves the data to encrypt the data before sending it to the server so I thought it would be better to keep the key (hash) in the browser and use it when saving the data. I wonder if keeping the key in session storage will be a good solution?
  2. Is using a third-party service that handles login and access to user resources a good option? I'm not a security expert and I'd prefer not to create my own service for such login and resource access management, so I thought it would be safer to use external (necessarily open source) services like Zitadel or Ory.sh (maybe some of you have experience with them?). Is it a good idea for an open source project, which is supposed to be primarily secure and trustworthy, to use external services to handle logging and resource management? I browsed on GitHub how this is done for example in Bitwarden or Proton applications but as far as I can see Bitwarden and Proton have their own authentication and authorization systems.

Thank you for your help

1 Answer 1


With regard to (1): See Need some clarification regards end-to-end encryption process for a few ideas around how to store users' private keys in a zero-knowledge web application.

With regard to (2): Ideally, you would not want the user to have to provide both an authentication credential for accessing resources on the server, and a private key for decrypting messages. One way to solve this problem is for the user to use his/her private key for both of the above. In this case, the server would store the user's public key in the user's record; and to authenticate with the server, the user proves that he/she is in possession of the private key through some cryptographic process (such as signing a nonce provided by the server).

Another way to solve this problem is the way that Protonmail does it.

  • Hi, thank you for your reply With regard to (1): Is there any benefit of storing derived key in user record instead of, for example, only in session storage when user is logging in?
    – mson
    Feb 25 at 23:08
  • You're welcome. If you store the derived key in the user record, then your system would no longer be zero-knowledge, because it would have the key needed to decrypt the user's private information.
    – mti2935
    Feb 25 at 23:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .