checkUrl method
checks if a url is a blossom url.
it its not a blossom url, the url is returned.
if its a blossom url, blossom is used to check if the blob exists on the server(s)
returns alive url if the blob exists, throws an error if the blob does not exist
Implementation
Future<String> checkUrl({
required String url,
List<String>? serverUrls,
String? pubkey,
}) async {
// Regular expression to match SHA256 in URLs
final sha256Match = sha256Regex.firstMatch(url);
if (sha256Match != null) {
// This is a blossom URL, handle it using blossom protocol
final sha256 = sha256Match.group(1)!;
// Try to check using blossom
return await _blossom.checkBlob(
sha256: sha256,
serverUrls: serverUrls,
pubkeyToFetchUserServerList: pubkey,
);
} else {
return url;
}
}