Skip to content

Commit

Permalink
relative kid verifiaction
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkbee1 committed Nov 1, 2024
1 parent 506d93e commit 61dc881
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions packages/oidc4vc/lib/src/oidc4vc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1072,18 +1072,25 @@ class OIDC4VC {

return jsonDecode(jsonEncode(data)) as Map<String, dynamic>;
} else {
final idAndVerificationMethodPath =
JsonPath(r'$..[?(@.verificationMethod)]');
final idAndVerificationMethod = (idAndVerificationMethodPath
.read(didDocument)
.first
.value!) as Map<String, dynamic>;
final jsonPath = JsonPath(r'$..verificationMethod');
late List<dynamic> data;

if (holderKid == null) {
data = (jsonPath.read(didDocument).first.value! as List).toList();
} else {
data = (jsonPath.read(didDocument).first.value! as List).where(
data = (idAndVerificationMethod['verificationMethod'] as List).where(
(dynamic e) {
final id = idAndVerificationMethod['id'];
final kid = e['id'].toString();

if (holderKid.contains('#0') && kid == '#0') {
return true;
if (kid.startsWith('#')) {
if (holderKid == id + kid) return true;
} else {
if (holderKid == kid) return true;
}
Expand Down

0 comments on commit 61dc881

Please sign in to comment.