Performant validation. Prevent redundant decoding. Remove unused errors.

This commit is contained in:
Jay
2026-04-20 22:59:48 -04:00
parent 62aeef4eaf
commit 747781f5bf
4 changed files with 57 additions and 42 deletions
-14
View File
@@ -3,10 +3,6 @@
// serialization, cryptographic signatures, and subscription filters.
package events
import (
"regexp"
)
// Tag represents a single tag within an event as an array of strings.
// The first element identifies the tag name, the second contains the value,
// and subsequent elements are optional.
@@ -23,13 +19,3 @@ type Event struct {
Content string `json:"content"`
Sig string `json:"sig"`
}
var (
// Hex64Pattern matches 64-character, lowercase, hexadecimal strings.
// Used for validating event IDs and cryptographic keys.
Hex64Pattern = regexp.MustCompile("^[a-f0-9]{64}$")
// Hex128Pattern matches 128-character, lowercase, hexadecimal strings.
// Used for validating signatures.
Hex128Pattern = regexp.MustCompile("^[a-f0-9]{128}$")
)