Page MenuHomePhabricator

D3962.id13185.diff
No OneTemporary

D3962.id13185.diff

diff --git a/services/identity/src/database.rs b/services/identity/src/database.rs
--- a/services/identity/src/database.rs
+++ b/services/identity/src/database.rs
@@ -158,6 +158,64 @@
}
}
}
+
+ pub async fn put_token(
+ &self,
+ token: AccessToken,
+ ) -> Result<PutItemOutput, Error> {
+ let input = PutItemInput {
+ table_name: "identity-tokens".to_string(),
+ item: HashMap::from([
+ (
+ "userID".to_string(),
+ AttributeValue {
+ s: Some(token.user_id),
+ ..Default::default()
+ },
+ ),
+ (
+ "deviceID".to_string(),
+ AttributeValue {
+ s: Some(token.device_id),
+ ..Default::default()
+ },
+ ),
+ (
+ "token".to_string(),
+ AttributeValue {
+ s: Some(token.token),
+ ..Default::default()
+ },
+ ),
+ (
+ "created".to_string(),
+ AttributeValue {
+ s: Some(token.created.to_rfc3339()),
+ ..Default::default()
+ },
+ ),
+ (
+ "authType".to_string(),
+ AttributeValue {
+ s: Some(match token.auth_type {
+ AuthType::Password => "password".to_string(),
+ AuthType::Wallet => "wallet".to_string(),
+ }),
+ ..Default::default()
+ },
+ ),
+ (
+ "valid".to_string(),
+ AttributeValue {
+ bool: Some(token.valid),
+ ..Default::default()
+ },
+ ),
+ ]),
+ ..PutItemInput::default()
+ };
+ self.client.put_item(input).await.map_err(Error::RusotoPut)
+ }
}
#[derive(

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 1, 6:20 PM (21 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2400488
Default Alt Text
D3962.id13185.diff (1 KB)

Event Timeline