mirror of
https://github.com/vector-im/element-desktop.git
synced 2024-09-09 22:05:10 +00:00
Ensure new passphrase is stored in keytar
This commit is contained in:
parent
1fa6671a17
commit
b7dd4e53a3
1 changed files with 3 additions and 7 deletions
|
@ -98,12 +98,6 @@ if (argv["help"]) {
|
||||||
app.exit();
|
app.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
function delay(timeout) {
|
|
||||||
return new Promise(res => {
|
|
||||||
setTimeout(() => res(), timeout);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Electron creates the user data directory (with just an empty 'Dictionaries' directory...)
|
// Electron creates the user data directory (with just an empty 'Dictionaries' directory...)
|
||||||
// as soon as the app path is set, so pick a random path in it that must exist if it's a
|
// as soon as the app path is set, so pick a random path in it that must exist if it's a
|
||||||
// real user data directory.
|
// real user data directory.
|
||||||
|
@ -508,7 +502,9 @@ async function getOrCreatePassphrase(key) {
|
||||||
if (storedPassphrase !== null) {
|
if (storedPassphrase !== null) {
|
||||||
return storedPassphrase;
|
return storedPassphrase;
|
||||||
} else {
|
} else {
|
||||||
return await randomArray(32);
|
const newPassphrase = await randomArray(32);
|
||||||
|
await keytar.setPassword("element.io", key, newPassphrase);
|
||||||
|
return newPassphrase;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("Error getting the event index passphrase out of the secret store", e);
|
console.log("Error getting the event index passphrase out of the secret store", e);
|
||||||
|
|
Loading…
Reference in a new issue