mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 19:56:47 +03:00
add logging for keytar/pickle key
and remember when we had key, so that we know that we should expect one
This commit is contained in:
parent
f8f9c4880a
commit
fbea8c61bb
1 changed files with 19 additions and 0 deletions
|
@ -306,6 +306,11 @@ async function _restoreFromLocalStorage(opts) {
|
|||
}
|
||||
|
||||
const pickleKey = await PlatformPeg.get().getPickleKey(userId, deviceId);
|
||||
if (pickleKey) {
|
||||
console.log("Got pickle key");
|
||||
} else {
|
||||
console.log("No pickle key available");
|
||||
}
|
||||
|
||||
console.log(`Restoring session for ${userId}`);
|
||||
await _doSetLoggedIn({
|
||||
|
@ -364,6 +369,12 @@ export async function setLoggedIn(credentials) {
|
|||
? await PlatformPeg.get().createPickleKey(credentials.userId, credentials.deviceId)
|
||||
: null;
|
||||
|
||||
if (pickleKey) {
|
||||
console.log("Created pickle key");
|
||||
} else {
|
||||
console.log("Pickle key not created");
|
||||
}
|
||||
|
||||
return _doSetLoggedIn(Object.assign({}, credentials, {pickleKey}), true);
|
||||
}
|
||||
|
||||
|
@ -501,6 +512,14 @@ function _persistCredentialsToLocalStorage(credentials) {
|
|||
localStorage.setItem("mx_access_token", credentials.accessToken);
|
||||
localStorage.setItem("mx_is_guest", JSON.stringify(credentials.guest));
|
||||
|
||||
if (credentials.pickleKey) {
|
||||
localStorage.setItem("mx_has_pickle_key", true);
|
||||
} else {
|
||||
if (localStorage.getItem("mx_has_pickle_key")) {
|
||||
console.error("Expected a pickle key, but none provided. Encryption may not work.");
|
||||
}
|
||||
}
|
||||
|
||||
// if we didn't get a deviceId from the login, leave mx_device_id unset,
|
||||
// rather than setting it to "undefined".
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue