mirror of
https://github.com/aljazceru/python-nostr.git
synced 2025-12-19 07:14:23 +01:00
add type validation for event content
This commit is contained in:
@@ -22,6 +22,9 @@ class Event():
|
||||
tags: "list[list[str]]"=[],
|
||||
id: str=None,
|
||||
signature: str=None) -> None:
|
||||
if not isinstance(content, str):
|
||||
raise TypeError("Argument 'content' must be of type str")
|
||||
|
||||
self.id = id if id != None else sha256(Event.serialize(public_key, created_at, kind, tags, content)).hexdigest()
|
||||
self.public_key = public_key
|
||||
self.content = content
|
||||
|
||||
Reference in New Issue
Block a user