Page MenuHomePhabricator

[native] identityRegisterUsernameAccount function
ClosedPublic

Authored by varun on Jan 8 2024, 10:38 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Oct 18, 1:24 AM
Unknown Object (File)
Fri, Oct 18, 1:24 AM
Unknown Object (File)
Fri, Oct 18, 1:24 AM
Unknown Object (File)
Fri, Oct 18, 1:24 AM
Unknown Object (File)
Fri, Oct 18, 1:24 AM
Unknown Object (File)
Fri, Oct 18, 1:24 AM
Unknown Object (File)
Fri, Oct 18, 1:24 AM
Unknown Object (File)
Fri, Oct 18, 1:24 AM
Subscribers

Details

Summary

introduce function that uses useIdentityRegister hook to register user with identity service

Test Plan

successfully registered new user with identity service. also confirmed that all the error cases are handled by displaying the correct alert.

Diff Detail

Repository
rCOMM Comm
Branch
deleteuser (branched from master)
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

varun held this revision as a draft.
native/account/registration/registration-server-call.js
121–142

i'll dedup this after i resolve my flow issue

native/account/registration/registration-server-call.js
119

flow complains when i try to return the result from callIdentityRegister here, but i think identityRegisterPromise should be a Promise<UserLoginResponse>, right?

varun published this revision for review.Jan 8 2024, 10:50 PM
varun removed reviewers: tomek, inka.

publishing now for @ashoat to take a look but will add other reviewers after flow issue is resolved

native/account/registration/registration-server-call.js
78

Issue 1 is that you're not invoking this function

Issue 2 is that the way you've set it up, in order to invoke the function you need all of the parameters

Instead of having useIdentityRegister be a function that takes the parameters and returns a new function that takes no parameters

You should have useIdentityRegister be a function that takes no parameters and returns a new function that takes the parameters

Working patch here

ashoat requested changes to this revision.Jan 9 2024, 4:49 AM

Back to you

This revision now requires changes to proceed.Jan 9 2024, 4:49 AM
ashoat requested changes to this revision.Jan 13 2024, 6:23 PM

I think the extraction of the alert messages should've been a separate diff.

Requesting change because I'm concerned about the reconstruction of keyPayload. I don't think we should be doing this in two separate places... it feels really brittle.

native/account/registration/registration-server-call.js
86–96 ↗(On Diff #35583)

These messages seem super inconsistent and a bit more like they were intended to be human-readable than matched as exact strings. I guess this is meant to be addressed in ENG-3841

195–202 ↗(On Diff #35583)

I assume you're going to address ETH users in a separate diff?

native/identity-service/identity-service-context-provider.react.js
95–99 ↗(On Diff #35583)

This is a really weird API... the signature is on the keyPayload generated below, right? I'm worried that the C++ code that generates the keyPayload may diverge from the JS code below. Why not just return the keyPayload directly, to guarantee that the signature matches up? Seems a lot less brittle

This revision now requires changes to proceed.Jan 13 2024, 6:23 PM
varun added inline comments.
native/account/registration/registration-server-call.js
86–96 ↗(On Diff #35583)

yeah these should be made consistent as part of that work

195–202 ↗(On Diff #35583)

yes

native/identity-service/identity-service-context-provider.react.js
95–99 ↗(On Diff #35583)

i was constructing keyPayload manually because the order of the identity keys mattered for olm session creation. however, @kamil has mitigated this by enforcing the ordering after the keys are pulled from the identity service (see line 92 in D10381, for example). i can just use blobPayload directly now

replace keyPayload with blobPayload

This revision is now accepted and ready to land.Jan 17 2024, 7:43 AM

simplify errors returned from native_rust_library

This revision now requires review to proceed.Jan 17 2024, 1:01 PM

undoing last revision. will do it in a separate diff

This revision is now accepted and ready to land.Jan 17 2024, 1:06 PM