consensusnetworks / casimir

🌊 Decentralized staking and asset management
https://casimir.co
Other
6 stars 3 forks source link

Add nonce fetch and generation to auth service login flow #185

Closed shanejearley closed 1 year ago

shanejearley commented 1 year ago

In the auth service create an auth/{userAddress}/message route with get and post methods to fetch a given user's login message string and update it with some pseudo-random value, respectively. Also, add getMessage(userAddress) to both @/composables/users.ts and the auth service. The former should call the latter using fetch.

The user ID may be hard coded so that you can mock the user DB collection (users: [{ address: '', nonce: '' }].

Then you can update the @casimir/web login method and the auth service:

shanejearley commented 1 year ago

Updated everything above to stay in the existing auth service and composable rather than adding the users service (soon we'll use that but mainly for handing user data). Seemed to make more sense since everything here (including storing the login message for each user) was auth-centric.

Fortunately, hopefully, this should also simplify things as far as the task goes.