Documentation
¶
Overview ¶
Package dns is an implementation of the specification of NIP-05, providing DNS based verification for nostr identities.
Index ¶
- Variables
- func IsValidIdentifier(input string) bool
- func NormalizeIdentifier(account string) string
- func ParseIdentifier(account string) (name, domain string, err error)
- func QueryIdentifier(c context.T, account string) (prf *pointers.Profile, err error)
- func StringSliceToByteSlice(ss []string) (bs [][]byte)
- type WellKnownResponse
Constants ¶
This section is empty.
Variables ¶
var Nip05Regex = regexp.MustCompile(`^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$`)
Nip05Regex is an regular expression that matches up with the same pattern as an email address.
Functions ¶
func IsValidIdentifier ¶
IsValidIdentifier verifies that an identifier matches a correct NIP-05 username@domain
func NormalizeIdentifier ¶
NormalizeIdentifier mainly removes the `_@` from the base username so that only the domain remains.
func ParseIdentifier ¶
ParseIdentifier searches a string for a valid NIP-05 username@domain
func QueryIdentifier ¶
QueryIdentifier queries a web server from the domain of a NIP-05 DNS identifier
func StringSliceToByteSlice ¶
StringSliceToByteSlice converts a slice of strings to a slice of slices of bytes.
Types ¶
type WellKnownResponse ¶
type WellKnownResponse struct {
// Names is a list of usernames associated with the DNS identity as in <name>@<domain>
Names map[string]string `json:"names"`
// Relays associates one of the public keys from Names to a list of relay URLs
// that are recommended for that user.
Relays map[string][]string `json:"relays,omitempty"`
NIP46 map[string][]string `json:"nip46,omitempty"` // todo: is this obsolete?
}
WellKnownResponse is the structure of the JSON to be found at <url>/.well-known/nostr.json
func Fetch ¶
Fetch parses a DNS identity to find the URL to query for a NIP-05 identity verification document.
func NewWellKnownResponse ¶
func NewWellKnownResponse() *WellKnownResponse
NewWellKnownResponse creates a new WellKnownResponse and is required as all the fields are maps and need to be allocated.