From c22917d076b88e841564b4916b0afc592eea9f54 Mon Sep 17 00:00:00 2001 From: jeffthibault Date: Mon, 1 Aug 2022 19:45:56 -0400 Subject: [PATCH] add is_valid method to RelayMessageType class --- nostr/message_type.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nostr/message_type.py b/nostr/message_type.py index 111553a..3f5206b 100644 --- a/nostr/message_type.py +++ b/nostr/message_type.py @@ -7,4 +7,9 @@ class RelayMessageType: EVENT = "EVENT" NOTICE = "NOTICE" END_OF_STORED_EVENTS = "EOSE" - \ No newline at end of file + + @staticmethod + def is_valid(type: str) -> bool: + if type == RelayMessageType.EVENT or type == RelayMessageType.NOTICE or type == RelayMessageType.END_OF_STORED_EVENTS: + return True + return False \ No newline at end of file