@@ -86,11 +86,12 @@
diff --git a/packages/app/src/utils/crypto.ts b/packages/app/src/utils/crypto.ts
index c6f39ae1..1582597c 100644
--- a/packages/app/src/utils/crypto.ts
+++ b/packages/app/src/utils/crypto.ts
@@ -105,13 +105,17 @@ function base64ToBuffer(base64: string): Uint8Array {
/**
* Check if encryption should be enabled.
- * Disabled in dev mode with VITE_DISABLE_CRYPTO=true.
+ * Disabled in dev mode with VITE_DISABLE_CRYPTO=true, or when
+ * Web Crypto API is unavailable (HTTP on non-localhost origins).
*/
export function isCryptoEnabled(): boolean {
try {
- return import.meta.env.VITE_DISABLE_CRYPTO !== 'true'
- } catch {
+ if (import.meta.env.VITE_DISABLE_CRYPTO === 'true') return false
+ // crypto.subtle is only available in secure contexts (HTTPS or localhost)
+ if (typeof globalThis.crypto?.subtle === 'undefined') return false
return true
+ } catch {
+ return false
}
}