Skip to main content

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    /// User password
16    pub password: String,
17    /// Whether the user's email is verified
18    pub email_verified: bool,
19    /// Whether the user has premium
20    pub premium: bool,
21}
22
23/// Result returned when creating a single user scene
24#[derive(Debug, Clone, Deserialize)]
25#[serde(rename_all = "camelCase")]
26pub struct SingleUserResult {
27    /// The user's ID
28    pub user_id: Uuid,
29    // kdf: KdfType;
30    // dfIterations?: number;
31    /// The user's encrypted symmetric key
32    pub key: EncString,
33    /// The user's public key (unencrypted)
34    pub public_key: String,
35    /// The user's encrypted private key
36    pub private_key: EncString,
37    /// The user's API key for authentication
38    pub api_key: String,
39}
40
41/// A single user scene for testing
42pub struct SingleUserScene;
43
44impl SceneTemplate for SingleUserScene {
45    type Arguments = SingleUserArgs;
46    type Result = SingleUserResult;
47
48    fn template_name() -> &'static str {
49        "SingleUserScene"
50    }
51}