I am working on an open-source javascript application I am trying to interface with a third party API (github specifically). I am trying to keep my entire application client-side only, so I really won't have a server to fall back to or store hidden files on. As part of the OAuth process I need to provide the secret key provided for my api key. I am not supposed to publish or share this key.
I have come up with the following solution:
- Encrypt the secret key using triple-DES and a passphrase.
- Put the encrypted version in my repository somewhere.
- When I need to authenticate via Oauth, prompt for the passphrase and recover the secret key.
- Once known, store secret in local storage to avoid future prompts.
I am essentially storing a transformed version of th secret key. I guess all this buys me is that I must get the passphrase from the user instead of the full key. It should be a little easier to remember than random bytes.
Is this secure enough? It is not a super critical app, but I want to do my best to protect things that I am told not to share. Is there a better way than 3DES to encrypt the key in a reversible way?