Event constructor
Event(})
Default constructor
verify: ensure your event isValid() –> id, signature, timestamp…
String id =
"4b697394206581b03ca5222b37449a9cdca1741b122d78defc177444e2536f49";
String pubKey =
"981cc2078af05b62ee1f98cff325aac755bf5c5836a265c254447b5933c6223b";
int createdAt = 1672175320;
int kind = 1;
List<List<String>> tags = [];
String content = "Ceci est une analyse du websocket";
String sig =
"797c47bef50eff748b8af0f38edcb390facf664b2367d72eb71c50b5f37bc83c4ae9cc9007e8489f5f63c66a66e101fd1515d0a846385953f5f837efb9afe885";
Event event = Event(
id,
pubKey,
createdAt,
kind,
tags,
content,
sig,
verify: true,
subscriptionId: null,
);
Implementation
Event(
this.id,
this.pubkey,
this.createdAt,
this.kind,
this.tags,
this.content,
this.sig, {
this.subscriptionId,
bool verify = true,
}) {
pubkey = pubkey.toLowerCase();
if (verify && isValid() == false) throw 'Invalid event';
}