saveCramKey method
Implementation
Future<String> saveCramKey({
required String atSign,
required String cramKey,
String? sourceTransactionPath,
}) async {
await ensureReady();
final normalizedAtSign = normalizeAtSign(atSign);
final file = File(path.join(_directory!.path, _fileNameForAtSign(atSign)));
final payload = <String, dynamic>{
'atSign': normalizedAtSign,
'cramKey': cramKey,
'createdAtUtc': DateTime.now().toUtc().toIso8601String(),
if (sourceTransactionPath != null && sourceTransactionPath.isNotEmpty)
'sourceTransactionPath': sourceTransactionPath,
};
await file.writeAsString(
const JsonEncoder.withIndent(' ').convert(payload),
);
return file.path;
}