Documentation
¶
Index ¶
- Variables
- func ClearChallengeForConnection(client nostr.ClientInterface)
- func GetAuthedPubkey(client nostr.ClientInterface) string
- func GetChallengeForConnection(client nostr.ClientInterface) string
- func HandleAuth(client nostr.ClientInterface, message []interface{})
- func HandleClose(client nostr.ClientInterface, message []interface{})
- func HandleCount(client nostr.ClientInterface, message []interface{})
- func HandleEvent(client nostr.ClientInterface, message []interface{})
- func HandleReq(client nostr.ClientInterface, message []interface{})
- func IsAuthenticated(client nostr.ClientInterface) bool
- func SetAuthenticated(client nostr.ClientInterface, pubkey string)
- func SetChallengeForConnection(client nostr.ClientInterface, challenge string)
- func VerifyAuthEvent(client nostr.ClientInterface, evt nostr.Event) error
Constants ¶
This section is empty.
Variables ¶
var OnEventStored func(evt nostr.Event)
OnEventStored is called after an event is successfully stored. Set by the server package to broadcast events to active subscribers.
Functions ¶
func ClearChallengeForConnection ¶ added in v0.5.0
func ClearChallengeForConnection(client nostr.ClientInterface)
ClearChallengeForConnection removes the challenge for a connection
func GetAuthedPubkey ¶ added in v0.6.0
func GetAuthedPubkey(client nostr.ClientInterface) string
GetAuthedPubkey returns the pubkey the connection authenticated as, or "" if the connection has not completed NIP-42 AUTH.
func GetChallengeForConnection ¶
func GetChallengeForConnection(client nostr.ClientInterface) string
GetChallengeForConnection retrieves the challenge string for a given connection
func HandleAuth ¶
func HandleAuth(client nostr.ClientInterface, message []interface{})
HandleAuth processes the "AUTH" message type as defined in NIP-42
func HandleClose ¶
func HandleClose(client nostr.ClientInterface, message []interface{})
HandleClose processes a "CLOSE" message from a client
func HandleCount ¶ added in v0.6.0
func HandleCount(client nostr.ClientInterface, message []interface{})
HandleCount processes a NIP-45 "COUNT" message. The wire format mirrors REQ — `["COUNT", <sub_id>, <filter1>, ...]` — and the response is `["COUNT", <sub_id>, {"count": N}]` (with an optional `approximate: true` field).
Filter parsing intentionally duplicates the REQ-side logic rather than sharing it: REQ also creates a long-lived subscription; COUNT is a one-shot read. The shared bits are small enough that a helper would obscure more than it saves.
func HandleEvent ¶
func HandleEvent(client nostr.ClientInterface, message []interface{})
HandleEvent processes an "EVENT" message
func HandleReq ¶
func HandleReq(client nostr.ClientInterface, message []interface{})
HandleReq processes a new subscription request with proper subscription management
func IsAuthenticated ¶
func IsAuthenticated(client nostr.ClientInterface) bool
IsAuthenticated checks if a connection is authenticated.
func SetAuthenticated ¶
func SetAuthenticated(client nostr.ClientInterface, pubkey string)
SetAuthenticated marks a connection as authenticated and records the authenticated pubkey.
func SetChallengeForConnection ¶
func SetChallengeForConnection(client nostr.ClientInterface, challenge string)
SetChallengeForConnection sets the challenge string for a given connection
func VerifyAuthEvent ¶
func VerifyAuthEvent(client nostr.ClientInterface, evt nostr.Event) error
VerifyAuthEvent verifies the authentication event according to NIP-42
Types ¶
This section is empty.