Skip to content

Commit 17c4599

Browse files
authored
use non permanent key in ad-hoc issuance flow (#178)
* use non permanent key in ad-hoc issuance flow Signed-off-by: Johannes Tuerk <johannes.tuerk@lissi.id> * slight refactoring Signed-off-by: Johannes Tuerk <johannes.tuerk@lissi.id> --------- Signed-off-by: Johannes Tuerk <johannes.tuerk@lissi.id>
1 parent a6a0e84 commit 17c4599

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/WalletFramework.Oid4Vc/Oid4Vci/CredRequest/Implementations/CredentialRequestService.cs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,25 +57,26 @@ private async Task<CredentialRequest> CreateCredentialRequest(
5757
oauthToken => oauthToken.CNonce,
5858
dPopToken => dPopToken.Token.CNonce);
5959

60-
var keyBindingJwt = await _sdJwtSigner.GenerateKbProofOfPossessionAsync(
61-
keyId,
62-
issuerMetadata.CredentialIssuer.ToString(),
63-
cNonce,
64-
"openid4vci-proof+jwt",
65-
null,
66-
clientOptions.ToNullable()?.ClientId);
67-
6860
var proof = Option<ProofOfPossession>.None;
6961
var sessionTranscript = Option<SessionTranscript>.None;
7062

71-
authorizationRequest.Match(
63+
await authorizationRequest.Match(
7264
Some: _ =>
7365
{
7466
if (format == "mso_mdoc")
7567
sessionTranscript = authorizationRequest.UnwrapOrThrow(new Exception()).ToVpHandover().ToSessionTranscript();
68+
return Task.CompletedTask;
7669
},
77-
None: () =>
70+
None: async () =>
7871
{
72+
var keyBindingJwt = await _sdJwtSigner.GenerateKbProofOfPossessionAsync(
73+
keyId,
74+
issuerMetadata.CredentialIssuer.ToString(),
75+
cNonce,
76+
"openid4vci-proof+jwt",
77+
null,
78+
clientOptions.ToNullable()?.ClientId);
79+
7980
proof = new ProofOfPossession
8081
{
8182
ProofType = "jwt",
@@ -93,7 +94,7 @@ async Task<Validation<CredentialResponse>> ICredentialRequestService.RequestCred
9394
Option<ClientOptions> clientOptions,
9495
Option<AuthorizationRequest> authorizationRequest)
9596
{
96-
var keyId = await _keyStore.GenerateKey();
97+
var keyId = await _keyStore.GenerateKey(isPermanent: authorizationRequest.IsNone);
9798

9899
var requestJson = await configuration.Match(
99100
async sdJwt =>

0 commit comments

Comments
 (0)