Skip to main content

confium_store_openpgp_card/
slot.rs

1//! OpenPGP card slot identifiers.
2
3use serde::{Deserialize, Serialize};
4
5/// OpenPGP card slot (per OpenPGP card spec v3.x).
6#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
7#[serde(rename_all = "snake_case")]
8pub enum OpenpgpSlot {
9    /// Signature (SIG) slot — key for signing documents.
10    Signature,
11    /// Decryption (DEC) slot — key for decrypting messages.
12    Decryption,
13    /// Authentication (AUT) slot — key for non-repudiation / SSH auth.
14    Authentication,
15}
16
17/// PIN policy supported by the OpenPGP card spec.
18#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
19#[serde(rename_all = "snake_case")]
20pub enum PinPolicy {
21    /// PIN never required.
22    #[default]
23    Never,
24    /// PIN required once per session.
25    Once,
26    /// PIN required every operation.
27    Always,
28}
29
30/// PIN reference identifiers per OpenPGP card spec.
31#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
32#[serde(rename_all = "snake_case")]
33pub enum PinReference {
34    /// User PIN (PW1).
35    UserPin,
36    /// Resetting Code (RC).
37    ResettingCode,
38    /// Admin PIN (PW3).
39    AdminPin,
40}