pub struct KeyMetadata {
pub key_id: String,
pub name: String,
pub algorithm: KeyAlgorithm,
pub purpose: KeyPurpose,
pub version: u32,
pub created_at: SystemTime,
pub expires_at: Option<SystemTime>,
pub status: KeyStatus,
pub description: String,
pub tags: Vec<String>,
}Expand description
密钥元数据,描述密钥的属性但不包含密钥材料
Fields§
§key_id: String密钥唯一标识(UUID 风格)
name: String密钥名称(同一名称可有多个版本)
algorithm: KeyAlgorithm密钥算法
purpose: KeyPurpose密钥用途
version: u32版本号(从 1 开始递增)
created_at: SystemTime创建时间
expires_at: Option<SystemTime>过期时间(None 表示永不过期)
status: KeyStatus密钥状态
description: String人类可读的描述
标签列表,便于分类检索
Implementations§
Source§impl KeyMetadata
impl KeyMetadata
Sourcepub fn with_expiry(self, expires_at: SystemTime) -> Self
pub fn with_expiry(self, expires_at: SystemTime) -> Self
设置过期时间
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
设置描述
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
检查密钥是否已过期
Trait Implementations§
Source§impl Clone for KeyMetadata
impl Clone for KeyMetadata
Source§fn clone(&self) -> KeyMetadata
fn clone(&self) -> KeyMetadata
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for KeyMetadata
impl Debug for KeyMetadata
Source§impl<'de> Deserialize<'de> for KeyMetadata
impl<'de> Deserialize<'de> for KeyMetadata
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for KeyMetadata
impl RefUnwindSafe for KeyMetadata
impl Send for KeyMetadata
impl Sync for KeyMetadata
impl Unpin for KeyMetadata
impl UnsafeUnpin for KeyMetadata
impl UnwindSafe for KeyMetadata
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more