dexie-encrypted icon indicating copy to clipboard operation
dexie-encrypted copied to clipboard

Uncaught (in promise) TypeError: Cannot read property 'NON_INDEXED_FIELDS' of undefined

Open sderbidge opened this issue 5 years ago • 3 comments

I'm using electron, dexie, and dexie-encrypted. After building the electron app I get the above error.

I'm importing like so:

import Dexie from "dexie";
import encrypt from "dexie-encrypted";

And my code is as follows:

encrypt(db, idbKey, {
    certStore: encrypt.NON_INDEXED_FIELDS,
  });

Is it something to do with the way I am importing dexie-encrypted? Any help would be appreciative

sderbidge avatar Aug 26 '20 20:08 sderbidge

What version of dexie-encrypted are you using?

HoracioColbert avatar Nov 10 '20 17:11 HoracioColbert

Hey, I am getting the same error (dexie-encrypted v2.0.0) . Dexie-encrypted v1.2.2 was working ok for me but has the bug/error described in #14 .

I am working with vue cli like that:

import Dexie from 'dexie'
import 'dexie-observable';
import encrypt from 'dexie-encrypted';

const db = new Dexie('tagebuchDB')


const binary_string = atob("_______________________________________");
const len = binary_string.length;
const cryptoKey = new Uint8Array(len);
for (var i = 0; i < len; i++) {
  cryptoKey[i] = binary_string.charCodeAt(i);
}

encrypt(db, cryptoKey, {
    tagebuchData:  encrypt.NON_INDEXED_FIELDS,
});

db.version(1).stores({
    tagebuchData: "$$id, date, content, starred"
})


export default db

Thank you very much!

crimue avatar Dec 30 '20 19:12 crimue

import { cryptoOptions} from 'dexie-encrypted';

encrypt(db, cryptoKey, { tagebuchData: cryptoOptions.NON_INDEXED_FIELDS });

use this

I am also attaching working example check out https://codesandbox.io/s/dexie-encrypted-working-example-2hiqu?file=/db.js

saurabhsep99 avatar Dec 20 '21 13:12 saurabhsep99