Skip to content

Commit 1c55d20

Browse files
committed
fix kb-jwt payload if value is null
Signed-off-by: Johannes Tuerk <johannes.tuerk@lissi.id>
1 parent 414fe75 commit 1c55d20

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/WalletFramework.SdJwtVc/Services/SdJwtVcHolderService/SdJwtSignerService.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,19 @@ public async Task<string> GenerateKbProofOfPossessionAsync(KeyId keyId, string a
3131
}
3232
}
3333

34-
var payload = new
34+
var payload = new Dictionary<string, object>
3535
{
36-
aud = audience,
37-
nonce,
38-
iat = DateTimeOffset.UtcNow.ToUnixTimeSeconds(),
39-
sd_hash = sdHash,
40-
iss = clientId
36+
{ "aud", audience },
37+
{ "nonce", nonce },
38+
{ "iat" , DateTimeOffset.UtcNow.ToUnixTimeSeconds() }
4139
};
4240

41+
if (!sdHash.IsNullOrEmpty())
42+
payload["sd_hash"] = sdHash!;
43+
44+
if (!clientId.IsNullOrEmpty())
45+
payload["iss"] = clientId!;
46+
4347
return await CreateSignedJwt(header, payload, keyId);
4448
}
4549

0 commit comments

Comments
 (0)