1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use wire_e2e_identity::prelude::IdentityStatus;

/// Indicates the standalone status of a device Credential in a MLS group at a moment T.
/// This does not represent the states where a device is not using MLS or is not using end-to-end identity
#[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, serde::Serialize, serde::Deserialize)]
#[repr(u8)]
pub enum DeviceStatus {
    /// All is fine
    Valid = 1,
    /// The Credential's certificate is expired
    Expired = 2,
    /// The Credential's certificate is revoked
    Revoked = 3,
}

impl From<IdentityStatus> for DeviceStatus {
    fn from(status: IdentityStatus) -> Self {
        match status {
            IdentityStatus::Valid => Self::Valid,
            IdentityStatus::Expired => Self::Expired,
            IdentityStatus::Revoked => Self::Revoked,
        }
    }
}