bitwarden_test/play/scenes/
single_user.rs

1//! Single user scene template
2
3use bitwarden_crypto::EncString;
4use serde::{Deserialize, Serialize};
5use uuid::Uuid;
6
7use crate::play::SceneTemplate;
8
9/// Arguments for creating a single user scene
10#[derive(Default, Debug, Clone, Serialize)]
11#[serde(rename_all = "camelCase")]
12pub struct SingleUserArgs {
13    /// User email address (should be mangled for test isolation)
14    pub email: String,
15    /// Whether the user's email is verified
16    pub verified: bool,
17    /// Whether the user has premium
18    pub premium: bool,
19    /// Optional user ID to set
20    pub id: Option<Uuid>,
21    /// Optional api key
22    pub api_key: Option<String>,
23}
24
25/// Result returned when creating a single user scene
26#[derive(Debug, Clone, Deserialize)]
27#[serde(rename_all = "camelCase")]
28pub struct SingleUserResult {
29    /// The user's ID
30    pub user_id: Uuid,
31    // kdf: KdfType;
32    // dfIterations?: number;
33    /// The user's encrypted symmetric key
34    pub key: EncString,
35    /// The user's public key (unencrypted)
36    pub public_key: String,
37    /// The user's encrypted private key
38    pub private_key: EncString,
39    /// The user's API key for authentication
40    pub api_key: String,
41}
42
43/// A single user scene for testing
44pub struct SingleUserScene;
45
46impl SceneTemplate for SingleUserScene {
47    type Arguments = SingleUserArgs;
48    type Result = SingleUserResult;
49
50    fn template_name() -> &'static str {
51        "SingleUserScene"
52    }
53}