Skip to content

Commit

Permalink
Update request presentation
Browse files Browse the repository at this point in the history
  • Loading branch information
damienbod committed Dec 15, 2024
1 parent 1b6c812 commit 037c8d2
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 11 deletions.
46 changes: 38 additions & 8 deletions IssueUnlockDoor/Services/IssuanceRequestPayload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,22 @@ namespace IssueUnlockDoor.Services;
/// </summary>
public class IssuanceRequestPayload
{
[JsonPropertyName("includeQRCode")]
public bool IncludeQRCode { get; set; }
[JsonPropertyName("callback")]
public Callback Callback { get; set; } = new Callback();
[JsonPropertyName("authority")]
public string Authority { get; set; } = string.Empty;
[JsonPropertyName("includeReceipt")]
public bool IncludeReceipt { get; set; }
[JsonPropertyName("registration")]
public Registration Registration { get; set; } = new Registration();
[JsonPropertyName("callback")]
public Callback Callback { get; set; } = new Callback();

[JsonPropertyName("type")]
public string CredentialsType { get; set; } = string.Empty;
[JsonPropertyName("manifest")]
public string Manifest { get; set; } = string.Empty;

[JsonPropertyName("includeQRCode")]
public bool IncludeQRCode { get; set; }


[JsonPropertyName("requestedCredentials")]
public List<RequestedCredentials> RequestedCredentials { get; set; } = new List<RequestedCredentials>();
}

public class Callback
Expand Down Expand Up @@ -52,3 +55,30 @@ public class Pin
[JsonPropertyName("length")]
public int Length { get; set; } = 4;
}

public class RequestedCredentials
{
[JsonPropertyName("type")]
public string CrendentialsType { get; set; } = string.Empty;
[JsonPropertyName("purpose")]
public string Purpose { get; set; } = string.Empty;
[JsonPropertyName("acceptedIssuers")]
public List<string> AcceptedIssuers { get; set; } = new List<string>();
[JsonPropertyName("configuration")]
public RequestedConfiguration Configuration { get; set; } = new RequestedConfiguration();
}

public class RequestedConfiguration
{
[JsonPropertyName("validation")]
public RequestedConfigurationValidation Validation { get; set; } = new RequestedConfigurationValidation();
}

public class RequestedConfigurationValidation
{
[JsonPropertyName("allowRevoked")]
public bool AllowRevoked { get; set; }
[JsonPropertyName("validateLinkedDomain")]
public bool ValidateLinkedDomain { get; set; }
}

10 changes: 7 additions & 3 deletions IssueUnlockDoor/Services/IssuerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ public IssuanceRequestPayload GetIssuanceRequestPayload(HttpRequest request)
{
var payload = new IssuanceRequestPayload();

payload.CredentialsType = "DoorCode";

payload.Manifest = $"{_credentialSettings.CredentialManifest}";
payload.RequestedCredentials =
[
new RequestedCredentials
{
CrendentialsType = "DoorCode"
}
];

var host = GetRequestHostName(request);
payload.Callback.State = Guid.NewGuid().ToString();
Expand Down

0 comments on commit 037c8d2

Please sign in to comment.