From 06d20dbebafcffad900f7b15fc31795399706a33 Mon Sep 17 00:00:00 2001 From: hawkbee1 Date: Fri, 25 Oct 2024 11:30:34 +0000 Subject: [PATCH] Revert "feat: Remove iss from jwt for cred request #2951" This reverts commit 0f238ede5a7d270dbdd3f8b1718bd55fc72d1b15. --- packages/oidc4vc/lib/src/oidc4vc.dart | 7 +++++-- packages/oidc4vc/test/src/oidc4vc_test.dart | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/oidc4vc/lib/src/oidc4vc.dart b/packages/oidc4vc/lib/src/oidc4vc.dart index 2b6f3083c..f75e400ba 100644 --- a/packages/oidc4vc/lib/src/oidc4vc.dart +++ b/packages/oidc4vc/lib/src/oidc4vc.dart @@ -1114,6 +1114,7 @@ class OIDC4VC { tokenParameters: issuerTokenParameters, clientAuthentication: clientAuthentication, cnonce: nonce, + iss: issuerTokenParameters.clientId, ); credentialData['proof'] = { @@ -1410,11 +1411,13 @@ class OIDC4VC { Future getIssuerJwt({ required IssuerTokenParameters tokenParameters, required ClientAuthentication clientAuthentication, + required String iss, String? cnonce, }) async { final iat = (DateTime.now().millisecondsSinceEpoch / 1000).round() - 30; final payload = { + 'iss': iss, 'iat': iat, 'aud': tokenParameters.issuer, }; @@ -1600,7 +1603,7 @@ class OIDC4VC { 'aud': tokenParameters.audience, 'exp': iat + 1000, 'sub': tokenParameters.did, - //'iss': tokenParameters.did, + 'iss': tokenParameters.did, 'vp': { '@context': ['https://www.w3.org/2018/credentials/v1'], 'id': presentationId, @@ -1705,7 +1708,7 @@ class OIDC4VC { 'aud': tokenParameters.audience, // devrait ĂȘtre verifier 'exp': iat + 1000, 'sub': issAndSub, - // 'iss': issAndSub, + 'iss': issAndSub, }; if (tokenParameters.nonce != null) { diff --git a/packages/oidc4vc/test/src/oidc4vc_test.dart b/packages/oidc4vc/test/src/oidc4vc_test.dart index 839224a1e..aee5c7a99 100644 --- a/packages/oidc4vc/test/src/oidc4vc_test.dart +++ b/packages/oidc4vc/test/src/oidc4vc_test.dart @@ -684,6 +684,7 @@ void main() { final issuerJwt = await oidc4vc.getIssuerJwt( tokenParameters: tokenParameters, clientAuthentication: ClientAuthentication.clientId, + iss: clientId, cnonce: '2da2d506-0910-11ef-9e49-0a1628958560', );