Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3359587
D11449.id38477.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
D11449.id38477.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,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
Details
Attached
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)
Attached To
Mode
D11449: [native/web/lib] update Tunnelbroker code to use `EncryptedData`
Attached
Detach File
Event Timeline
Log In to Comment