readLabCertificate method
Resolves and validates the current CIP-152 lab certificate.
Implementation
Future<Cip152LabCertificate?> readLabCertificate(IpfsGateway gateway) async {
if (!await hasKey(cip152LabKey)) return null;
final reference = await getValue(cip152LabKey);
final path = Uri.tryParse(reference)?.path ?? reference;
if (!path.endsWith('/lab.json') && path != 'lab.json') {
throw const FormatException(
'CIP-152 lab reference must point to lab.json.',
);
}
return Cip152LabCertificate.fromJson(await gateway.readJson(reference));
}