getApkamPublicKey method
Fetch the APKAM public signing key which enrollmentId of atSign has
published in its per-enrollment namespace. See
ApkamSigning.publicSigningKeyUri.
Implementation
Future<String> getApkamPublicKey(String atSign, String enrollmentId) async {
atSign = atSign.toAtsign();
requireApskEnrollmentId(enrollmentId);
String? cached = lookupPubKey(atSign, enrollmentId);
if (cached != null) return cached;
var s = apskUri(atSign, enrollmentId);
final AtValue av;
try {
av = await atClient.get(
AtKey.fromString(s),
getRequestOptions: GetRequestOptions()..useRemoteAtServer = true,
);
} on AtKeyNotFoundException {
await _refuseIfWithdrawn(atSign, enrollmentId);
rethrow;
} on KeyNotFoundException {
await _refuseIfWithdrawn(atSign, enrollmentId);
rethrow;
}
if (av.value is! String) {
throw IllegalStateException('Value of $s is not a String');
}
cachePubKey(atSign, enrollmentId, av.value);
return av.value;
}