Page MenuHomePhabricator

D11449.id38477.diff
No OneTemporary

D11449.id38477.diff

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,6 +1,5 @@
// @flow
-import { olmEncryptedMessageTypes } from '../types/crypto-types.js';
import type {
IdentityServiceClient,
DeviceOlmInboundKeys,
@@ -50,10 +49,7 @@
try {
await olmAPI.initializeCryptoAccount();
const decrypted = await olmAPI.decrypt(
- {
- messageType: olmEncryptedMessageTypes.TEXT,
- message: message.encryptedContent,
- },
+ message.encryptedData,
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
@@ -118,6 +118,11 @@
+message: string,
+messageType: OlmEncryptedMessageTypes,
};
+export const encryptedDataValidator: TInterface<EncryptedData> =
+ tShape<EncryptedData>({
+ message: t.String,
+ messageType: t.Number,
+ });
export type ClientPublicKeys = {
+primaryIdentityPublicKeys: {
diff --git a/lib/types/tunnelbroker/peer-to-peer-message-types.js b/lib/types/tunnelbroker/peer-to-peer-message-types.js
--- a/lib/types/tunnelbroker/peer-to-peer-message-types.js
+++ b/lib/types/tunnelbroker/peer-to-peer-message-types.js
@@ -4,6 +4,7 @@
import t from 'tcomb';
import { tShape, tString } from '../../utils/validation-utils.js';
+import { type EncryptedData, encryptedDataValidator } from '../crypto-types.js';
import {
signedDeviceListValidator,
type SignedDeviceList,
@@ -41,13 +42,13 @@
export type EncryptedMessage = {
+type: 'EncryptedMessage',
+senderInfo: SenderInfo,
- +encryptedContent: string,
+ +encryptedData: EncryptedData,
};
export const encryptedMessageValidator: TInterface<EncryptedMessage> =
tShape<EncryptedMessage>({
type: tString(peerToPeerMessageTypes.ENCRYPTED_MESSAGE),
senderInfo: senderInfoValidator,
- encryptedContent: t.String,
+ encryptedData: encryptedDataValidator,
});
export type RefreshKeyRequest = {
diff --git a/native/profile/tunnelbroker-menu.react.js b/native/profile/tunnelbroker-menu.react.js
--- a/native/profile/tunnelbroker-menu.react.js
+++ b/native/profile/tunnelbroker-menu.react.js
@@ -85,7 +85,7 @@
return;
}
await olmAPI.initializeCryptoAccount();
- const { message: encrypted } = await olmAPI.encrypt(
+ const encryptedData = await olmAPI.encrypt(
`Encrypted message to ${recipient}`,
recipient,
);
@@ -96,7 +96,7 @@
deviceID,
userID: currentUserID,
},
- encryptedContent: encrypted,
+ encryptedData,
};
await sendMessage({
deviceID: recipient,
diff --git a/web/settings/tunnelbroker-test.react.js b/web/settings/tunnelbroker-test.react.js
--- a/web/settings/tunnelbroker-test.react.js
+++ b/web/settings/tunnelbroker-test.react.js
@@ -61,7 +61,7 @@
setLoading(true);
try {
await olmAPI.initializeCryptoAccount();
- const { message: encrypted } = await olmAPI.encrypt(
+ const encryptedData = await olmAPI.encrypt(
`Encrypted message to ${recipient}`,
recipient,
);
@@ -72,7 +72,7 @@
deviceID,
userID: currentUserID,
},
- encryptedContent: encrypted,
+ encryptedData,
};
await sendMessage({
deviceID: recipient,

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 25, 9:46 AM (20 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2578965
Default Alt Text
D11449.id38477.diff (3 KB)

Event Timeline