Page MenuHomePhabricator

[CommRustModule] implement `getInboundKeys`
ClosedPublic

Authored by kamil on Dec 18 2023, 4:34 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Oct 18, 1:09 AM
Unknown Object (File)
Fri, Oct 18, 1:09 AM
Unknown Object (File)
Fri, Oct 18, 1:09 AM
Unknown Object (File)
Fri, Oct 18, 1:09 AM
Unknown Object (File)
Fri, Oct 18, 1:09 AM
Unknown Object (File)
Fri, Oct 18, 1:08 AM
Unknown Object (File)
Sep 18 2024, 4:46 AM
Unknown Object (File)
Sep 16 2024, 12:47 AM

Details

Summary

There is some code duplications between this and getOutboundKeys but I am afraid trying to unify this will make the code more messy.

Depends on D10373

Test Plan
  1. Login to staging Identity (loginPasswordUser) on two devices using the same account.
  2. Call this method and check if the result is correct.

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

kamil held this revision as a draft.
kamil published this revision for review.Dec 18 2023, 6:49 AM
marcin added 2 blocking reviewer(s): michal, varun.

Rust expert should review this diff.

michal requested changes to this revision.Dec 21 2023, 5:39 AM
michal added inline comments.
lib/types/identity-service-types.js
28 ↗(On Diff #34788)

Should this be merged with InboundKeyInfoResponse in keyserver/addons/rust-node-addon/rust-bindings-types.js (and put in lib-types-identity-service-types)?

native/native_rust_library/src/lib.rs
130–131 ↗(On Diff #34788)

Let's keep the naming consistent (please also change the name of the _helper function)

807 ↗(On Diff #34788)

We should probably add a comment like for OutboundKeyInfoResponse to keep types in sync.

It would be good to merge this with InboundKeyInfoResponse from keyserver/addons/rust-node-addon/src/identity_client/mod.rs, but it might be harder than merging the JS equivalents.
The keyserver struct has #[napi(object)] attribute which (I assume, cc @varun) would have to be applied in the same crate that this struct is defined in. This would probably mean moving it to comm-lib and adding a feature for napi and applying this attribute conditionally (e.g. #[cfg_attr(feature = "napi", napi(object))]). Not sure if it's worth it.

This revision now requires changes to proceed.Dec 21 2023, 5:39 AM

address review

lib/types/identity-service-types.js
28 ↗(On Diff #34788)

yeah!

native/native_rust_library/src/lib.rs
130–131 ↗(On Diff #34788)

done

807 ↗(On Diff #34788)

create task for this: ENG-6330

varun requested changes to this revision.Jan 2 2024, 9:02 AM
varun added inline comments.
native/cpp/CommonCpp/NativeModules/CommRustModule.cpp
270 ↗(On Diff #35140)

as @tomek pointed out in D10449, we aren't actually doing anything with error here (or any of the other methods in this file, for that matter).

I think we need something like this after the try-block:

if (!error.empty()) {
  this->jsInvoker_->invokeAsync([error, promise]() {
    promise->reject(error);
  });
}
This revision now requires changes to proceed.Jan 2 2024, 9:02 AM
kamil requested review of this revision.Jan 4 2024, 3:59 AM
kamil added inline comments.
native/cpp/CommonCpp/NativeModules/CommRustModule.cpp
270 ↗(On Diff #35140)
marcin added inline comments.
native/cpp/CommonCpp/NativeModules/CommRustModule.cpp
257 ↗(On Diff #35140)

Sorry for interrupting after resigning as a reviewer but I've just realized that here we have the same issue as in D10510

varun added inline comments.
native/native_rust_library/src/lib.rs
980 ↗(On Diff #35140)

typo here

This revision is now accepted and ready to land.Jan 4 2024, 10:48 AM
This revision was landed with ongoing or failed builds.Jan 8 2024, 6:48 AM
This revision was automatically updated to reflect the committed changes.