Skip to main content

coven/
storage_credentials.rs

1//! Restore-code access and S3 credential changes on an open handle.
2
3use super::*;
4
5impl CovenHandle {
6    /// This member's current restore code, for their other devices (§13.1).
7    /// It carries no S3 key.
8    pub async fn restore_code(&self) -> Result<String, SyncError> {
9        self.codes.restore_code().await
10    }
11
12    /// Check an S3 key the person made in the provider's console with
13    /// storage, then, once storage accepts it, take it, whatever the
14    /// reason, and record it as this member's (E9, §14.3). `cancel` stops
15    /// the check; once the check passed, the call finishes. See the spec
16    /// for the call's steps and what each failure leaves.
17    pub async fn use_access_key(
18        &self,
19        access_key_id: String,
20        secret_access_key: SecretText,
21        cancel: &tokio::sync::watch::Receiver<bool>,
22    ) -> Result<AccessKeyUsed, UseAccessKeyError> {
23        let key = S3Credentials { access_key_id, secret_access_key };
24        self.storage.use_access_key(key, cancel.clone()).await
25    }
26}