use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; use time::OffsetDateTime; use uuid::Uuid; #[derive( Debug, Clone, Copy, PartialEq, Eq, Default, EnumIter, DeriveActiveEnum, Serialize, Deserialize, )] #[sea_orm(rs_type = "i16", db_type = "SmallInteger")] pub enum SigningAlgorithm { #[default] #[sea_orm(num_value = 0)] Ed25519, #[sea_orm(num_value = 1)] ES256, #[sea_orm(num_value = 2)] RS256, } #[sea_orm::model] #[derive(Clone, Debug, PartialEq, DeriveEntityModel)] #[sea_orm(table_name = "system_signing_keys")] pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub kid: Uuid, pub name: String, pub algorithm: SigningAlgorithm, pub public_key: Vec, pub private_key_encrypted: Option>, #[sea_orm(unique)] pub key_hash: String, #[sea_orm(default_value = "false")] pub is_active: bool, #[sea_orm(default_value = "false")] pub is_signing: bool, #[sea_orm(default_value = "false")] pub is_rotating: bool, pub grace_started_at: Option, pub grace_ends_at: Option, pub expires_at: Option, pub created_at: OffsetDateTime, pub created_by: Option, pub rotated_by: Option, pub revoked_at: Option, pub revoked_reason: Option, pub updated_at: OffsetDateTime, } impl ActiveModelBehavior for ActiveModel {}