002 + verification updates
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
class ItemParams {
|
||||
|
||||
constructor(item, keys) {
|
||||
constructor(item, keys, version) {
|
||||
this.item = item;
|
||||
this.keys = keys;
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
paramsForExportFile() {
|
||||
@@ -16,7 +17,7 @@ class ItemParams {
|
||||
}
|
||||
|
||||
paramsForLocalStorage() {
|
||||
this.additionalFields = ["updated_at", "dirty"];
|
||||
this.additionalFields = ["updated_at", "dirty", "errorDecrypting"];
|
||||
this.forExportFile = true;
|
||||
return this.__params();
|
||||
}
|
||||
@@ -26,17 +27,17 @@ class ItemParams {
|
||||
}
|
||||
|
||||
__params() {
|
||||
let encryptionVersion = "001";
|
||||
|
||||
console.log("Encrypting with version: ", this.version);
|
||||
|
||||
console.assert(!this.item.dummy, "Item is dummy, should not have gotten here.", this.item.dummy)
|
||||
|
||||
var params = {uuid: this.item.uuid, content_type: this.item.content_type, deleted: this.item.deleted, created_at: this.item.created_at};
|
||||
|
||||
if(this.keys && !this.item.doNotEncrypt()) {
|
||||
var encryptedParams = EncryptionHelper.encryptItem(this.item, this.keys, encryptionVersion);
|
||||
var encryptedParams = EncryptionHelper.encryptItem(this.item, this.keys, this.version);
|
||||
_.merge(params, encryptedParams);
|
||||
|
||||
if(encryptionVersion !== "001") {
|
||||
if(this.version !== "001") {
|
||||
params.auth_hash = null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user