pub struct AIdCredentialVerifier;Expand description
AId Credential 验证器
提供纯函数式的 Ed25519 签名验证,无内部状态。 verifying_key 由调用方提供,通常来自 AIS 注册响应中的 signing_pubkey 或本地密钥缓存。
Implementations§
Source§impl AIdCredentialVerifier
impl AIdCredentialVerifier
Sourcepub fn verify(
credential: &AIdCredential,
verifying_key: &VerifyingKey,
) -> Result<IdentityClaims, AidError>
pub fn verify( credential: &AIdCredential, verifying_key: &VerifyingKey, ) -> Result<IdentityClaims, AidError>
验证 AIdCredential 的 Ed25519 签名并返回 IdentityClaims
§验证流程
- 从 credential.signature 解析 64 字节 Ed25519 签名
- 用 verifying_key 对 credential.claims(明文 proto bytes)验签
- proto decode IdentityClaims
- 检查 expires_at 是否已过期
§Arguments
credential- 待验证的 AIdCredential,字段为 key_id / claims / signatureverifying_key- Ed25519 公钥,由调用方提供(来自 AIS 注册响应或密钥缓存)
§Returns
Ok(IdentityClaims)- 验签通过且未过期,返回解码后的身份声明Err(AidError)- 签名无效、格式错误或 token 已过期
Auto Trait Implementations§
impl Freeze for AIdCredentialVerifier
impl RefUnwindSafe for AIdCredentialVerifier
impl Send for AIdCredentialVerifier
impl Sync for AIdCredentialVerifier
impl Unpin for AIdCredentialVerifier
impl UnsafeUnpin for AIdCredentialVerifier
impl UnwindSafe for AIdCredentialVerifier
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request