auth

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2024 License: CC0-1.0, MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Required = "auth-required"

Variables

View Source
var ChallengeTag = B("challenge")
View Source
var RelayTag = B("relay")

Functions

func CreateUnsigned

func CreateUnsigned(pubkey, challenge B, relayURL string) (ev *event.T)

CreateUnsigned creates an event which should be sent via an "AUTH" command. If the authentication succeeds, the user will be authenticated as pubkey.

func Validate

func Validate(evt *event.T, challenge B,
	relayURL string) (ok bool, err error)

Validate checks whether event is a valid NIP-42 event for given challenge and relayURL. The result of the validation is encoded in the ok bool.

Types

type B

type B = []byte

func GenerateChallenge

func GenerateChallenge() (b B)

GenerateChallenge creates a reasonable, 96 byte base64 challenge string

type S

type S = string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL