Page MenuHomePhabricator

[native] Add Olm account sign function to commCoreModule
ClosedPublic

Authored by bartek on Feb 12 2024, 6:23 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 7, 2:01 AM
Unknown Object (File)
Oct 15 2024, 6:36 PM
Unknown Object (File)
Oct 15 2024, 6:36 PM
Unknown Object (File)
Oct 15 2024, 6:36 PM
Unknown Object (File)
Oct 15 2024, 6:36 PM
Unknown Object (File)
Oct 15 2024, 6:36 PM
Unknown Object (File)
Sep 4 2024, 12:25 PM
Unknown Object (File)
Sep 4 2024, 12:25 PM
Subscribers

Details

Summary

This exposes the function to sign messages with Olm account to JS. This is a counterpart of Account.sign() on web/keyserver.

Test Plan

Used online Ed25519 tool to verify generated values:

await commCoreModule.initializeCryptoAccount();
// used primaryIdentityPublicKeys.ed25519
const keys = await commCoreModule.getUserPublicKey();
const message = JSON.stringify({ hello: 'world '});
const signature = await commCoreModule.signMessage(message);
console.log({ keys, message, signature });

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bartek held this revision as a draft.
bartek retitled this revision from [native] Olm account sign function to commCoreModule to [native] Add Olm account sign function to commCoreModule.Feb 12 2024, 6:25 AM
bartek published this revision for review.Feb 12 2024, 6:48 AM

Used online Ed25519 tool to verify generated values:

I prefer to use our JS olm version - you can easily test it by adding a simple couple of lines in olm-utils.test.js, but in terms of verifying this is also okay to use this tool though.

native/cpp/CommonCpp/NativeModules/CommCoreModule.h
142 ↗(On Diff #36995)

it's already messed but could you move it above to group it with other crypt-related functions (after the decrypt() for example)

marcin added inline comments.
native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
1470 ↗(On Diff #36995)

You can immediately reject the promise here and early return. It will allow you to reduce indentation when you call cryptoModule. It is our convention to avoid indentation.

This revision is now accepted and ready to land.Feb 13 2024, 12:00 AM
native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
1470 ↗(On Diff #36995)

good call, I'll do it

native/cpp/CommonCpp/NativeModules/CommCoreModule.h
142 ↗(On Diff #36995)

sure!