Page MenuHomePhabricator

[lib][native][web] add generate nonce action types
ClosedPublic

Authored by varun on Jan 30 2024, 8:22 PM.
Tags
None
Referenced Files
F3241508: D10880.id36544.diff
Wed, Nov 13, 6:52 PM
Unknown Object (File)
Wed, Nov 6, 8:05 PM
Unknown Object (File)
Wed, Oct 30, 12:26 AM
Unknown Object (File)
Fri, Oct 18, 2:45 PM
Unknown Object (File)
Oct 14 2024, 5:55 PM
Unknown Object (File)
Oct 14 2024, 5:55 PM
Unknown Object (File)
Oct 14 2024, 5:55 PM
Unknown Object (File)
Oct 14 2024, 5:55 PM
Subscribers
None

Details

Summary

This lets us get the nonce that we will use later in the SIWE message sent to the identity service

Depends on D10836

Test Plan

tested in next diff by actually dispatching the action and logging the nonce

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

varun requested review of this revision.Jan 30 2024, 8:41 PM
tomek requested changes to this revision.Jan 31 2024, 1:14 AM
tomek added inline comments.
lib/actions/user-actions.js
428–431 ↗(On Diff #36363)

We can consider replacing this check with invariant. It is always a programmer error when this hook is used in a place where IdentityClientContext isn't provided.

After this change we should be also able to replace the callback with a simple return return identityClient.generateNonce;.

lib/types/redux-types.js
423 ↗(On Diff #36363)

Are you sure this should be void? Shouldn't this be a string?

native/identity-service/identity-service-context-provider.react.js
267–269 ↗(On Diff #36363)

This doesn't need to be async - we're not awaiting anything. Also, the whole thing can be (probably) simplified.

web/grpc/identity-service-client-wrapper.js
318–320 ↗(On Diff #36363)

We don't need this check because unauthClient is mandatory

This revision now requires changes to proceed.Jan 31 2024, 1:14 AM
lib/types/redux-types.js
423 ↗(On Diff #36363)

Best to avoid making payload a string... I'd rather have an object payload with a single string inside

lib/types/redux-types.js
423 ↗(On Diff #36363)

Looking at D10881, there really is nothing in the payload

lib/actions/user-actions.js
420 ↗(On Diff #36363)

this should be identityGenerateNonceActionTypes

varun marked 6 inline comments as done.

address feedback

lib/types/redux-types.js
423 ↗(On Diff #36363)

right, we set the nonce in state but there is nothing in the payload

web/grpc/identity-service-client-wrapper.js
318–320 ↗(On Diff #36363)

good point

misunderstood feedback about replacing the callback

Accepting on @tomek's behalf, as he's off until Monday

This revision is now accepted and ready to land.Feb 1 2024, 11:26 AM