Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3366301
D12045.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D12045.diff
View Options
diff --git a/keyserver/src/socket/tunnelbroker-socket.js b/keyserver/src/socket/tunnelbroker-socket.js
--- a/keyserver/src/socket/tunnelbroker-socket.js
+++ b/keyserver/src/socket/tunnelbroker-socket.js
@@ -5,7 +5,7 @@
import WebSocket from 'ws';
import { tunnelbrokerHeartbeatTimeout } from 'lib/shared/timeouts.js';
-import type { ClientMessageToDevice } from 'lib/tunnelbroker/tunnelbroker-context.js';
+import type { TunnelbrokerClientMessageToDevice } from 'lib/tunnelbroker/tunnelbroker-context.js';
import type { MessageReceiveConfirmation } from 'lib/types/tunnelbroker/message-receive-confirmation-types.js';
import type { MessageSentStatus } from 'lib/types/tunnelbroker/message-to-device-request-status-types.js';
import type { MessageToDeviceRequest } from 'lib/types/tunnelbroker/message-to-device-request-types.js';
@@ -175,8 +175,8 @@
{ leading: true, trailing: true },
);
- sendMessage: (message: ClientMessageToDevice) => Promise<void> = (
- message: ClientMessageToDevice,
+ sendMessage: (message: TunnelbrokerClientMessageToDevice) => Promise<void> = (
+ message: TunnelbrokerClientMessageToDevice,
) => {
if (!this.connected) {
throw new Error('Tunnelbroker not connected');
diff --git a/lib/tunnelbroker/tunnelbroker-context.js b/lib/tunnelbroker/tunnelbroker-context.js
--- a/lib/tunnelbroker/tunnelbroker-context.js
+++ b/lib/tunnelbroker/tunnelbroker-context.js
@@ -34,7 +34,7 @@
import { getContentSigningKey } from '../utils/crypto-utils.js';
import { useSelector } from '../utils/redux-utils.js';
-export type ClientMessageToDevice = {
+export type TunnelbrokerClientMessageToDevice = {
+deviceID: string,
+payload: string,
};
@@ -50,7 +50,7 @@
type Promises = { [clientMessageID: string]: PromiseCallbacks };
type TunnelbrokerContextType = {
- +sendMessage: (message: ClientMessageToDevice) => Promise<void>,
+ +sendMessage: (message: TunnelbrokerClientMessageToDevice) => Promise<void>,
+addListener: (listener: TunnelbrokerSocketListener) => void,
+removeListener: (listener: TunnelbrokerSocketListener) => void,
+connected: boolean,
@@ -381,21 +381,22 @@
[connected, secondaryTunnelbrokerConnection, shouldBeClosed],
);
- const sendMessage: (message: ClientMessageToDevice) => Promise<void> =
- React.useCallback(
- (message: ClientMessageToDevice) => {
- const clientMessageID = uuid.v4();
- const messageToDevice: MessageToDeviceRequest = {
- type: tunnelbrokerMessageTypes.MESSAGE_TO_DEVICE_REQUEST,
- clientMessageID,
- deviceID: message.deviceID,
- payload: message.payload,
- };
-
- return sendMessageToDeviceRequest(messageToDevice);
- },
- [sendMessageToDeviceRequest],
- );
+ const sendMessage: (
+ message: TunnelbrokerClientMessageToDevice,
+ ) => Promise<void> = React.useCallback(
+ (message: TunnelbrokerClientMessageToDevice) => {
+ const clientMessageID = uuid.v4();
+ const messageToDevice: MessageToDeviceRequest = {
+ type: tunnelbrokerMessageTypes.MESSAGE_TO_DEVICE_REQUEST,
+ clientMessageID,
+ deviceID: message.deviceID,
+ payload: message.payload,
+ };
+
+ return sendMessageToDeviceRequest(messageToDevice);
+ },
+ [sendMessageToDeviceRequest],
+ );
React.useEffect(
() =>
diff --git a/lib/utils/crypto-utils.js b/lib/utils/crypto-utils.js
--- a/lib/utils/crypto-utils.js
+++ b/lib/utils/crypto-utils.js
@@ -7,7 +7,7 @@
import { primaryIdentityPublicKeyRegex } from './siwe-utils.js';
import { tRegex, tShape } from './validation-utils.js';
import type { AuthMetadata } from '../shared/identity-client-context.js';
-import type { ClientMessageToDevice } from '../tunnelbroker/tunnelbroker-context.js';
+import type { TunnelbrokerClientMessageToDevice } from '../tunnelbroker/tunnelbroker-context.js';
import type {
IdentityKeysBlob,
OLMIdentityKeys,
@@ -47,7 +47,7 @@
async function createOlmSessionsWithOwnDevices(
authMetadata: AuthMetadata,
identityClient: IdentityServiceClient,
- sendMessage: (message: ClientMessageToDevice) => Promise<void>,
+ sendMessage: (message: TunnelbrokerClientMessageToDevice) => Promise<void>,
): Promise<void> {
const { olmAPI } = getConfig();
const { userID, deviceID, accessToken } = authMetadata;
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
@@ -3,7 +3,7 @@
import invariant from 'invariant';
import * as React from 'react';
-import { type ClientMessageToDevice } from 'lib/tunnelbroker/tunnelbroker-context.js';
+import { type TunnelbrokerClientMessageToDevice } from 'lib/tunnelbroker/tunnelbroker-context.js';
import {
type EncryptedMessage,
peerToPeerMessageTypes,
@@ -18,7 +18,7 @@
import { useSelector } from '../redux/redux-utils.js';
type Props = {
- +sendMessage: (message: ClientMessageToDevice) => Promise<void>,
+ +sendMessage: (message: TunnelbrokerClientMessageToDevice) => Promise<void>,
+onClose: () => void,
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 26, 10:44 AM (21 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2584307
Default Alt Text
D12045.diff (5 KB)
Attached To
Mode
D12045: [lib] rename `ClientMessageToDevice` in `tunnelbroker-context.js` to `TunnelbrokerClientMessageToDevice`
Attached
Detach File
Event Timeline
Log In to Comment