diff --git a/services/tunnelbroker/src/constants.rs b/services/tunnelbroker/src/constants.rs
--- a/services/tunnelbroker/src/constants.rs
+++ b/services/tunnelbroker/src/constants.rs
@@ -43,13 +43,15 @@
// This table holds a device token associated with a device.
//
// - (primary key) = (deviceID: Partition Key)
- // - deviceID: The public key of a device's olm identity key
+ // - deviceID: The public key of a device's olm identity key.
// - deviceToken: Token to push services uploaded by device.
+ // - tokenInvalid: Information is token is invalid.
pub mod device_tokens {
pub const TABLE_NAME: &str = "tunnelbroker-device-tokens";
pub const PARTITION_KEY: &str = "deviceID";
pub const DEVICE_ID: &str = "deviceID";
pub const DEVICE_TOKEN: &str = "deviceToken";
+ pub const TOKEN_INVALID: &str = "tokenInvalid";
pub const DEVICE_TOKEN_INDEX_NAME: &str = "deviceToken-index";
}
diff --git a/services/tunnelbroker/src/database/mod.rs b/services/tunnelbroker/src/database/mod.rs
--- a/services/tunnelbroker/src/database/mod.rs
+++ b/services/tunnelbroker/src/database/mod.rs
@@ -36,6 +36,11 @@
}
}
+pub struct DeviceTokenEntry {
+ pub device_token: String,
+ pub token_invalid: bool,
+}
+
impl DatabaseClient {
pub fn new(aws_config: &AwsConfig) -> Self {
let client = DynamoDBClient::new(aws_config);
@@ -153,7 +158,7 @@
pub async fn get_device_token(
&self,
device_id: &str,
- ) -> Result