mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-09 08:38:50 +00:00
validate that the event is an object.
This commit is contained in:
1
event.ts
1
event.ts
@@ -59,6 +59,7 @@ export function getEventHash(event: Event): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function validateEvent(event: Event): boolean {
|
export function validateEvent(event: Event): boolean {
|
||||||
|
if (typeof event !== 'object') return false
|
||||||
if (typeof event.content !== 'string') return false
|
if (typeof event.content !== 'string') return false
|
||||||
if (typeof event.created_at !== 'number') return false
|
if (typeof event.created_at !== 'number') return false
|
||||||
if (typeof event.pubkey !== 'string') return false
|
if (typeof event.pubkey !== 'string') return false
|
||||||
|
|||||||
Reference in New Issue
Block a user