Background:
I am trying to encrypt a pouchdb database by using crypto-pouch library. I had a look at the example shown at https://github.com/calvinmetcalf/crypto-pouch But it doesn't seem to do anything for me.
My code:
<!DOCTYPE html>
<html ng-app="pouchdbApp">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src="pouchdbDemo.js"></script>
<script src="http://cdn.jsdelivr.net/pouchdb/5.2.1/pouchdb.min.js"></script>
<!-- <script src="crypto-pouch-master/bundle.js"></script> -->
<script src="http://wzrd.in/standalone/crypto-pouch"></script>
<script>
var db = new PouchDB('kittens2');
var password = "mypassword";
db.crypto(password).then(function (publicKey) {
console.log("publicKey");
console.log(publicKey);
});
/* db.removeCrypto(); */
var doc = {
"_id": "mittens",
"name": "Mittens",
"occupation": "kitten",
"age": 3,
"hobbies": [
"playing with balls of yarn",
"chasing laser pointers",
"lookin' hella cute"
]
};
db.put(doc);
db.get('mittens').then(function (doc) {
console.log(doc);
});
</script>
</head>
<body>
</body>
</html>
But my code doesn't see to do any encryption of the data entered, or i couldn't see any public key generated.
Any clue how i should be using the crypto-pouch library with pouchdb.