pub struct CredentialIssuer { /* private fields */ }Expand description
OpenID4VCI Credential Issuer.
Implementations§
Source§impl CredentialIssuer
impl CredentialIssuer
Sourcepub fn new(metadata: IssuerMetadata) -> Self
pub fn new(metadata: IssuerMetadata) -> Self
Create a new credential issuer.
Sourcepub fn metadata(&self) -> &IssuerMetadata
pub fn metadata(&self) -> &IssuerMetadata
Get the issuer metadata (for the discovery endpoint).
Sourcepub async fn generate_nonce(&self, lifetime_secs: u64) -> String
pub async fn generate_nonce(&self, lifetime_secs: u64) -> String
Generate a fresh c_nonce.
Sourcepub async fn validate_nonce(&self, nonce: &str) -> bool
pub async fn validate_nonce(&self, nonce: &str) -> bool
Validate a c_nonce.
Sourcepub async fn consume_nonce(&self, nonce: &str) -> bool
pub async fn consume_nonce(&self, nonce: &str) -> bool
Consume a c_nonce (single use).
Sourcepub async fn create_offer(
&self,
credential_config_ids: Vec<String>,
subject_id: &str,
) -> Result<CredentialOffer>
pub async fn create_offer( &self, credential_config_ids: Vec<String>, subject_id: &str, ) -> Result<CredentialOffer>
Create a credential offer with a pre-authorized code.
Sourcepub async fn validate_pre_auth_code(
&self,
code: &str,
) -> Result<(String, String)>
pub async fn validate_pre_auth_code( &self, code: &str, ) -> Result<(String, String)>
Validate a pre-authorized code and return (config_id, subject_id).
Sourcepub async fn issue_credential(
&self,
request: &CredentialRequest,
subject_id: &str,
credential_data: Option<Value>,
) -> Result<CredentialResponse>
pub async fn issue_credential( &self, request: &CredentialRequest, subject_id: &str, credential_data: Option<Value>, ) -> Result<CredentialResponse>
Process a credential request and produce a response.
This validates the request format, checks the proof if present, and returns either the credential or a deferred transaction ID.
Sourcepub async fn issue_batch(
&self,
requests: &[CredentialRequest],
subject_id: &str,
credential_data: &[Option<Value>],
) -> Result<Vec<CredentialResponse>>
pub async fn issue_batch( &self, requests: &[CredentialRequest], subject_id: &str, credential_data: &[Option<Value>], ) -> Result<Vec<CredentialResponse>>
Process a batch credential request (§8).
Issues multiple credentials in a single response, one per request.
Sourcepub async fn complete_deferred(
&self,
transaction_id: &str,
credential_data: Value,
) -> Result<CredentialResponse>
pub async fn complete_deferred( &self, transaction_id: &str, credential_data: Value, ) -> Result<CredentialResponse>
Complete a deferred credential issuance.
Sourcepub async fn pending_count(&self) -> usize
pub async fn pending_count(&self) -> usize
Get the count of pending deferred issuances.
Sourcepub async fn cleanup_nonces(&self) -> usize
pub async fn cleanup_nonces(&self) -> usize
Clean up expired nonces.
Auto Trait Implementations§
impl Freeze for CredentialIssuer
impl !RefUnwindSafe for CredentialIssuer
impl Send for CredentialIssuer
impl Sync for CredentialIssuer
impl Unpin for CredentialIssuer
impl UnsafeUnpin for CredentialIssuer
impl !UnwindSafe for CredentialIssuer
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
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 more