fall back to the old method if the default key isn't available

pull/21833/head
Hubert Chathi 2021-02-24 17:55:27 -05:00
parent a61462bc85
commit 5f74fac2e8
1 changed files with 5 additions and 2 deletions

View File

@ -105,9 +105,12 @@ async function getSecretStorageKey(
// use the default SSSS key if set // use the default SSSS key if set
keyInfo = keyInfos[keyId]; keyInfo = keyInfos[keyId];
if (!keyInfo) { if (!keyInfo) {
throw new Error("Unable to use default SSSS key"); // if the default key is not available, pretend the default key
// isn't set
keyId = undefined;
} }
} else { }
if (!keyId) {
// if no default SSSS key is set, fall back to a heuristic of using the // if no default SSSS key is set, fall back to a heuristic of using the
// only available key, if only one key is set // only available key, if only one key is set
const keyInfoEntries = Object.entries(keyInfos); const keyInfoEntries = Object.entries(keyInfos);