identity_credential/validator/jwt_credential_validation/
decoded_jwt_credential.rs

1// Copyright 2020-2023 IOTA Stiftung
2// SPDX-License-Identifier: Apache-2.0
3
4use crate::credential::Credential;
5use crate::credential::CredentialV2;
6use identity_core::common::Object;
7use identity_verification::jose::jws::JwsHeader;
8
9/// Decoded [`Credential`] from a cryptographically verified JWS.
10///
11/// Note that having an instance of this type only means the JWS it was constructed from was verified.
12/// It does not imply anything about a potentially present proof property on the credential itself.
13#[non_exhaustive]
14#[derive(Debug, Clone)]
15pub struct DecodedJwtCredential<T = Object> {
16  /// The decoded credential parsed to the [Verifiable Credentials Data model](https://www.w3.org/TR/vc-data-model/).
17  pub credential: Credential<T>,
18  /// The protected header parsed from the JWS.
19  pub header: Box<JwsHeader>,
20  /// The custom claims parsed from the JWT.
21  pub custom_claims: Option<Object>,
22}
23
24/// Decoded [`CredentialV2`] from a cryptographically verified JWS.
25///
26/// Note that having an instance of this type only means the JWS it was constructed from was verified.
27/// It does not imply anything about a potentially present proof property on the credential itself.
28#[derive(Debug, Clone)]
29pub struct DecodedJwtCredentialV2<T = Object> {
30  /// The decoded credential parsed to the [Verifiable Credentials Data model](https://www.w3.org/TR/vc-data-model/).
31  pub credential: CredentialV2<T>,
32  /// The protected header parsed from the JWS.
33  pub header: Box<JwsHeader>,
34}