Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33223947
D11447.1768559349.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D11447.1768559349.diff
View Options
diff --git a/lib/handlers/peer-to-peer-message-handler.js b/lib/handlers/peer-to-peer-message-handler.js
--- a/lib/handlers/peer-to-peer-message-handler.js
+++ b/lib/handlers/peer-to-peer-message-handler.js
@@ -1,5 +1,6 @@
// @flow
+import { olmEncryptedMessageTypes } from '../types/crypto-types.js';
import type {
IdentityServiceClient,
DeviceOlmInboundKeys,
@@ -49,7 +50,10 @@
try {
await olmAPI.initializeCryptoAccount();
const decrypted = await olmAPI.decrypt(
- message.encryptedContent,
+ {
+ messageType: olmEncryptedMessageTypes.TEXT,
+ message: message.encryptedContent,
+ },
message.senderInfo.deviceID,
);
console.log(
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
@@ -136,7 +136,7 @@
+initializeCryptoAccount: () => Promise<void>,
+getUserPublicKey: () => Promise<ClientPublicKeys>,
+encrypt: (content: string, deviceID: string) => Promise<EncryptedData>,
- +decrypt: (encryptedContent: string, deviceID: string) => Promise<string>,
+ +decrypt: (encryptedData: EncryptedData, deviceID: string) => Promise<string>,
+contentInboundSessionCreator: (
contentIdentityKeys: OLMIdentityKeys,
initialEncryptedContent: string,
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,6 +6,7 @@
type OneTimeKeysResultValues,
type OlmAPI,
type OLMIdentityKeys,
+ type EncryptedData,
} from 'lib/types/crypto-types.js';
import type { OlmSessionInitializationInfo } from 'lib/types/request-types.js';
@@ -17,7 +18,12 @@
},
getUserPublicKey: commCoreModule.getUserPublicKey,
encrypt: commCoreModule.encrypt,
- decrypt: commCoreModule.decrypt,
+ async decrypt(
+ encryptedData: EncryptedData,
+ deviceID: string,
+ ): Promise<string> {
+ return commCoreModule.decrypt(encryptedData.message, deviceID);
+ },
async contentInboundSessionCreator(
contentIdentityKeys: OLMIdentityKeys,
initialEncryptedContent: string,
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
@@ -383,7 +383,10 @@
messageType: encryptedContent.type,
};
},
- async decrypt(encryptedContent: string, deviceID: string): Promise<string> {
+ async decrypt(
+ encryptedData: EncryptedData,
+ deviceID: string,
+ ): Promise<string> {
if (!cryptoStore) {
throw new Error('Crypto account not initialized');
}
@@ -394,8 +397,8 @@
}
const result = session.decrypt(
- olmEncryptedMessageTypes.TEXT,
- encryptedContent,
+ encryptedData.messageType,
+ encryptedData.message,
);
persistCryptoStore();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 16, 10:29 AM (11 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5943035
Default Alt Text
D11447.1768559349.diff (2 KB)
Attached To
Mode
D11447: [web] update `decrypt` method use `EncryptedData`
Attached
Detach File
Event Timeline
Log In to Comment