small changes

This commit is contained in:
Pavel Rybalko 2021-10-12 11:38:31 +07:00
parent 4250227ad6
commit ab170b93cb
No known key found for this signature in database
GPG Key ID: 84C73B280D672411
3 changed files with 10 additions and 11 deletions

View File

@ -31,17 +31,16 @@ export default Vue.extend({
};
},
created: function() {
const self = this;
this.$eventHub.$on("showError", function(text: string) {
self.level = AlertLevel.Error;
self.message = text;
this.$eventHub.$on("showError", (text: string) => {
this.level = AlertLevel.Error;
this.message = text;
});
this.$eventHub.$on("showWarn", function(text: string) {
self.level = AlertLevel.Warn;
self.message = text;
this.$eventHub.$on("showWarn", (text: string) => {
this.level = AlertLevel.Warn;
this.message = text;
});
this.$eventHub.$on("clearAlerts", function() {
self.message = null;
this.$eventHub.$on("clearAlerts", () => {
this.message = null;
});
}
});

View File

@ -92,7 +92,7 @@ function decrypt(
salt: Uint8Array,
passphrase: string,
nonce: Uint8Array
): Uint8Array {
): Uint8Array | null {
const key = SCRYPT(passphrase, Buffer.from(salt.buffer), 1 << 15, 8, 1, 32);
// This is a false positive, `secretbox.open` is unrelated to `fs.open`
// eslint-disable-next-line security/detect-non-literal-fs-filename

View File

@ -52,7 +52,7 @@ test("fails with incorrect password", () => {
);
var parsed = shards.map(s => crypto.parse(s));
expect(() => crypto.reconstruct(parsed, "")).toThrow(
new Error("Unable to decrypt the secret")
"Unable to decrypt the secret"
);
});