diff --git a/lib/actions/user-actions.js b/lib/actions/user-actions.js --- a/lib/actions/user-actions.js +++ b/lib/actions/user-actions.js @@ -75,7 +75,7 @@ import type { RawThreadInfos } from '../types/thread-types.js'; import { userActionsP2PMessageTypes, - type PrimaryDeviceLogoutP2PMessage, + type DeviceLogoutP2PMessage, type SecondaryDeviceLogoutP2PMessage, } from '../types/tunnelbroker/user-actions-peer-to-peer-message-types.js'; import type { @@ -282,8 +282,8 @@ throw new Error('Used primary device logout on a non-primary device'); } - const messageContents: PrimaryDeviceLogoutP2PMessage = { - type: userActionsP2PMessageTypes.LOG_OUT_PRIMARY_DEVICE, + const messageContents: DeviceLogoutP2PMessage = { + type: userActionsP2PMessageTypes.LOG_OUT_DEVICE, }; const recipients = secondaryDevices.map(deviceID => ({ userID, deviceID })); await broadcastEphemeralMessage( diff --git a/lib/tunnelbroker/use-peer-to-peer-message-handler.js b/lib/tunnelbroker/use-peer-to-peer-message-handler.js --- a/lib/tunnelbroker/use-peer-to-peer-message-handler.js +++ b/lib/tunnelbroker/use-peer-to-peer-message-handler.js @@ -84,8 +84,7 @@ const userActionMessage: UserActionP2PMessage = parsedMessageToDevice; if ( - userActionMessage.type === - userActionsP2PMessageTypes.LOG_OUT_PRIMARY_DEVICE + userActionMessage.type === userActionsP2PMessageTypes.LOG_OUT_DEVICE ) { void dispatchActionPromise( logOutActionTypes, diff --git a/lib/types/tunnelbroker/user-actions-peer-to-peer-message-types.js b/lib/types/tunnelbroker/user-actions-peer-to-peer-message-types.js --- a/lib/types/tunnelbroker/user-actions-peer-to-peer-message-types.js +++ b/lib/types/tunnelbroker/user-actions-peer-to-peer-message-types.js @@ -6,18 +6,18 @@ import { type DMOperation, dmOperationValidator } from '../dm-ops.js'; export const userActionsP2PMessageTypes = Object.freeze({ - LOG_OUT_PRIMARY_DEVICE: 'LOG_OUT_PRIMARY_DEVICE', + LOG_OUT_DEVICE: 'LOG_OUT_DEVICE', LOG_OUT_SECONDARY_DEVICE: 'LOG_OUT_SECONDARY_DEVICE', ACCOUNT_DELETION: 'ACCOUNT_DELETION', DM_OPERATION: 'DM_OPERATION', }); -export type PrimaryDeviceLogoutP2PMessage = { - +type: 'LOG_OUT_PRIMARY_DEVICE', +export type DeviceLogoutP2PMessage = { + +type: 'LOG_OUT_DEVICE', }; -export const primaryDeviceLogoutP2PMessageValidator: TInterface = - tShape({ - type: tString(userActionsP2PMessageTypes.LOG_OUT_PRIMARY_DEVICE), +export const deviceLogoutP2PMessageValidator: TInterface = + tShape({ + type: tString(userActionsP2PMessageTypes.LOG_OUT_DEVICE), }); export type SecondaryDeviceLogoutP2PMessage = { @@ -48,14 +48,14 @@ }); export type UserActionP2PMessage = - | PrimaryDeviceLogoutP2PMessage + | DeviceLogoutP2PMessage | SecondaryDeviceLogoutP2PMessage | AccountDeletionP2PMessage | DMOperationP2PMessage; export const userActionP2PMessageValidator: TUnion = t.union([ - primaryDeviceLogoutP2PMessageValidator, + deviceLogoutP2PMessageValidator, secondaryDeviceLogoutP2PMessageValidator, accountDeletionP2PMessageValidator, dmOperationP2PMessageValidator,