Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: check for window.subtle.crypto

thecodrr46d0e7858526
diff --git a/apps/web/src/interfaces/storage.js b/apps/web/src/interfaces/storage.js
index d6e364e9d..2d655e09a 100644
--- a/apps/web/src/interfaces/storage.js
+++ b/apps/web/src/interfaces/storage.js
@@ -41,7 +41,7 @@ async function deriveCryptoKey(name, data) {
if (!password) throw new Error("Invalid data provided to deriveCryptoKey.");
const keyData = await crypto.deriveKey(password, salt, true);
- if (window.indexedDB) {
+ if (window.indexedDB && window?.subtle?.crypto) {
const pbkdfKey = await derivePBKDF2Key(password);
await write(name, pbkdfKey);
const cipheredKey = await aesEncrypt(pbkdfKey, keyData);
@@ -52,7 +52,7 @@ async function deriveCryptoKey(name, data) {
}
async function getCryptoKey(name) {
- if (window.indexedDB) {
+ if (window.indexedDB && window?.subtle?.crypto) {
const pbkdfKey = await read(name);
const cipheredKey = await read(`${name}@_k`);
if (!pbkdfKey || !cipheredKey) return;