Page MenuHomePhabricator

[web] implementing publishing prekeys to Identity
ClosedPublic

Authored by kamil on Feb 19 2024, 8:28 AM.
Tags
None
Referenced Files
F2113420: D11110.id37487.diff
Wed, Jun 26, 3:37 AM
F2110301: D11110.id37585.diff
Tue, Jun 25, 7:20 PM
Unknown Object (File)
Sun, Jun 23, 12:16 AM
Unknown Object (File)
Thu, Jun 20, 8:02 AM
Unknown Object (File)
Thu, Jun 13, 3:58 PM
Unknown Object (File)
Tue, Jun 11, 6:44 PM
Unknown Object (File)
Sat, Jun 1, 1:29 AM
Unknown Object (File)
Wed, May 29, 7:32 AM
Subscribers

Details

Summary

This code is web specific - so I think it's butter to implement it this way than adding this to IdentityServiceClient and mocking on native.
On native this method is used only from C++ level and is not exposed to JS.

Depends on D11109

Test Plan

Call this method and check in staging DDB that prekeys were updated.

await publishPrekeysToIdentity({
  contentPrekey: 'test0',
  contentPrekeySignature: 'test1',
  notifPrekey: 'test2',
  notifPrekeySignature: 'test3',
}, identityClient);

image.png (928×2 px, 152 KB)

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kamil held this revision as a draft.
kamil published this revision for review.Feb 19 2024, 9:37 AM

This code is web specific - so I think it's butter to implement it this way than adding this to IdentityServiceClient and mocking on native.

I think there's a benefit to having everything in one place. It looks like registerUser only works on native, so we're already taking this approach in IdentityServiceClient.

On native this method is used only from C++ level and is not exposed to JS.

Can you explain why we have a single call to handle both prekey rotation and publishing on native, but separate calls on web? Ideally we would have a unified approach across platforms.

Separately, can you clarify if marking as published is handled separately?

tomek requested changes to this revision.Feb 21 2024, 2:56 AM

I think that keeping the solution as symmetrical as possible is a good idea. In this case, we should probably add it to IdentityServiceClient. If we can expose it also on native, it would be even better. And we should determine why there's an asymmetry of how the keys are uploaded and ideally make it consistent.

This revision now requires changes to proceed.Feb 21 2024, 2:56 AM

move code to IdentityServiceClient

This code is web specific - so I think it's butter to implement it this way than adding this to IdentityServiceClient and mocking on native.

I think there's a benefit to having everything in one place. It looks like registerUser only works on native, so we're already taking this approach in IdentityServiceClient.

Fair - if we already have the approach I will add it to IdentityServiceClient.

On native this method is used only from C++ level and is not exposed to JS.

Can you explain why we have a single call to handle both prekey rotation and publishing on native, but separate calls on web? Ideally we would have a unified approach across platforms.

Native:
It was introduced in D10600 and D10631. We first rotate prekeys, then attempt to upload and after success mark as published, - that's why we don't need to expose Identity call to JS.

Web:
I want to make the same approach here - but the difference is that publishPrekeysToIdentity has to be implemented in JS.

Separately, can you clarify if marking as published is handled separately?

It is - I'll add a diff later in the stack.

I think that keeping the solution as symmetrical as possible is a good idea. In this case, we should probably add it to IdentityServiceClient. If we can expose it also on native, it would be even better. And we should determine why there's an asymmetry of how the keys are uploaded and ideally make it consistent.

The asymmetry comes from the fact that on native Identity RPC is used only from the C++ level so it's "hidden" from the JS level - on the web this is not possible, but for now I don't think there is any benefit with exposing it on native. It could change after ENG-6490 and ENG-6768 are done.

This revision is now accepted and ready to land.Feb 23 2024, 4:01 AM
lib/types/identity-service-types.js
128 ↗(On Diff #37487)

Might be good to rename this to publishWebPrekeys for clarity, and to add a comment explaining why we only have it for web

rename to publishWebPrekeys

This revision was landed with ongoing or failed builds.Feb 26 2024, 5:46 AM
This revision was automatically updated to reflect the committed changes.

This part was skipped:

and to add a comment explaining why we only have it for web

This part was skipped:

and to add a comment explaining why we only have it for web

Right, thanks for catching it.

D11239