bitwarden_api_api/models/
algorithm.rs

1/*
2 * Bitwarden Internal API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: latest
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use serde::{Deserialize, Serialize};
12
13use crate::models;
14
15///
16#[repr(i64)]
17#[derive(
18    Clone,
19    Copy,
20    Debug,
21    Eq,
22    PartialEq,
23    Ord,
24    PartialOrd,
25    Hash,
26    serde_repr::Serialize_repr,
27    serde_repr::Deserialize_repr,
28)]
29pub enum Algorithm {
30    RS1 = -65535,
31    RS512 = -259,
32    RS384 = -258,
33    RS256 = -257,
34    ES256K = -47,
35    PS512 = -39,
36    PS384 = -38,
37    PS256 = -37,
38    ES512 = -36,
39    ES384 = -35,
40    EdDSA = -8,
41    ES256 = -7,
42}
43
44impl std::fmt::Display for Algorithm {
45    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
46        match self {
47            Self::RS1 => write!(f, "-65535"),
48            Self::RS512 => write!(f, "-259"),
49            Self::RS384 => write!(f, "-258"),
50            Self::RS256 => write!(f, "-257"),
51            Self::ES256K => write!(f, "-47"),
52            Self::PS512 => write!(f, "-39"),
53            Self::PS384 => write!(f, "-38"),
54            Self::PS256 => write!(f, "-37"),
55            Self::ES512 => write!(f, "-36"),
56            Self::ES384 => write!(f, "-35"),
57            Self::EdDSA => write!(f, "-8"),
58            Self::ES256 => write!(f, "-7"),
59        }
60    }
61}
62
63impl Default for Algorithm {
64    fn default() -> Algorithm {
65        Self::RS1
66    }
67}