siera_agent/modules/
multitenancy.rs

1use async_trait::async_trait;
2
3use crate::error::Result;
4use serde::Deserialize;
5use serde::Serialize;
6use serde_json::Value;
7
8/// Response of the `create` endpoint on the multitenancy module
9#[derive(Default, Debug, Clone, Eq, PartialEq, Serialize, Deserialize)]
10pub struct MultitenancyCreateResponse {
11    /// Timestamp of when the subwallet was created
12    pub created_at: String,
13
14    /// The mode of the key management (managed, unmanaged)
15    pub key_management_mode: String,
16
17    /// More wallet information
18    pub settings: Value,
19
20    /// JWT
21    pub token: String,
22
23    /// Timestamp of when the last update happened to the wallet
24    pub updated_at: String,
25
26    /// The wallet id
27    pub wallet_id: String,
28}
29
30/// Multitenancy module for a generic cloudagent
31#[async_trait]
32pub trait MultitenancyModule {
33    /// Create a new subwallet
34    async fn create(&self) -> Result<MultitenancyCreateResponse>;
35
36    /// Remove a subwallet
37    async fn remove(&self, wallet_id: String) -> Result<()>;
38}