Skip to content

Commit

Permalink
feat: Suppot _sd_alg = sha-256 only #2560
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Apr 4, 2024
1 parent 3e39b95 commit f7363dc
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/oidc4vc/add_oidc4vc_credential.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ Future<void> addOIDC4VCCredential({
final jsonContent = jwtDecode.parseJwt(data);

if (format == VCFormatType.vcSdJWT.value) {
final sdAlg = jsonContent['_sd_alg'];

if (sdAlg == null || sdAlg != 'sha-256') {
throw ResponseMessage(
data: {
'error': 'invalid_request',
'error_description': 'Only sha-256 is supported.',
},
);
}

credentialFromOIDC4VC = jsonContent;
} else {
credentialFromOIDC4VC = jsonContent['vc'] as Map<String, dynamic>;
Expand Down

0 comments on commit f7363dc

Please sign in to comment.