Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3374019
D12749.id42865.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
10 KB
Referenced Files
None
Subscribers
None
D12749.id42865.diff
View Options
diff --git a/lib/tunnelbroker/use-peer-to-peer-message-handler.js b/lib/tunnelbroker/use-peer-to-peer-message-handler.js
--- a/lib/tunnelbroker/use-peer-to-peer-message-handler.js
+++ b/lib/tunnelbroker/use-peer-to-peer-message-handler.js
@@ -202,7 +202,7 @@
} else if (message.type === peerToPeerMessageTypes.ENCRYPTED_MESSAGE) {
try {
await olmAPI.initializeCryptoAccount();
- const decrypted = await olmAPI.decryptSequentialAndPersist(
+ const decrypted = await olmAPI.decryptAndPersist(
message.encryptedData,
message.senderInfo.deviceID,
messageID,
diff --git a/lib/types/crypto-types.js b/lib/types/crypto-types.js
--- a/lib/types/crypto-types.js
+++ b/lib/types/crypto-types.js
@@ -152,7 +152,7 @@
messageID: string,
) => Promise<EncryptedData>,
+decrypt: (encryptedData: EncryptedData, deviceID: string) => Promise<string>,
- +decryptSequentialAndPersist: (
+ +decryptAndPersist: (
encryptedData: EncryptedData,
deviceID: string,
messageID: string,
diff --git a/lib/utils/__mocks__/config.js b/lib/utils/__mocks__/config.js
--- a/lib/utils/__mocks__/config.js
+++ b/lib/utils/__mocks__/config.js
@@ -18,7 +18,7 @@
encrypt: jest.fn(),
encryptAndPersist: jest.fn(),
decrypt: jest.fn(),
- decryptSequentialAndPersist: jest.fn(),
+ decryptAndPersist: jest.fn(),
contentInboundSessionCreator: jest.fn(),
contentOutboundSessionCreator: jest.fn(),
notificationsSessionCreator: jest.fn(),
diff --git a/native/cpp/CommonCpp/NativeModules/CommCoreModule.h b/native/cpp/CommonCpp/NativeModules/CommCoreModule.h
--- a/native/cpp/CommonCpp/NativeModules/CommCoreModule.h
+++ b/native/cpp/CommonCpp/NativeModules/CommCoreModule.h
@@ -144,7 +144,7 @@
jsi::Runtime &rt,
jsi::Object encryptedDataJSI,
jsi::String deviceID) override;
- virtual jsi::Value decryptSequentialAndPersist(
+ virtual jsi::Value decryptAndPersist(
jsi::Runtime &rt,
jsi::Object encryptedDataJSI,
jsi::String deviceID,
diff --git a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp b/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
--- a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
+++ b/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
@@ -1604,7 +1604,7 @@
});
}
-jsi::Value CommCoreModule::decryptSequentialAndPersist(
+jsi::Value CommCoreModule::decryptAndPersist(
jsi::Runtime &rt,
jsi::Object encryptedDataJSI,
jsi::String deviceID,
@@ -1624,8 +1624,8 @@
crypto::EncryptedData encryptedData{
std::vector<uint8_t>(message.begin(), message.end()),
messageType};
- decryptedMessage = this->contentCryptoModule->decryptSequential(
- deviceIDCpp, encryptedData);
+ decryptedMessage =
+ this->contentCryptoModule->decrypt(deviceIDCpp, encryptedData);
std::string storedSecretKey =
getAccountDataKey(secureStoreAccountDataKey);
diff --git a/native/cpp/CommonCpp/_generated/commJSI-generated.cpp b/native/cpp/CommonCpp/_generated/commJSI-generated.cpp
--- a/native/cpp/CommonCpp/_generated/commJSI-generated.cpp
+++ b/native/cpp/CommonCpp/_generated/commJSI-generated.cpp
@@ -93,8 +93,8 @@
static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_decrypt(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->decrypt(rt, args[0].asObject(rt), args[1].asString(rt));
}
-static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_decryptSequentialAndPersist(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
- return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->decryptSequentialAndPersist(rt, args[0].asObject(rt), args[1].asString(rt), args[2].asString(rt));
+static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_decryptAndPersist(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
+ return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->decryptAndPersist(rt, args[0].asObject(rt), args[1].asString(rt), args[2].asString(rt));
}
static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_signMessage(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->signMessage(rt, args[0].asString(rt));
@@ -246,7 +246,7 @@
methodMap_["encrypt"] = MethodMetadata {2, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_encrypt};
methodMap_["encryptAndPersist"] = MethodMetadata {3, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_encryptAndPersist};
methodMap_["decrypt"] = MethodMetadata {2, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_decrypt};
- methodMap_["decryptSequentialAndPersist"] = MethodMetadata {3, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_decryptSequentialAndPersist};
+ methodMap_["decryptAndPersist"] = MethodMetadata {3, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_decryptAndPersist};
methodMap_["signMessage"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_signMessage};
methodMap_["verifySignature"] = MethodMetadata {3, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_verifySignature};
methodMap_["getCodeVersion"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getCodeVersion};
diff --git a/native/cpp/CommonCpp/_generated/commJSI.h b/native/cpp/CommonCpp/_generated/commJSI.h
--- a/native/cpp/CommonCpp/_generated/commJSI.h
+++ b/native/cpp/CommonCpp/_generated/commJSI.h
@@ -46,7 +46,7 @@
virtual jsi::Value encrypt(jsi::Runtime &rt, jsi::String message, jsi::String deviceID) = 0;
virtual jsi::Value encryptAndPersist(jsi::Runtime &rt, jsi::String message, jsi::String deviceID, jsi::String messageID) = 0;
virtual jsi::Value decrypt(jsi::Runtime &rt, jsi::Object encryptedData, jsi::String deviceID) = 0;
- virtual jsi::Value decryptSequentialAndPersist(jsi::Runtime &rt, jsi::Object encryptedData, jsi::String deviceID, jsi::String messageID) = 0;
+ virtual jsi::Value decryptAndPersist(jsi::Runtime &rt, jsi::Object encryptedData, jsi::String deviceID, jsi::String messageID) = 0;
virtual jsi::Value signMessage(jsi::Runtime &rt, jsi::String message) = 0;
virtual jsi::Value verifySignature(jsi::Runtime &rt, jsi::String publicKey, jsi::String message, jsi::String signature) = 0;
virtual double getCodeVersion(jsi::Runtime &rt) = 0;
@@ -315,13 +315,13 @@
return bridging::callFromJs<jsi::Value>(
rt, &T::decrypt, jsInvoker_, instance_, std::move(encryptedData), std::move(deviceID));
}
- jsi::Value decryptSequentialAndPersist(jsi::Runtime &rt, jsi::Object encryptedData, jsi::String deviceID, jsi::String messageID) override {
+ jsi::Value decryptAndPersist(jsi::Runtime &rt, jsi::Object encryptedData, jsi::String deviceID, jsi::String messageID) override {
static_assert(
- bridging::getParameterCount(&T::decryptSequentialAndPersist) == 4,
- "Expected decryptSequentialAndPersist(...) to have 4 parameters");
+ bridging::getParameterCount(&T::decryptAndPersist) == 4,
+ "Expected decryptAndPersist(...) to have 4 parameters");
return bridging::callFromJs<jsi::Value>(
- rt, &T::decryptSequentialAndPersist, jsInvoker_, instance_, std::move(encryptedData), std::move(deviceID), std::move(messageID));
+ rt, &T::decryptAndPersist, jsInvoker_, instance_, std::move(encryptedData), std::move(deviceID), std::move(messageID));
}
jsi::Value signMessage(jsi::Runtime &rt, jsi::String message) override {
static_assert(
diff --git a/native/crypto/olm-api.js b/native/crypto/olm-api.js
--- a/native/crypto/olm-api.js
+++ b/native/crypto/olm-api.js
@@ -22,7 +22,7 @@
encrypt: commCoreModule.encrypt,
encryptAndPersist: commCoreModule.encryptAndPersist,
decrypt: commCoreModule.decrypt,
- decryptSequentialAndPersist: commCoreModule.decryptSequentialAndPersist,
+ decryptAndPersist: commCoreModule.decryptAndPersist,
async contentInboundSessionCreator(
contentIdentityKeys: OLMIdentityKeys,
initialEncryptedData: EncryptedData,
diff --git a/native/schema/CommCoreModuleSchema.js b/native/schema/CommCoreModuleSchema.js
--- a/native/schema/CommCoreModuleSchema.js
+++ b/native/schema/CommCoreModuleSchema.js
@@ -98,7 +98,7 @@
messageID: string,
) => Promise<EncryptedData>;
+decrypt: (encryptedData: Object, deviceID: string) => Promise<string>;
- +decryptSequentialAndPersist: (
+ +decryptAndPersist: (
encryptedData: Object,
deviceID: string,
messageID: string,
@@ -185,7 +185,7 @@
backupID: string,
) => Promise<ArrayBuffer>;
+decrypt: (encryptedData: EncryptedData, deviceID: string) => Promise<string>;
- +decryptSequentialAndPersist: (
+ +decryptAndPersist: (
encryptedData: EncryptedData,
deviceID: string,
messageID: string,
diff --git a/web/crypto/olm-api.js b/web/crypto/olm-api.js
--- a/web/crypto/olm-api.js
+++ b/web/crypto/olm-api.js
@@ -47,7 +47,7 @@
encrypt: proxyToWorker('encrypt'),
encryptAndPersist: proxyToWorker('encryptAndPersist'),
decrypt: proxyToWorker('decrypt'),
- decryptSequentialAndPersist: proxyToWorker('decryptSequentialAndPersist'),
+ decryptAndPersist: proxyToWorker('decryptAndPersist'),
contentInboundSessionCreator: proxyToWorker('contentInboundSessionCreator'),
contentOutboundSessionCreator: proxyToWorker('contentOutboundSessionCreator'),
notificationsSessionCreator: proxyToWorker('notificationsSessionCreator'),
diff --git a/web/shared-worker/worker/worker-crypto.js b/web/shared-worker/worker/worker-crypto.js
--- a/web/shared-worker/worker/worker-crypto.js
+++ b/web/shared-worker/worker/worker-crypto.js
@@ -512,7 +512,7 @@
return result;
},
- async decryptSequentialAndPersist(
+ async decryptAndPersist(
encryptedData: EncryptedData,
deviceID: string,
messageID: string,
@@ -526,7 +526,7 @@
throw new Error(`No session for deviceID: ${deviceID}`);
}
- const result = olmSession.session.decrypt_sequential(
+ const result = olmSession.session.decrypt(
encryptedData.messageType,
encryptedData.message,
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 27, 1:16 PM (20 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2590520
Default Alt Text
D12749.id42865.diff (10 KB)
Attached To
Mode
D12749: [lib] Stop requiring sequential messages
Attached
Detach File
Event Timeline
Log In to Comment