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
Google Chrome is able to store any key (that I've tried at least) in IndexedDB with no issues.
Firefox is able to store symmetric AES keys as well as RSA private keys, but throws the following error when attempting to store an ECDH/ECDSA private key: DataCloneError: The object could not be cloned. Note: it is specifically the private key that causes this, not the public
This is strange because the Mozilla recommendation for key management with the Web Crypto API is to store them in IndexedDB
This has to do with the way that Firefox has implemented the Structured Clone Algorithm which is an HTML specification used for storage in IndexedDB but also in other cases of data transfer such as communication between Workers via postMessage (you can see my tests of structuralClone using postMessage in src/utils.ts).
The only relevant bug report I could find is Here. Although I've tried this with both an exportable and a non-exportable key and it doesn't work either way. Apparently that issue is reliant on this one which hasn't shown any movement in 2yrs.
Others have run into this issue as well: localForage/localForage#844 (comment) And it seems that the issue is also present on Safari (I'll rely on someone else to give that a shot 😉)
Solution
Unclear right now. Needs more investigation/discussion.
What's the path forward if we can't get ECDSA/ECDH keys in Firefox/Safari? RSA keys? Or use something other than WebCrypto/IndexedDB?
The text was updated successfully, but these errors were encountered:
I updated the testcase on that Firefox issue to test storing ECDSA and ECDH keys in IndexedDB and it seems to work fine on both Firefox and Safari now.
Problem
Google Chrome is able to store any key (that I've tried at least) in IndexedDB with no issues.
Firefox is able to store symmetric AES keys as well as RSA private keys, but throws the following error when attempting to store an ECDH/ECDSA private key:
DataCloneError: The object could not be cloned.
Note: it is specifically the private key that causes this, not the public
This is strange because the Mozilla recommendation for key management with the Web Crypto API is to store them in IndexedDB
This has to do with the way that Firefox has implemented the Structured Clone Algorithm which is an HTML specification used for storage in IndexedDB but also in other cases of data transfer such as communication between Workers via
postMessage
(you can see my tests ofstructuralClone
usingpostMessage
insrc/utils.ts
).The only relevant bug report I could find is Here. Although I've tried this with both an exportable and a non-exportable key and it doesn't work either way. Apparently that issue is reliant on this one which hasn't shown any movement in 2yrs.
Others have run into this issue as well: localForage/localForage#844 (comment) And it seems that the issue is also present on Safari (I'll rely on someone else to give that a shot 😉)
Solution
Unclear right now. Needs more investigation/discussion.
What's the path forward if we can't get ECDSA/ECDH keys in Firefox/Safari? RSA keys? Or use something other than WebCrypto/IndexedDB?
The text was updated successfully, but these errors were encountered: