Skip to main content

alibi_sqlx/store/entities/
jwk.rs

1use chrono::{DateTime, Utc};
2
3#[derive(Clone, Debug, PartialEq, Eq, sqlx::FromRow, crate::SqlxModel)]
4#[auth(table = "jwks")]
5pub struct Model {
6    pub id: String,
7    pub public_key: String,
8    pub private_key: String,
9    pub created_at: DateTime<Utc>,
10    pub expires_at: Option<DateTime<Utc>>,
11    pub alg: Option<String>,
12    pub crv: Option<String>,
13}
14
15impl From<Model> for alibi_core::types::Jwk {
16    fn from(row: Model) -> Self {
17        Self {
18            id: row.id,
19            public_key: row.public_key,
20            private_key: row.private_key,
21            created_at: row.created_at,
22            expires_at: row.expires_at,
23            alg: row.alg,
24            crv: row.crv,
25        }
26    }
27}