Page MenuHomePhabricator

[native] get signed prekeys
ClosedPublic

Authored by varun on Sep 5 2023, 7:02 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, May 4, 12:06 PM
Unknown Object (File)
Sat, May 4, 12:06 PM
Unknown Object (File)
Sat, May 4, 12:06 PM
Unknown Object (File)
Sat, May 4, 12:03 PM
Unknown Object (File)
Sat, May 4, 11:30 AM
Unknown Object (File)
Wed, May 1, 10:33 PM
Unknown Object (File)
Thu, Apr 25, 11:58 PM
Unknown Object (File)
Apr 16 2024, 6:00 PM

Details

Summary

modify the existing generateAndGetPrekey function to return signed content and notif prekeys (prekey + signature)

Test Plan

console logged generateAndGetPrekeys from account-selectors.js and got the following:

LOG  {"contentPrekey": "{\"curve25519\":{\"AAAAAg\":\"9QT6LlKsgI+badfNPLMhlWon5GZjCBjFVTur/W/qRkY\"}}", "contentPrekeySignature": "T64w13LqXgw0M7F6d19qL5pQyfE+c86CdgNlckIPIQwiI+INDttUjxSNVaa9Vv0AMIqNC+2tq2NvzqTTPESCAg", "notifPrekey": "{\"curve25519\":{\"AAAAAg\":\"9cN8Gem9icUP869ydpukc9LkGXFj89ZZ1JT5IPma234\"}}", "notifPrekeySignature": "+CjQcbt4qKAMp2zQlAzg+zpJZ++OsLUjeMh9NuJVVoPNhPt7DEpPa1WEsYmH3hCEd8QqSxQM4lqH1mVvr3O3BA"}

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

varun requested review of this revision.Sep 5 2023, 7:21 AM
native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
570–578 ↗(On Diff #30764)

Is it possible to sign the entire prekey JSON:

{
    "contentPrekey": ."..",
     "notifPrekey": .".."
}

instead of signing both keys separately? When it comes to public keys we sign the entire payload of curve25519 and ed25519 for both content and notifs at once. What is the reason behind signing prekeys separately?

atul added a subscriber: bartek.

Would be good for @marcin or @bartek to take a closer look here

varun planned changes to this revision.Sep 6 2023, 9:57 PM

should be using olm_account_prekey_signature()

introduce new CryptoModule function to get signed prekey the correct way

marcin added inline comments.
native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
542–543 ↗(On Diff #30871)

I think those two should also but inside try{}catch{} since they might also fails as they are using the same methods of CryptoModule class under the hood. We are not doing so in other places but we probably should be.

This revision is now accepted and ready to land.Sep 11 2023, 5:12 AM
This revision was automatically updated to reflect the committed changes.