Skip to content

Commit

Permalink
Preserve config canary string.
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Jun 12, 2020
1 parent 9e4c7e6 commit 7157816
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion admin/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function Config(filename) {
this.salt = null;
this.dkey = null;
this.values = { };
this.canary = "";
this.filename = filename;
}

Expand All @@ -37,6 +38,8 @@ Config.prototype.load = async function() {
};
}

this.canary = data.canary || "";

this.salt = data.salt;

const password = await prompt.getPassword(colorify("Password (config-store): ", "bold"));
Expand Down Expand Up @@ -77,7 +80,8 @@ Config.prototype.save = function() {
ciphertext: ciphertext.toString("base64"),
iv: iv.toString("base64"),
salt: this.salt,
hmac: hmac
hmac: hmac,
canary: this.canary
};

fs.writeFileSync(this.filename, JSON.stringify(data, null, 2));
Expand Down

0 comments on commit 7157816

Please sign in to comment.