From c5043c92a881fc908eb0f0092e6a2079c21e79e5 Mon Sep 17 00:00:00 2001 From: mhelander Date: Mon, 29 Jan 2018 20:35:20 +0200 Subject: [PATCH] Some more little fixes to authrecall --- sea.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sea.js b/sea.js index b3611503..e386c848 100644 --- a/sea.js +++ b/sea.js @@ -505,12 +505,11 @@ const props = parseProps(await seaRead(remember, pub, true)) let { pin, alias: aLias } = props - if (!pin || alias === aLias) { - // No PIN, let's try short-term proof if for matching alias - pin = (await checkRememberData(props)).pin - } + return (!pin && alias === aLias) + // No PIN, let's try short-term proof if for matching alias + ? await checkRememberData(props) // Got PIN so get IndexedDB secret if signature is ok - return await checkRememberData(await readAndDecrypt(await seaIndexedDb.get(alias, 'auth'), pub, pin)) + : await checkRememberData(await readAndDecrypt(await seaIndexedDb.get(alias, 'auth'), pub, pin)) } // got pub, try auth with pin & alias :: or unwrap Storage data... const args = pin ? { pin, alias } : await readStorageData()