Skip to content

Commit

Permalink
fix: update transform-pouch so replication works
Browse files Browse the repository at this point in the history
  • Loading branch information
garbados committed Aug 10, 2021
1 parent bc44c39 commit 873bfb4
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 707 deletions.
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ module.exports = {
}
const encrypted = {}
for (const key of this._ignore) {
encrypted[key] = doc[key]
// attach ignored fields to encrypted doc
if (key in doc) encrypted[key] = doc[key]
}
encrypted.payload = await this._crypt.encrypt(JSON.stringify(doc))
return encrypted
Expand All @@ -72,7 +73,7 @@ module.exports = {
const decryptedString = await this._crypt.decrypt(doc.payload)
const decrypted = JSON.parse(decryptedString)
for (const key of this._ignore) {
// re-attach special fields
// patch decrypted doc with ignored fields
if (key in doc) decrypted[key] = doc[key]
}
return decrypted
Expand Down
Loading

0 comments on commit 873bfb4

Please sign in to comment.