Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3334694
D11713.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D11713.diff
View Options
diff --git a/services/backup/src/constants.rs b/services/backup/src/constants.rs
--- a/services/backup/src/constants.rs
+++ b/services/backup/src/constants.rs
@@ -27,6 +27,7 @@
pub const USER_DATA: &str = "userData";
pub const USER_KEYS: &str = "userKeys";
pub const ATTACHMENTS: &str = "attachments";
+ pub const SIWE_BACKUP_MSG: &str = "siweBackupMsg";
}
}
diff --git a/services/backup/src/database/backup_item.rs b/services/backup/src/database/backup_item.rs
--- a/services/backup/src/database/backup_item.rs
+++ b/services/backup/src/database/backup_item.rs
@@ -3,7 +3,9 @@
use chrono::{DateTime, Utc};
use comm_lib::{
blob::{client::BlobServiceClient, types::BlobInfo},
- database::{AttributeTryInto, DBItemError, TryFromAttribute},
+ database::{
+ AttributeExtractor, AttributeTryInto, DBItemError, TryFromAttribute,
+ },
};
use std::collections::HashMap;
@@ -15,6 +17,7 @@
pub user_keys: BlobInfo,
pub user_data: BlobInfo,
pub attachments: Vec<BlobInfo>,
+ pub siwe_backup_msg: Option<String>,
}
impl BackupItem {
@@ -24,6 +27,7 @@
user_keys: BlobInfo,
user_data: BlobInfo,
attachments: Vec<BlobInfo>,
+ siwe_backup_msg: Option<String>,
) -> Self {
BackupItem {
user_id,
@@ -32,6 +36,7 @@
user_keys,
user_data,
attachments,
+ siwe_backup_msg,
}
}
@@ -109,6 +114,12 @@
);
}
+ if let Some(siwe_backup_msg_value) = value.siwe_backup_msg {
+ attrs.insert(
+ backup_table::attr::SIWE_BACKUP_MSG.to_string(),
+ AttributeValue::S(siwe_backup_msg_value),
+ );
+ }
attrs
}
}
@@ -148,6 +159,9 @@
Vec::new()
};
+ let siwe_backup_msg: Option<String> =
+ value.take_attr(backup_table::attr::SIWE_BACKUP_MSG)?;
+
Ok(BackupItem {
user_id,
backup_id,
@@ -155,6 +169,7 @@
user_keys,
user_data,
attachments,
+ siwe_backup_msg,
})
}
}
diff --git a/services/backup/src/http/handlers/backup.rs b/services/backup/src/http/handlers/backup.rs
--- a/services/backup/src/http/handlers/backup.rs
+++ b/services/backup/src/http/handlers/backup.rs
@@ -76,12 +76,25 @@
attachments_revokes.push(revoke);
}
+ let siwe_backup_msg_option: Option<String> =
+ match get_text_field(&mut multipart).await? {
+ Some((name, siwe_backup_msg)) => {
+ if name == "siwe_backup_msg" {
+ Some(siwe_backup_msg)
+ } else {
+ None
+ }
+ }
+ _ => None,
+ };
+
let item = BackupItem::new(
user.user_id.clone(),
backup_id,
user_keys_blob_info,
user_data_blob_info,
attachments,
+ siwe_backup_msg_option,
);
db_client
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 22, 7:33 AM (18 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2560589
Default Alt Text
D11713.diff (2 KB)
Attached To
Mode
D11713: Introduce msg_backup field to BackupItem
Attached
Detach File
Event Timeline
Log In to Comment