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 @@ -26,6 +26,7 @@ QR_CODE_AUTH_MESSAGE: 'QRCodeAuthMessage', DEVICE_LIST_UPDATED: 'DeviceListUpdated', MESSAGE_PROCESSED: 'MessageProcessed', + IDENTITY_DEVICE_LIST_UPDATED: 'IdentityDeviceListUpdated', }); export type OutboundSessionCreation = { @@ -100,13 +101,22 @@ deviceID: t.String, }); +export type IdentityDeviceListUpdated = { + +type: 'IdentityDeviceListUpdated', +}; +export const identityDeviceListUpdatedValidator: TInterface = + tShape({ + type: tString(peerToPeerMessageTypes.IDENTITY_DEVICE_LIST_UPDATED), + }); + export type PeerToPeerMessage = | OutboundSessionCreation | EncryptedMessage | RefreshKeyRequest | QRCodeAuthMessage | DeviceListUpdated - | MessageProcessed; + | MessageProcessed + | IdentityDeviceListUpdated; export const peerToPeerMessageValidator: TUnion = t.union([ outboundSessionCreationValidator, @@ -115,4 +125,5 @@ qrCodeAuthMessageValidator, deviceListUpdatedValidator, messageProcessedValidator, + identityDeviceListUpdatedValidator, ]); diff --git a/shared/tunnelbroker_messages/src/messages/device_list_updated.rs b/shared/tunnelbroker_messages/src/messages/device_list_updated.rs new file mode 100644 --- /dev/null +++ b/shared/tunnelbroker_messages/src/messages/device_list_updated.rs @@ -0,0 +1,7 @@ +//! Messages sent from Identity to device informing that device list was updated. + +use serde::{Deserialize, Serialize}; + +#[derive(Serialize, Deserialize, PartialEq, Debug)] +#[serde(tag = "type", rename_all = "camelCase")] +pub struct IdentityDeviceListUpdated {} diff --git a/shared/tunnelbroker_messages/src/messages/mod.rs b/shared/tunnelbroker_messages/src/messages/mod.rs --- a/shared/tunnelbroker_messages/src/messages/mod.rs +++ b/shared/tunnelbroker_messages/src/messages/mod.rs @@ -1,5 +1,6 @@ //! Messages sent between Tunnelbroker and a device. +pub mod device_list_updated; pub mod keys; pub mod message_receive_confirmation; pub mod message_to_device; @@ -7,6 +8,7 @@ pub mod message_to_device_request_status; pub mod session; +pub use device_list_updated::*; pub use keys::*; pub use message_receive_confirmation::*; pub use message_to_device::*; @@ -41,10 +43,12 @@ MessageToDevice(MessageToDevice), MessageReceiveConfirmation(MessageReceiveConfirmation), Heartbeat(Heartbeat), + IdentityDeviceListUpdated(IdentityDeviceListUpdated), } #[derive(Serialize, Deserialize, Debug)] #[serde(untagged)] pub enum PeerToPeerMessages { RefreshKeysRequest(RefreshKeyRequest), + IdentityDeviceListUpdated(IdentityDeviceListUpdated), }