zitadel-with-serde 0.1.1-alpha.6

An implementation of ZITADEL API access and authentication in Rust. Now with support for serde for easy JSON serialization and deserialization.
Documentation
// @generated
// This file is @generated by prost-build.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WebKey {
    /// The unique identifier of the key.
    #[prost(string, tag="1")]
    pub id: ::prost::alloc::string::String,
    /// The timestamp of the key creation.
    #[prost(message, optional, tag="2")]
    pub creation_date: ::core::option::Option<::pbjson_types::Timestamp>,
    /// The timestamp of the last change to the key (e.g. creation, activation, deactivation).
    #[prost(message, optional, tag="3")]
    pub change_date: ::core::option::Option<::pbjson_types::Timestamp>,
    /// State of the key
    #[prost(enumeration="State", tag="4")]
    pub state: i32,
    /// Configured type of the key (either RSA, ECDSA or ED25519)
    #[prost(oneof="web_key::Key", tags="5, 6, 7")]
    pub key: ::core::option::Option<web_key::Key>,
}
/// Nested message and enum types in `WebKey`.
pub mod web_key {
    /// Configured type of the key (either RSA, ECDSA or ED25519)
    #[derive(::serde::Serialize, ::serde::Deserialize)]
    #[serde(crate = "serde", rename_all = "snake_case")]
    #[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
    pub enum Key {
        #[prost(message, tag="5")]
        Rsa(super::Rsa),
        #[prost(message, tag="6")]
        Ecdsa(super::Ecdsa),
        #[prost(message, tag="7")]
        Ed25519(super::Ed25519),
    }
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Rsa {
    /// Bit size of the RSA key. Default is 2048 bits.
    #[prost(enumeration="RsaBits", tag="1")]
    pub bits: i32,
    /// Signing algrithm used. Default is SHA256.
    #[prost(enumeration="RsaHasher", tag="2")]
    pub hasher: i32,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Ecdsa {
    /// Curve of the ECDSA key. Default is P-256.
    #[prost(enumeration="EcdsaCurve", tag="1")]
    pub curve: i32,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Ed25519 {
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum State {
    Unspecified = 0,
    /// A newly created key is in the initial state and published to the public key endpoint.
    Initial = 1,
    /// The active key is used to sign tokens. Only one key can be active at a time.
    Active = 2,
    /// The inactive key is not used to sign tokens anymore, but still published to the public key endpoint.
    Inactive = 3,
    /// The removed key is not used to sign tokens anymore and not published to the public key endpoint.
    Removed = 4,
}
impl State {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "STATE_UNSPECIFIED",
            Self::Initial => "STATE_INITIAL",
            Self::Active => "STATE_ACTIVE",
            Self::Inactive => "STATE_INACTIVE",
            Self::Removed => "STATE_REMOVED",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "STATE_UNSPECIFIED" => Some(Self::Unspecified),
            "STATE_INITIAL" => Some(Self::Initial),
            "STATE_ACTIVE" => Some(Self::Active),
            "STATE_INACTIVE" => Some(Self::Inactive),
            "STATE_REMOVED" => Some(Self::Removed),
            _ => None,
        }
    }
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum RsaBits {
    Unspecified = 0,
    /// 2048 bit RSA key
    RsaBits2048 = 1,
    /// 3072 bit RSA key
    RsaBits3072 = 2,
    /// 4096 bit RSA key
    RsaBits4096 = 3,
}
impl RsaBits {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "RSA_BITS_UNSPECIFIED",
            Self::RsaBits2048 => "RSA_BITS_2048",
            Self::RsaBits3072 => "RSA_BITS_3072",
            Self::RsaBits4096 => "RSA_BITS_4096",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "RSA_BITS_UNSPECIFIED" => Some(Self::Unspecified),
            "RSA_BITS_2048" => Some(Self::RsaBits2048),
            "RSA_BITS_3072" => Some(Self::RsaBits3072),
            "RSA_BITS_4096" => Some(Self::RsaBits4096),
            _ => None,
        }
    }
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum RsaHasher {
    Unspecified = 0,
    /// SHA256 hashing algorithm resulting in the RS256 algorithm header
    Sha256 = 1,
    /// SHA384 hashing algorithm resulting in the RS384 algorithm header
    Sha384 = 2,
    /// SHA512 hashing algorithm resulting in the RS512 algorithm header
    Sha512 = 3,
}
impl RsaHasher {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "RSA_HASHER_UNSPECIFIED",
            Self::Sha256 => "RSA_HASHER_SHA256",
            Self::Sha384 => "RSA_HASHER_SHA384",
            Self::Sha512 => "RSA_HASHER_SHA512",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "RSA_HASHER_UNSPECIFIED" => Some(Self::Unspecified),
            "RSA_HASHER_SHA256" => Some(Self::Sha256),
            "RSA_HASHER_SHA384" => Some(Self::Sha384),
            "RSA_HASHER_SHA512" => Some(Self::Sha512),
            _ => None,
        }
    }
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum EcdsaCurve {
    Unspecified = 0,
    /// NIST P-256 curve resulting in the ES256 algorithm header
    P256 = 1,
    /// NIST P-384 curve resulting in the ES384 algorithm header
    P384 = 2,
    /// NIST P-512 curve resulting in the ES512 algorithm header
    P512 = 3,
}
impl EcdsaCurve {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "ECDSA_CURVE_UNSPECIFIED",
            Self::P256 => "ECDSA_CURVE_P256",
            Self::P384 => "ECDSA_CURVE_P384",
            Self::P512 => "ECDSA_CURVE_P512",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "ECDSA_CURVE_UNSPECIFIED" => Some(Self::Unspecified),
            "ECDSA_CURVE_P256" => Some(Self::P256),
            "ECDSA_CURVE_P384" => Some(Self::P384),
            "ECDSA_CURVE_P512" => Some(Self::P512),
            _ => None,
        }
    }
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct CreateWebKeyRequest {
    /// The key type to create (RSA, ECDSA, ED25519).
    /// If no key type is provided, a RSA key pair with 2048 bits and SHA256 hashing will be created.
    #[prost(oneof="create_web_key_request::Key", tags="1, 2, 3")]
    pub key: ::core::option::Option<create_web_key_request::Key>,
}
/// Nested message and enum types in `CreateWebKeyRequest`.
pub mod create_web_key_request {
    /// The key type to create (RSA, ECDSA, ED25519).
    /// If no key type is provided, a RSA key pair with 2048 bits and SHA256 hashing will be created.
    #[derive(::serde::Serialize, ::serde::Deserialize)]
    #[serde(crate = "serde", rename_all = "snake_case")]
    #[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
    pub enum Key {
        /// Create a RSA key pair and specify the bit size and hashing algorithm.
        /// If no bits and hasher are provided, a RSA key pair with 2048 bits and SHA256 hashing will be created.
        #[prost(message, tag="1")]
        Rsa(super::Rsa),
        /// Create a ECDSA key pair and specify the curve.
        /// If no curve is provided, a ECDSA key pair with P-256 curve will be created.
        #[prost(message, tag="2")]
        Ecdsa(super::Ecdsa),
        /// Create a ED25519 key pair.
        #[prost(message, tag="3")]
        Ed25519(super::Ed25519),
    }
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateWebKeyResponse {
    /// The unique identifier of the newly created key.
    #[prost(string, tag="1")]
    pub id: ::prost::alloc::string::String,
    /// The timestamp of the key creation.
    #[prost(message, optional, tag="2")]
    pub creation_date: ::core::option::Option<::pbjson_types::Timestamp>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ActivateWebKeyRequest {
    #[prost(string, tag="1")]
    pub id: ::prost::alloc::string::String,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ActivateWebKeyResponse {
    /// The timestamp of the activation of the key.
    #[prost(message, optional, tag="3")]
    pub change_date: ::core::option::Option<::pbjson_types::Timestamp>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteWebKeyRequest {
    #[prost(string, tag="1")]
    pub id: ::prost::alloc::string::String,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct DeleteWebKeyResponse {
    /// The timestamp of the deletion of the key.
    /// Note that the deletion date is only guaranteed to be set if the deletion was successful during the request.
    /// In case the deletion occurred in a previous request, the deletion date might be empty.
    #[prost(message, optional, tag="3")]
    pub deletion_date: ::core::option::Option<::pbjson_types::Timestamp>,
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ListWebKeysRequest {
}
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(crate = "serde", rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListWebKeysResponse {
    #[prost(message, repeated, tag="1")]
    pub web_keys: ::prost::alloc::vec::Vec<WebKey>,
}
include!("zitadel.webkey.v2beta.tonic.rs");
// @@protoc_insertion_point(module)