Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align metadata with new Oid4Vci specs #53

Merged
merged 8 commits into from
May 3, 2024
Prev Previous commit
Next Next commit
add http language header & remove format from credential response
Signed-off-by: Johannes Tuerk <[email protected]>
JoTiTu committed May 2, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 213e82ce2e04d95e02a96076ef0cdbe7fa5330a7
Original file line number Diff line number Diff line change
@@ -17,12 +17,6 @@ public class OidCredentialResponse
[JsonProperty("c_nonce_expires_in")]
public int? CNonceExpiresIn { get; set; }

/// <summary>
/// REQUIRED. JSON string denoting the format of the issued Credential.
/// </summary>
[JsonProperty("format")]
public string Format { get; set; } = null!;

/// <summary>
/// OPTIONAL. A JSON string containing a security token subsequently used to obtain a Credential.
/// MUST be present when credential is not returned.
Original file line number Diff line number Diff line change
@@ -17,8 +17,9 @@ public interface IOid4VciClientService
/// Fetches the metadata related to the OID issuer from the specified endpoint.
/// </summary>
/// <param name="endpoint">The endpoint URL to retrieve the issuer metadata.</param>
/// <param name="preferredLanguage">The preferred language of the wallet in which it would like to retrieve the issuer metadata. The default is "en"</param>
/// <returns>A task that represents the asynchronous operation. The task result contains the OID issuer metadata.</returns>
Task<OidIssuerMetadata> FetchIssuerMetadataAsync(Uri endpoint);
Task<OidIssuerMetadata> FetchIssuerMetadataAsync(Uri endpoint, string preferredLanguage = "en");

/// <summary>
/// Requests a verifiable credential using the provided parameters.
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ public Oid4VciClientService(
private readonly IKeyStore _keyStore;

/// <inheritdoc />
public async Task<OidIssuerMetadata> FetchIssuerMetadataAsync(Uri endpoint)
public async Task<OidIssuerMetadata> FetchIssuerMetadataAsync(Uri endpoint, string preferredLanguage)
{
var baseEndpoint = endpoint
.AbsolutePath
@@ -50,9 +50,10 @@ public async Task<OidIssuerMetadata> FetchIssuerMetadataAsync(Uri endpoint)

var metadataUrl = new Uri(baseEndpoint, ".well-known/openid-credential-issuer");

var response = await _httpClientFactory
.CreateClient()
.GetAsync(metadataUrl);
var client = _httpClientFactory.CreateClient();
client.DefaultRequestHeaders.Add("Accept-Language", preferredLanguage);

var response = await client.GetAsync(metadataUrl);

if (!response.IsSuccessStatusCode)
{
Loading