Skip to content

Commit

Permalink
Url encode client metadata for /par post call
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Mar 14, 2024
1 parent ed04b95 commit 6df42f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/oidc4vc/get_authorization_uri_for_issuer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Future<void> getAuthorizationUriForIssuer({
oidc4vciDraftType: oidc4vciDraftType,
vcFormatType: vcFormatType,
clientAssertion: clientAssertion,
secureAuthorizedFlow: secureAuthorizedFlow,
);

if (secureAuthorizedFlow) {
Expand Down
10 changes: 9 additions & 1 deletion packages/oidc4vc/lib/src/oidc4vc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ class OIDC4VC {
required OIDC4VCIDraftType oidc4vciDraftType,
required VCFormatType vcFormatType,
required String? clientAssertion,
required bool secureAuthorizedFlow,
}) async {
try {
final openIdConfiguration = await getOpenIdConfig(
Expand Down Expand Up @@ -174,6 +175,7 @@ class OIDC4VC {
oidc4vciDraftType: oidc4vciDraftType,
vcFormatType: vcFormatType,
clientAssertion: clientAssertion,
secureAuthorizedFlow: secureAuthorizedFlow,
);

return (authorizationEndpoint, authorizationRequestParemeters);
Expand All @@ -200,6 +202,7 @@ class OIDC4VC {
required OIDC4VCIDraftType oidc4vciDraftType,
required VCFormatType vcFormatType,
required String? clientAssertion,
required bool secureAuthorizedFlow,
}) {
//https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0.html#name-successful-authorization-re

Expand Down Expand Up @@ -317,9 +320,14 @@ class OIDC4VC {
'nonce': nonce,
'code_challenge': codeChallenge,
'code_challenge_method': 'S256',
'client_metadata': jsonEncode(clientMetaData),
};

if (secureAuthorizedFlow) {
myRequest['client_metadata'] =
Uri.encodeComponent(jsonEncode(clientMetaData));
} else {
myRequest['client_metadata'] = jsonEncode(clientMetaData);
}
switch (clientAuthentication) {
case ClientAuthentication.none:
break;
Expand Down

0 comments on commit 6df42f0

Please sign in to comment.