You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
15% 😭. But we could future proof by checking support and conditionally using it while sticking to local storage for browsers that don't. Also we need to think about how we want to go about this, I believe WebCrypto can not return the private key, only sign data with it meaning @tomic/lib needs to use it directly. Right now storing the key is handled by browser because that is not really the concern of lib. WebCrypto might not be available in all contexts that lib should be able to run in. It is also not always appropriate for the key to be stored in general, for example on a server that has a store instance for each connected user.
I took a look at the api's and it works a bit different from what I thought. The API gives you a CryptoKey object that can be stored in IndexDB. This means you're not limited to just one stored key. Still I don't think actually storing the key should be the concern of @tomic/lib but we could export some helper functions to make it simple.
However
I ran into another issue when experimenting. I can't seem to make importKey() work with our private keys.
The following code gives me an error saying it can't create the key with the specified usages.
When generating an ed25519 keypair with crypto.subtle.generateKey() it works just fine so it's likely something to do with the format the private key is stored in.
importKey
function withextractable
set tofalse
to provide more security.ed25519
is not great, mostly behind flags.The text was updated successfully, but these errors were encountered: