【发布时间】:2016-06-15 23:23:48
【问题描述】:
背景:
我正在尝试使用 crypto-pouch 库来加密 pouchdb 数据库。 我查看了https://github.com/calvinmetcalf/crypto-pouch 中显示的示例 但它似乎对我没有任何作用。
我的代码:
<!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>
但是我的代码没有看到对输入的数据进行任何加密,或者我看不到任何生成的公钥。
任何线索我应该如何使用带有 pouchdb 的加密袋库。
【问题讨论】:
-
我不太了解这个库,但它似乎确实有你所说的行为。我怀疑它可能会在出路时对其进行解密,但我不确定。出于这个原因,我创建了这个 GitHub 问题:github.com/calvinmetcalf/crypto-pouch/issues/21
标签: javascript encryption browser-cache offline pouchdb