Open johnsmith-gooddollar opened 2 years ago
@sirpy could you please assist here ? need your opinion
we need it to work just the same with identifier, email, mobile. the mnemonic is used to create the wallet and from it you can get the identifier
@sirpy it was removed from the server. could you please pick up and link here some old commits where it was still implemented ? how does mnemonics stored inside database ? is it some hash (sha3) over the phrase or it's derived from the pkey ?
its not related to server. mnemonic is instead of the private key received from torus. it is on client side. checking if user exists should happen just the same.
@sirpy it calls for server:
// We validate that a user was registered for the specified mnemonics
const { exists, fullName } = await userExists({ mnemonics })
log.debug('userExists result:', { exists, fullName })
but inside userExist the 'mnemonic' field isn't used it's also absent server side
@sirpy
i see in Mnemonic userExists
will check by identifier only
is this ok ?
i've adjusted and simplified user exists / check existing hooks: https://github.com/GoodDollar/GoodDAPP/commit/d941ce9ebe011eabcc99eb9e661d1412e161eb20
In mnemonics the mnemonic is still not used to create the wallet. so the identifier you take from the wallet is not correct. the mnemonic was passed so a temporary wallet can be created using that mnemonic and then be able to get the identifier for this mnemonic.
@sirpy then we need to create this temporary wallet before call userExists how we could do it ?
that's the old code https://github.com/GoodDollar/GoodDAPP/blob/2b61a82df3eda5379e588e3f7cdc893163aefa7a/src/lib/login/userExists.js but anyways lets put this on hold it is very low priority.
Now Mnemonic (Recover) component calls userExists with ({ mnemonics })
But this value isn't passed anywhere, also it doesn't processed on the server. In this case the request doesn't event sent because of identifier OR email OR mobile check and userExists returns exists: false immediately