1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! Certificate table struct.
//!
//! Maps to TS `TableCertificate` in `wallet-toolbox/src/storage/schema/tables/TableCertificate.ts`.
use chrono::NaiveDateTime;
use serde::{Deserialize, Serialize};
use sqlx::FromRow;
/// A certificate issued to a user.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, FromRow)]
#[serde(rename_all = "camelCase")]
#[sqlx(rename_all = "camelCase")]
pub struct Certificate {
/// When this record was created.
#[sqlx(rename = "created_at")]
#[serde(
rename = "created_at",
alias = "createdAt",
with = "crate::serde_datetime"
)]
pub created_at: NaiveDateTime,
/// When this record was last updated.
#[sqlx(rename = "updated_at")]
#[serde(
rename = "updated_at",
alias = "updatedAt",
with = "crate::serde_datetime"
)]
pub updated_at: NaiveDateTime,
/// Primary key.
pub certificate_id: i64,
/// Owning user foreign key.
pub user_id: i64,
/// Certificate type identifier string.
#[sqlx(rename = "type")]
#[serde(rename = "type")]
pub cert_type: String,
/// Unique serial number.
pub serial_number: String,
/// Identity key of the certifier.
pub certifier: String,
/// Identity key of the subject.
pub subject: String,
/// Identity key of an optional verifier.
#[serde(skip_serializing_if = "Option::is_none")]
pub verifier: Option<String>,
/// On-chain outpoint for certificate revocation (txid.vout).
pub revocation_outpoint: String,
/// Digital signature of the certificate.
pub signature: String,
/// Soft-delete flag.
pub is_deleted: bool,
}