Preserve config canary string.

This commit is contained in:
Richard Moore 2020-06-12 19:22:16 -04:00
parent 9e4c7e609d
commit 7157816fa5
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651
1 changed files with 5 additions and 1 deletions

View File

@ -22,6 +22,7 @@ function Config(filename) {
this.salt = null;
this.dkey = null;
this.values = { };
this.canary = "";
this.filename = filename;
}
@ -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"));
@ -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));