report method
Reports a blob to the server
sha256
is the hash of the blob
eventId
is the event id where the blob was mentioned
reportType
is the type of report, e.g. malware @see nip56
reportMsg
is the message to send to the server
serverUrl
server url to report to
returns the http status code of the rcv server
Implementation
Future<int> report({
required String sha256,
required String eventId,
required String reportType,
required String reportMsg,
required String serverUrl,
}) async {
final now = DateTime.now().millisecondsSinceEpoch ~/ 1000;
_checkSigner();
final Nip01Event reportEvent = Nip01Event(
content: reportMsg,
pubKey: _signer.getPublicKey(),
kind: kReport,
createdAt: now,
tags: [
["x", sha256, reportType.toLowerCase()],
["e", eventId, reportType.toLowerCase()],
["server", serverUrl],
],
);
await _signer.sign(reportEvent);
return _blossomImpl.report(
sha256: sha256,
reportEvent: reportEvent,
serverUrl: serverUrl,
);
}