diff --git a/keyserver/flow-typed/npm/@commapp/olm_vx.x.x.js b/keyserver/flow-typed/npm/@commapp/olm_vx.x.x.js --- a/keyserver/flow-typed/npm/@commapp/olm_vx.x.x.js +++ b/keyserver/flow-typed/npm/@commapp/olm_vx.x.x.js @@ -32,7 +32,8 @@ remove_one_time_keys(session: Session): void; generate_prekey(): void; prekey(): string; - unpublished_prekey(): string; + unpublished_prekey(): ?string; + prekey_signature(): ?string; forget_old_prekey(): void; mark_prekey_as_published(): void; last_prekey_publish_time(): number; @@ -56,7 +57,9 @@ create_outbound( account: Account, their_identity_key: string, - their_pre_key: string, + their_signing_key: string, + their_prekey: string, + their_prekey_signature: string, their_one_time_key: string, ): void; create_inbound(account: Account, one_time_key_message: string): void; diff --git a/keyserver/package.json b/keyserver/package.json --- a/keyserver/package.json +++ b/keyserver/package.json @@ -41,7 +41,7 @@ }, "dependencies": { "@babel/runtime": "^7.13.10", - "@commapp/olm": "0.0.4", + "@commapp/olm": "0.0.7", "@parse/node-apn": "^3.2.0", "@vingle/bmp-js": "^0.2.5", "JSONStream": "^1.3.5", diff --git a/native/cpp/CommonCpp/CryptoTools/CryptoModule.h b/native/cpp/CommonCpp/CryptoTools/CryptoModule.h --- a/native/cpp/CommonCpp/CryptoTools/CryptoModule.h +++ b/native/cpp/CommonCpp/CryptoTools/CryptoModule.h @@ -49,6 +49,7 @@ const std::string &targetUserId, const OlmBuffer &idKeys, const OlmBuffer &preKeys, + const OlmBuffer &preKeySignature, const OlmBuffer &oneTimeKeys, size_t keyIndex = 0); bool hasSessionFor(const std::string &targetUserId); diff --git a/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp b/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp --- a/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp +++ b/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp @@ -138,6 +138,7 @@ const std::string &targetUserId, const OlmBuffer &idKeys, const OlmBuffer &preKeys, + const OlmBuffer &preKeySignature, const OlmBuffer &oneTimeKeys, size_t keyIndex) { if (this->hasSessionFor(targetUserId)) { @@ -150,6 +151,7 @@ this->keys.identityKeys.data(), idKeys, preKeys, + preKeySignature, oneTimeKeys, keyIndex); this->sessions.insert(make_pair(targetUserId, std::move(newSession))); diff --git a/native/cpp/CommonCpp/CryptoTools/Session.h b/native/cpp/CommonCpp/CryptoTools/Session.h --- a/native/cpp/CommonCpp/CryptoTools/Session.h +++ b/native/cpp/CommonCpp/CryptoTools/Session.h @@ -25,6 +25,7 @@ std::uint8_t *ownerIdentityKeys, const OlmBuffer &idKeys, const OlmBuffer &preKeys, + const OlmBuffer &preKeySignature, const OlmBuffer &oneTimeKeys, size_t keyIndex = 0); static std::unique_ptr createSessionAsResponder( diff --git a/native/cpp/CommonCpp/CryptoTools/Session.cpp b/native/cpp/CommonCpp/CryptoTools/Session.cpp --- a/native/cpp/CommonCpp/CryptoTools/Session.cpp +++ b/native/cpp/CommonCpp/CryptoTools/Session.cpp @@ -11,6 +11,7 @@ std::uint8_t *ownerIdentityKeys, const OlmBuffer &idKeys, const OlmBuffer &preKeys, + const OlmBuffer &preKeySignature, const OlmBuffer &oneTimeKeys, size_t keyIndex) { std::unique_ptr session(new Session(account, ownerIdentityKeys)); @@ -29,8 +30,12 @@ session->ownerUserAccount, idKeys.data() + ID_KEYS_PREFIX_OFFSET, KEYSIZE, + idKeys.data() + SIGNING_KEYS_PREFIX_OFFSET, + KEYSIZE, preKeys.data() + PRE_KEY_PREFIX_OFFSET, KEYSIZE, + preKeySignature.data(), + SIGNATURESIZE, oneTimeKeys.data() + ONE_TIME_KEYS_PREFIX_OFFSET + (KEYSIZE + ONE_TIME_KEYS_MIDDLE_OFFSET) * keyIndex, KEYSIZE, diff --git a/native/cpp/CommonCpp/CryptoTools/Tools.h b/native/cpp/CommonCpp/CryptoTools/Tools.h --- a/native/cpp/CommonCpp/CryptoTools/Tools.h +++ b/native/cpp/CommonCpp/CryptoTools/Tools.h @@ -6,8 +6,12 @@ #include "olm/olm.h" +// base64-encoded #define KEYSIZE 43 +#define SIGNATURESIZE 86 + #define ID_KEYS_PREFIX_OFFSET 15 +#define SIGNING_KEYS_PREFIX_OFFSET 71 #define PRE_KEY_PREFIX_OFFSET 25 #define ONE_TIME_KEYS_PREFIX_OFFSET 25 #define ONE_TIME_KEYS_MIDDLE_OFFSET 12 diff --git a/native/package.json b/native/package.json --- a/native/package.json +++ b/native/package.json @@ -86,7 +86,7 @@ "lodash": "^4.17.21", "lottie-react-native": "^5.1.4", "md5": "^2.2.1", - "olm": "git+https://github.com/CommE2E/olm.git#v0.0.4", + "olm": "git+https://github.com/CommE2E/olm.git#v0.0.7", "react": "18.1.0", "react-native": "^0.70.8", "react-native-background-upload": "^6.6.0", diff --git a/web/flow-typed/npm/@commapp/olm_vx.x.x.js b/web/flow-typed/npm/@commapp/olm_vx.x.x.js --- a/web/flow-typed/npm/@commapp/olm_vx.x.x.js +++ b/web/flow-typed/npm/@commapp/olm_vx.x.x.js @@ -32,7 +32,8 @@ remove_one_time_keys(session: Session): void; generate_prekey(): void; prekey(): string; - unpublished_prekey(): string; + unpublished_prekey(): ?string; + prekey_signature(): ?string; forget_old_prekey(): void; mark_prekey_as_published(): void; last_prekey_publish_time(): number; @@ -56,7 +57,9 @@ create_outbound( account: Account, their_identity_key: string, - their_pre_key: string, + their_signing_key: string, + their_prekey: string, + their_prekey_signature: string, their_one_time_key: string, ): void; create_inbound(account: Account, one_time_key_message: string): void; diff --git a/web/package.json b/web/package.json --- a/web/package.json +++ b/web/package.json @@ -35,7 +35,7 @@ }, "dependencies": { "@babel/runtime": "^7.13.10", - "@commapp/olm": "0.0.4", + "@commapp/olm": "0.0.7", "@commapp/opaque-ke-wasm": "npm:@commapp/opaque-ke-wasm@^0.0.3", "@emoji-mart/data": "^1.1.2", "@emoji-mart/react": "^1.1.1", diff --git a/yarn.lock b/yarn.lock --- a/yarn.lock +++ b/yarn.lock @@ -1719,10 +1719,10 @@ stream-browserify "^3.0.0" util "^0.12.4" -"@commapp/olm@0.0.4": - version "0.0.4" - resolved "https://registry.yarnpkg.com/@commapp/olm/-/olm-0.0.4.tgz#cbab890fdc8767ea5336b052d6b0f9ea698ffd36" - integrity sha512-gEh2QAMRzH21EKncwL9jTUdVD+ZgBRmKW0Q+RGe0P1R12iJq5PW6xZJFgV+tQLnhgVZviKNlz1R8KphXhSy2ww== +"@commapp/olm@0.0.6": + version "0.0.6" + resolved "https://registry.yarnpkg.com/@commapp/olm/-/olm-0.0.6.tgz#391d4f699d7f41a1cf711ac6765325cebf08e964" + integrity sha512-Y/590sZQmW/WS/hrdcJf4AKPff0/s2O/CdVg/4L00kU9KzoO0zSyD0anSRyYR/Q8Ym7Y2XpaLG8UFd+cf44NtA== "@commapp/opaque-ke-wasm@npm:@commapp/opaque-ke-wasm@^0.0.3": version "0.0.3" @@ -17845,9 +17845,9 @@ resolved "https://registry.yarnpkg.com/octokit-pagination-methods/-/octokit-pagination-methods-1.1.0.tgz#cf472edc9d551055f9ef73f6e42b4dbb4c80bea4" integrity sha512-fZ4qZdQ2nxJvtcasX7Ghl+WlWS/d9IgnBIwFZXVNNZUmzpno91SX5bc5vuxiuKoCtK78XxGGNuSCrDC7xYB3OQ== -"olm@git+https://github.com/CommE2E/olm.git#v0.0.4": +"olm@git+https://github.com/CommE2E/olm.git#v0.0.6": version "0.0.0" - resolved "git+https://github.com/CommE2E/olm.git#9ff2863a394399684e272c0665eb8629ef430714" + resolved "git+https://github.com/CommE2E/olm.git#59e96129d494ab6844cab93aa78cd9ede51d1547" on-finished@2.4.1: version "2.4.1"