calvinmetcalf / crypto-pouch

plugin for encrypted pouchdb/couchdb databases
MIT License
243 stars 43 forks source link

Not working in chrome #17

Closed kulwinders closed 3 years ago

kulwinders commented 8 years ago

I was trying to use this modul in my angular based web app but keeps on getting

Uncaught (in promise) RangeError: Trying to access beyond buffer length(…) checkOffset @ bundle.js:7543 Buffer.readUInt32LE @ bundle.js:7566 Chacha20 @ bundle.js: 8225Cipher @ bundle.js:8089 createCipher @ bundle.js:8189 encrypt @ bundle.js:22238 incoming @ bundle.js: 21795handlers.bulkDocs @ bundle.js:21844

gr2m commented 8 years ago

@kulwinders can you provide more code of yours? Do you try to save attachments?

gr2m commented 8 years ago

nevermind, I run into the same issue here: https://github.com/calvinmetcalf/crypto-pouch/issues/13#issuecomment-186394813

gr2m commented 8 years ago

I don’t know much about crypto, but the problem comes from this line:

chacha.createCipher(key, nonce);

var nonce = crypto.randomBytes(12) is an empty array in Chrome, while it’s a buffer with .length === 12 in node.

Any ideas?

gr2m commented 8 years ago

will be fixed with https://github.com/calvinmetcalf/crypto-pouch/pull/18 – problem was outdated browserify version