问题描述
我在 angular App 中使用 pouchDB 来存储本地数据,并使用 crypto-pouch 3.1.3 插件加密 IndexedDB 中的本地数据。
这是我的代码:
PouchDB = require('pouchdb').default;
Crypto = require ('crypto-pouch');
Upsert = require ('pouchdb-upsert');
pouch: any;
remoteDB: any;
constructor() {
this.PouchDB.plugin(this.Crypto);
this.PouchDB.plugin(this.Upsert);
this.pouch = this.PouchDB('localDB',{ auto_compaction: true })
this.pouch.crypto('password')
this.remoteDB = new this.PouchDB(`https://somesite.com/p/remotedb/`)
this.pouch.sync(this.remoteDB).on('error',function (err) {
console.log('couch sync error',err);
});;
}
浏览器 IndexedDB 中的数据已经加密,并且正在复制到远程 CouchDB。
但是每次我对本地数据进行更新时,更新已与远程数据库同步后,远程CouchDB 会发生冲突。
this.pouch.crypto('password')
一切恢复正常,更新可以同步,没有冲突。除了本地数据在IndexedDB中以明文显示。
我认为这可能是 crypto-pouch
插件的问题,所以我去了它的 github 问题列表,但没有发布此类问题。
有谁知道问题是什么,如何解决?谢谢~
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)