readPendingCramKey method
Implementation
Future<Map<String, dynamic>> readPendingCramKey(String atSign) async {
await ensureReady();
final file = File(path.join(_directory!.path, _fileNameForAtSign(atSign)));
if (!await file.exists()) {
throw Exception('CRAM key file not found for ${normalizeAtSign(atSign)}');
}
final raw = await file.readAsString();
final decoded = jsonDecode(raw);
if (decoded is Map<String, dynamic>) {
return decoded;
}
if (decoded is Map) {
return decoded.cast<String, dynamic>();
}
throw Exception(
'Invalid CRAM key file format for ${normalizeAtSign(atSign)}',
);
}