near / fast-auth-signer

https://fast-auth-signer.vercel.app
MIT License
30 stars 9 forks source link

Improve on account id retrival #178

Closed hcho112 closed 7 months ago

hcho112 commented 7 months ago

This PR contains improvement on fetching account id from public key.

  1. Attempt to check with firebase first instead of kitwallet
  2. Attempt to retrieve cached account id first before calling external source.

Background: Currently the performance of the kitwallet is non-deterministic and we rather checks for firebase first and if there is no record, it will return response much quicker than kit wallet so overall it will improve UX.

vercel[bot] commented 7 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fast-auth-signer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 22, 2024 0:12am
hcho112 commented 7 months ago

@Pessina I have updated the PR based on your feedback. I have also made some enhancement on top of your feedback. On fetchAccountId, there is new arg called options (optional) where it allow skipCache and returnEmpty

skipCache -> force it to skip from retrieving locally, only use to get it from external source returnEmpty -> force it to return empty accountIds instead of error it out

These are used in specific flow where: When user authenticate/signin using passkey(finger print), based on its nature, it actually returns two keys and we need to figure out which one is the full access key that in on chain. This means that it will always have one key that is invalid. But we don't want to error this out and keep track error log because this is natural behaviour of web-authen based passkey.