From 2a39cc96d074d93d128627ba8eb68d799d9fcd4a Mon Sep 17 00:00:00 2001 From: Sebastian Bickerle <42742030+ntsbs@users.noreply.github.com> Date: Fri, 16 Aug 2024 18:30:38 +0200 Subject: [PATCH] add ephemeral key for dpop (#160) Signed-off-by: Sebastian Bickerle --- .../Cryptography/Abstractions/IKeyStore.cs | 3 ++- .../Oid4Vci/Authorization/Implementations/TokenService.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/WalletFramework.Core/Cryptography/Abstractions/IKeyStore.cs b/src/WalletFramework.Core/Cryptography/Abstractions/IKeyStore.cs index 903380ed..f53e4de2 100644 --- a/src/WalletFramework.Core/Cryptography/Abstractions/IKeyStore.cs +++ b/src/WalletFramework.Core/Cryptography/Abstractions/IKeyStore.cs @@ -13,8 +13,9 @@ public interface IKeyStore /// Asynchronously generates a key for the specified algorithm and returns the key identifier. /// /// The algorithm for key generation (default is "ES256"). + /// If false creates an ephemeral key. /// A representing the generated key's identifier as a string. - Task GenerateKey(string alg = "ES256"); + Task GenerateKey(string alg = "ES256", bool isPermanent = true); /// /// Asynchronously loads a key by its identifier and returns it as a JSON Web Key (JWK) containing the public key diff --git a/src/WalletFramework.Oid4Vc/Oid4Vci/Authorization/Implementations/TokenService.cs b/src/WalletFramework.Oid4Vc/Oid4Vci/Authorization/Implementations/TokenService.cs index b3f66633..1247a90a 100644 --- a/src/WalletFramework.Oid4Vc/Oid4Vci/Authorization/Implementations/TokenService.cs +++ b/src/WalletFramework.Oid4Vc/Oid4Vci/Authorization/Implementations/TokenService.cs @@ -30,7 +30,7 @@ public async Task> RequestToken( { if (metadata.IsDPoPSupported) { - var keyId = await _keyStore.GenerateKey(); + var keyId = await _keyStore.GenerateKey(isPermanent: false); var config = new DPopConfig(keyId, metadata.TokenEndpoint);