HomePhabricator
Diffusion Comm 6d42130d4255

[keyserver] Introduce `createSIWEAccount` and use in `siweAuthResponder`

Description

[keyserver] Introduce createSIWEAccount and use in siweAuthResponder

Summary:
Introduce createSIWEAccount(...) and use in siweAuthResponder to create an account for an address if it doesn't already exist.

NOTE: This differs with how we do things currently for "password login" where the register and login endpoints both send back SUCCESS payloads with the necessary data to "log the user in" on the client. For SIWE the createSIWEAccount will only do account creation if necessary and will leave fetching to processSuccessfulLogin which will construct the SUCCESS payload (LogInResponse) and send it back to the client. This simplifies things on the client because we only have to handle one type of response from the siwe_auth endpoint. We should just be able to add | action.type === siweAuthActionTypes.success to all the reducers on the client where we check logInActionTypes.success and we should be good to go. Please let me know if there's somethign I'm missing that requires us to send back separate payloads for registration/login.

Depends on D6076

Test Plan: Will do thorough testing after I've put up rest of the stack + before landing.

Reviewers: ashoat, tomek

Reviewed By: ashoat

Differential Revision: https://phab.comm.dev/D6077

Details

Provenance
atulAuthored on Dec 29 2022, 1:43 PM
Reviewer
ashoat
Differential Revision
D6077: [keyserver] Introduce `createSIWEAccount` and use in `siweAuthResponder`
Parents
rCOMM2e65a4c16214: [web] introduce useOnClickReact hook in reaction message utils
Branches
Unknown
Tags
Unknown