-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
4 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -346,44 +346,15 @@ class OIDC4VC { | |
|
||
Future<Response<Map<String, dynamic>>> getDidDocument(String didKey) async { | ||
try { | ||
if (didKey.startsWith('did:ebsi')) { | ||
final didDocument = await client.get<Map<String, dynamic>>( | ||
'https://api-pilot.ebsi.eu/did-registry/v3/identifiers/$didKey', | ||
); | ||
return didDocument; | ||
} else if (didKey.startsWith('did:web')) { | ||
final url = didWebToUrl(didKey); | ||
final didDocument = await client.get<Map<String, dynamic>>(url); | ||
return didDocument; | ||
} else { | ||
throw Exception(); | ||
} | ||
final didDocument = await client.get<Map<String, dynamic>>( | ||
'https://unires:[email protected]/1.0/identifiers/$didKey', | ||
); | ||
return didDocument; | ||
} catch (e) { | ||
throw Exception(e); | ||
} | ||
} | ||
|
||
String didWebToUrl(String didKey) { | ||
if (!didKey.startsWith('did:web:')) { | ||
throw const FormatException('Invalid DID format'); | ||
} | ||
|
||
// Extract the path after 'did:web:' | ||
final didPath = didKey.substring('did:web:'.length); | ||
|
||
if (didPath.contains(':')) { | ||
final parts = didPath.split(':'); | ||
final domain = parts[0]; | ||
final issuer = parts[1]; | ||
|
||
final url = 'https://$domain/$issuer/did.json'; | ||
return url; | ||
} else { | ||
final url = 'https://$didPath/.well-known/did.json'; | ||
return url; | ||
} | ||
} | ||
|
||
Future<String> readTokenEndPoint( | ||
Map<String, dynamic> openidConfigurationResponse, | ||
) async { | ||
|