-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use in Browser? #70
Comments
I use it the following way in my extension:
and then
|
The link is dead, where else can we get the browserified version? |
At this time, we don't distribute browserified versions of crypto-pouch. That may change soon, though! In the meantime, you're best off creating your own, like this: $ curl https://unpkg.com/[email protected]/index.js > crypto-pouch-original.js
$ npx browserify crypto-pouch-original.js -o crypto-pouch.js Now you can include
Let me know if that works for you :) I'll leave this issue open until we distribute a browserified version ourselves. |
Hey, I'm struggeling to get crypto-pouch working in the browser. I tried the steps above and they didn't work. First I had to do a npm add crypto-pouch before doing the browserfy (makes sense it needs it's dependencies there). But even after that it fails in the browser with: "Invalid plugin: got "[object Object]", expected an object or a function" It basically seems to fail when the plugin is being added to pouch: if (typeof window !== 'undefined' && window.PouchDB) { Hopefully someone can advice on how to get this running! Best, |
same here. any advice on how to workaround this ? |
Hey folks. I'm unable to reproduce this issue based on the info provided. If you can provide more info about your setup, I can try reproducing this again. Until then, this works on my end: const CryptoPouch = require('crypto-pouch')
const PouchDB = require('pouchdb')
PouchDB.plugin(CryptoPouch)
const db = new PouchDB("test")
db.crypto("hello world")
.then(() => console.log("encrypted!"))
.then(() => db.post({hello: "world"}))
.then(({ id }) => console.log(id)) This prints:
When reporting issues, please supply:
For my part, I tried with PouchDB v7.2.2 and v8.0.1. |
I tried to "browserify" crypto-pouch and garbados-crypt, then import in an a html plas using a |
You shouldn't need to browserify these things directly. Browserify the entry point of your program -- where you require these things, where your app starts. That will automatically bring in dependencies. Otherwise, IIRC, Browserify wraps these dependencies so they aren't available in a global context, as your setup requires. |
The provided link in the readme:
the browserified version from wzrd.in
is dead.
So how could I get crypto-pouch running in a browser? Is there any other place to get a compiled js-file that can be used in browsers?
The text was updated successfully, but these errors were encountered: