Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3380506
D11446.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D11446.diff
View Options
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
@@ -1221,11 +1221,17 @@
promise->reject(error);
return;
}
- promise->resolve(jsi::String::createFromUtf8(
+ auto encryptedDataJSI = jsi::Object(innerRt);
+ auto message = std::string{
+ encryptedMessage.message.begin(),
+ encryptedMessage.message.end()};
+ auto messageJSI = jsi::String::createFromUtf8(innerRt, message);
+ encryptedDataJSI.setProperty(innerRt, "message", messageJSI);
+ encryptedDataJSI.setProperty(
innerRt,
- std::string{
- encryptedMessage.message.begin(),
- encryptedMessage.message.end()}));
+ "messageType",
+ static_cast<int>(encryptedMessage.messageType));
+ promise->resolve(std::move(encryptedDataJSI));
});
};
this->cryptoThread->scheduleTask(job);
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
@@ -6,8 +6,6 @@
type OneTimeKeysResultValues,
type OlmAPI,
type OLMIdentityKeys,
- type EncryptedData,
- olmEncryptedMessageTypes,
} from 'lib/types/crypto-types.js';
import type { OlmSessionInitializationInfo } from 'lib/types/request-types.js';
@@ -18,13 +16,7 @@
await commCoreModule.initializeCryptoAccount();
},
getUserPublicKey: commCoreModule.getUserPublicKey,
- async encrypt(content: string, deviceID: string): Promise<EncryptedData> {
- const encryptedContent = await commCoreModule.encrypt(content, deviceID);
- return {
- message: encryptedContent,
- messageType: olmEncryptedMessageTypes.TEXT,
- };
- },
+ encrypt: commCoreModule.encrypt,
decrypt: commCoreModule.decrypt,
async contentInboundSessionCreator(
contentIdentityKeys: OLMIdentityKeys,
diff --git a/native/schema/CommCoreModuleSchema.js b/native/schema/CommCoreModuleSchema.js
--- a/native/schema/CommCoreModuleSchema.js
+++ b/native/schema/CommCoreModuleSchema.js
@@ -16,7 +16,8 @@
OneTimeKeysResult,
SignedPrekeys,
ClientPublicKeys,
-} from 'lib/types/crypto-types';
+ EncryptedData,
+} from 'lib/types/crypto-types.js';
import type { ClientDBDraftStoreOperation } from 'lib/types/draft-types.js';
import type { ClientDBMessageInfo } from 'lib/types/message-types.js';
import type { ClientDBStore } from 'lib/types/store-ops-types';
@@ -107,7 +108,7 @@
encryptedMessage: string,
deviceID: string,
) => Promise<string>;
- +encrypt: (message: string, deviceID: string) => Promise<string>;
+ +encrypt: (message: string, deviceID: string) => Promise<EncryptedData>;
+decrypt: (message: string, deviceID: string) => Promise<string>;
+signMessage: (message: string) => Promise<string>;
+getCodeVersion: () => number;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 29, 12:12 AM (20 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2595239
Default Alt Text
D11446.diff (3 KB)
Attached To
Mode
D11446: [native] update `encrypt` method to return `EncryptedData`
Attached
Detach File
Event Timeline
Log In to Comment