db.crypto is not a function ('undefined')
See original GitHub issueTrying to run this in the browser. And I’m at a loss.
var db = PouchDB('dudes'); db.crypt('password').then(console.log(db))
returns
Uncaught TypeError: db.crypt is not a function at <anonymous>:2:6 at Object.InjectedScript._evaluateOn (<anonymous>:875:140) at Object.InjectedScript._evaluateAndWrap (<anonymous>:808:34) at Object.InjectedScript.evaluate (<anonymous>:664:21)(anonymous function) @ VM33737:2InjectedScript._evaluateOn @ VM33252:875InjectedScript._evaluateAndWrap @ VM33252:808InjectedScript.evaluate @ VM33252:664
Umm… File loaded? Yup.
console.log(crypto)
cryto: {
_subtle: {
decrypt() {...}
encrypt() {...}
...
Oh cool.
function myEncrypt(x) {
crypto.subtle.encrypt(x)
}
myEncrypt(db);
Uncaught (in promise) TypeError: Failed to execute 'encrypt' on 'SubtleCrypto': 3 arguments required, but only 1 present.
at TypeError (native)
at myEncrypt (<anonymous>:3:17)
at <anonymous>:2:1
at Object.InjectedScript._evaluateOn (<anonymous>:875:140)
at Object.InjectedScript._evaluateAndWrap (<anonymous>:808:34)
at Object.InjectedScript.evaluate (<anonymous>:664:21)
Umm, huh?
console.log(crypto.self.encrypt);
encrypt() { [native code] }
I’m sooooo lost. I’m guessing native code is crap from V8, since it looks like this is running VM’s. Am I right? Honestly, I really need more documentation than add this browserified file like normal.
I tried looking through the source code but then my brain overheated.
Do I need to also download the browseried version of crypto-browserify?
Is it even worth pursuing this? You haven’t checked-in for 5 months…
Thanks for your hard work.
Issue Analytics
- State:
- Created 8 years ago
- Comments:12 (7 by maintainers)
Top GitHub Comments
@paynoattn I had a similar issue. I just noticed that Nolan uses another script in his example than the one mentioned in readme.md… So instead of using the one linked from the readme page: http://wzrd.in/bundle/crypto-pouch I tried this one: http://wzrd.in/standalone/crypto-pouch
That solved my issue.
if you are using browserify or some other bundler you should need to add: