garbados / comdb

A PouchDB plugin that transparently encrypts and decrypts its data.
61 stars 4 forks source link

Encryption of Database with Attachments #33

Open patr1ck-234 opened 1 year ago

patr1ck-234 commented 1 year ago

Hi,

I thought to have understood this nice project, but somehow...

I'm working local in my js app and I simply want to keep only the decrypted database in indexed db when the app isn't used.

So I do

const db = new PouchDB('test');
db.setPassword('my');

now working with the app -> when closing:

db.loadDecrypted();
db.destroy({ unencrypted_only: 'true' });`

When returning

const db = new PouchDB('test');
db.setPassword('my');
db.loadEncrypted();

This is working fine until there are attachments in the db. Then it fails saying

"Failed to execute 'readAsArrayBuffer' on 'FileReader': parameter 1 is not of type 'Blob'."
Any help would be very appreciated!

Best Regards

garbados commented 1 year ago

Yes, attachments are a caveat -- ComDB doesn't support them. crypto-pouch has a similar caveat https://github.com/calvinmetcalf/crypto-pouch