1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//! Backup management methods on [`VtaClient`]: encrypted export and import.
use super::VtaClient;
use crate::error::VtaError;
impl VtaClient {
/// Export VTA state to an encrypted backup, inline.
///
/// **The legacy path.** The whole envelope crosses the wire in one
/// response, which is why this rides a protocol message rather than a Trust
/// Task — and why it has no TSP dispatcher. The descriptor flow
/// (`backup/initiate-export` + a blob fetch + `backup/complete-export`) is
/// the default as of rollout step 5. It is **REST-only** today — its bytes
/// move over the VTA's HTTPS blob endpoint, and a DIDComm/TSP client is
/// refused with [`VtaError::UnsupportedTransport`] — until the
/// `chunkedTrustTask` transfer algorithm lands. This remains only as the
/// `--use-rest-legacy` escape hatch, and goes at step 6 with the route it
/// calls. Over DIDComm it is no substitute: the envelope rides one message,
/// and a mediator refuses any over its size limit (1 MiB by default).
#[deprecated(
since = "0.21.3",
note = "inline export rides a legacy protocol message with no TSP path — \
use the descriptor flow (backup/initiate-export)"
)]
pub async fn backup_export(
&self,
password: &str,
include_audit: bool,
) -> Result<crate::protocols::backup_management::types::BackupEnvelope, VtaError> {
self.rpc(
crate::protocols::backup_management::EXPORT_BACKUP,
serde_json::json!({ "password": password, "include_audit": include_audit }),
crate::protocols::backup_management::EXPORT_BACKUP_RESULT,
120, // backup can take longer
|c, url| {
c.post(format!("{url}/backup/export")).json(
&serde_json::json!({ "password": password, "include_audit": include_audit }),
)
},
)
.await
}
/// Import VTA state from an encrypted backup, inline.
///
/// The legacy counterpart of [`backup_export`](Self::backup_export); see
/// its note.
#[deprecated(
since = "0.21.3",
note = "inline import rides a legacy protocol message with no TSP path — \
use the descriptor flow (backup/initiate-import)"
)]
pub async fn backup_import(
&self,
backup: &crate::protocols::backup_management::types::BackupEnvelope,
password: &str,
confirm: bool,
) -> Result<crate::protocols::backup_management::types::ImportResult, VtaError> {
self.rpc(
crate::protocols::backup_management::IMPORT_BACKUP,
serde_json::json!({ "backup": backup, "password": password, "confirm": confirm }),
crate::protocols::backup_management::IMPORT_BACKUP_RESULT,
120,
|c, url| {
c.post(format!("{url}/backup/import"))
.json(&serde_json::json!({ "backup": backup, "password": password, "confirm": confirm }))
},
)
.await
}
}