pub struct CredentialResponse {
pub credential: Option<Value>,
pub transaction_id: Option<String>,
pub c_nonce: Option<String>,
pub c_nonce_expires_in: Option<u64>,
}Expand description
Credential issuance response.
Fields§
§credential: Option<Value>The issued credential (format-specific).
transaction_id: Option<String>Transaction ID for deferred issuance.
c_nonce: Option<String>Nonce for subsequent requests.
c_nonce_expires_in: Option<u64>Nonce lifetime in seconds.
Implementations§
Source§impl CredentialResponse
impl CredentialResponse
Sourcepub fn immediate(
credential: Value,
c_nonce: impl Into<String>,
c_nonce_expires_in: u64,
) -> Self
pub fn immediate( credential: Value, c_nonce: impl Into<String>, c_nonce_expires_in: u64, ) -> Self
Create an immediate issuance response containing the credential.
§Example
use auth_framework::protocols::openid4vci::CredentialResponse;
let resp = CredentialResponse::immediate(
serde_json::json!({"vc": "..."}),
"nonce-abc",
300,
);
assert!(resp.credential.is_some());
assert!(resp.transaction_id.is_none());Sourcepub fn deferred(
transaction_id: impl Into<String>,
c_nonce: impl Into<String>,
c_nonce_expires_in: u64,
) -> Self
pub fn deferred( transaction_id: impl Into<String>, c_nonce: impl Into<String>, c_nonce_expires_in: u64, ) -> Self
Create a deferred issuance response with a transaction ID.
§Example
use auth_framework::protocols::openid4vci::CredentialResponse;
let resp = CredentialResponse::deferred("tx-123", "nonce-xyz", 300);
assert!(resp.credential.is_none());
assert_eq!(resp.transaction_id.as_deref(), Some("tx-123"));Trait Implementations§
Source§impl Clone for CredentialResponse
impl Clone for CredentialResponse
Source§fn clone(&self) -> CredentialResponse
fn clone(&self) -> CredentialResponse
Returns a duplicate of the value. Read more
1.0.0 · 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 CredentialResponse
impl Debug for CredentialResponse
Source§impl<'de> Deserialize<'de> for CredentialResponse
impl<'de> Deserialize<'de> for CredentialResponse
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 CredentialResponse
impl RefUnwindSafe for CredentialResponse
impl Send for CredentialResponse
impl Sync for CredentialResponse
impl Unpin for CredentialResponse
impl UnsafeUnpin for CredentialResponse
impl UnwindSafe for CredentialResponse
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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