mirror of
https://github.com/amark/gun.git
synced 2025-06-07 14:46:44 +00:00
Refactoring mistakes fixed again to authrecall
This commit is contained in:
parent
2c042fcf15
commit
bc2e51ffd8
8
sea.js
8
sea.js
@ -499,7 +499,8 @@
|
|||||||
let err
|
let err
|
||||||
// Yes, then attempt to log into each one until we find ours!
|
// Yes, then attempt to log into each one until we find ours!
|
||||||
// (if two users have the same username AND the same password... that would be bad)
|
// (if two users have the same username AND the same password... that would be bad)
|
||||||
const [ key ] = await Promise.all(aliases.filter(({ at: { put } = {} }) => !!put)
|
const [ { key, at, proof } ] =
|
||||||
|
(await Promise.all(aliases.filter(({ at: { put } = {} }) => !!put))
|
||||||
.map(async ({ at, pub }) => {
|
.map(async ({ at, pub }) => {
|
||||||
const readStorageData = async () => {
|
const readStorageData = async () => {
|
||||||
const props = parseProps(await seaRead(remember, pub, true))
|
const props = parseProps(await seaRead(remember, pub, true))
|
||||||
@ -538,7 +539,7 @@
|
|||||||
const { epub } = at.put
|
const { epub } = at.put
|
||||||
// Success! we've found our private data!
|
// Success! we've found our private data!
|
||||||
err = null
|
err = null
|
||||||
return { proof, pub, priv, epriv, epub }
|
return { proof, at, key: { pub, priv, epriv, epub } }
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
err = 'Failed to decrypt private key!'
|
err = 'Failed to decrypt private key!'
|
||||||
return
|
return
|
||||||
@ -552,9 +553,6 @@
|
|||||||
// now we have AES decrypted the private key,
|
// now we have AES decrypted the private key,
|
||||||
// if we were successful, then that means we're logged in!
|
// if we were successful, then that means we're logged in!
|
||||||
try {
|
try {
|
||||||
const { proof } = key
|
|
||||||
delete key.proof
|
|
||||||
|
|
||||||
await updatestorage(proof, key, pin)(key)
|
await updatestorage(proof, key, pin)(key)
|
||||||
|
|
||||||
const user = Object.assign(key, { at, proof })
|
const user = Object.assign(key, { at, proof })
|
||||||
|
Loading…
x
Reference in New Issue
Block a user