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};
12use serde_repr::{Deserialize_repr, Serialize_repr};
13
14use crate::models;
15///
16#[repr(i64)]
17#[derive(
18    Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize_repr, Deserialize_repr,
19)]
20pub enum Algorithm {
21    RS1 = -65535,
22    RS512 = -259,
23    RS384 = -258,
24    RS256 = -257,
25    ES256K = -47,
26    PS512 = -39,
27    PS384 = -38,
28    PS256 = -37,
29    ES512 = -36,
30    ES384 = -35,
31    EdDSA = -8,
32    ES256 = -7,
33}
34
35impl std::fmt::Display for Algorithm {
36    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
37        write!(
38            f,
39            "{}",
40            match self {
41                Self::RS1 => "-65535",
42                Self::RS512 => "-259",
43                Self::RS384 => "-258",
44                Self::RS256 => "-257",
45                Self::ES256K => "-47",
46                Self::PS512 => "-39",
47                Self::PS384 => "-38",
48                Self::PS256 => "-37",
49                Self::ES512 => "-36",
50                Self::ES384 => "-35",
51                Self::EdDSA => "-8",
52                Self::ES256 => "-7",
53            }
54        )
55    }
56}
57impl Default for Algorithm {
58    fn default() -> Algorithm {
59        Self::RS1
60    }
61}