wns

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: Apache-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const ANPHandleServiceType = "ANPHandleService"

Variables

This section is empty.

Functions

func BuildResolutionURL

func BuildResolutionURL(localPart string, domain string) string

BuildResolutionURL builds the HTTPS resolution URL for a handle.

func BuildWBAURI

func BuildWBAURI(localPart string, domain string) string

BuildWBAURI builds a wba:// URI.

func NormalizeHandle

func NormalizeHandle(handle string) (string, error)

NormalizeHandle validates and normalizes a handle.

func ValidateHandle

func ValidateHandle(handle string) (string, string, error)

ValidateHandle validates a handle and returns its normalized local-part and domain.

func ValidateLocalPart

func ValidateLocalPart(localPart string) bool

ValidateLocalPart validates the handle local-part.

Types

type BindingVerificationOptions

type BindingVerificationOptions struct {
	DidDocument          map[string]any
	ResolutionOptions    ResolveHandleOptions
	DidResolutionOptions authentication.DidResolutionOptions
}

BindingVerificationOptions configures handle binding verification.

type BindingVerificationResult

type BindingVerificationResult struct {
	IsValid         bool   `json:"is_valid"`
	Handle          string `json:"handle"`
	DID             string `json:"did"`
	ForwardVerified bool   `json:"forward_verified"`
	ReverseVerified bool   `json:"reverse_verified"`
	ErrorMessage    string `json:"error_message,omitempty"`
}

BindingVerificationResult reports forward and reverse verification status.

func VerifyHandleBinding

func VerifyHandleBinding(ctx context.Context, handle string) BindingVerificationResult

VerifyHandleBinding verifies forward and reverse handle binding.

func VerifyHandleBindingWithOptions

func VerifyHandleBindingWithOptions(ctx context.Context, handle string, options BindingVerificationOptions) BindingVerificationResult

VerifyHandleBindingWithOptions verifies forward and reverse handle binding with options.

type HandleResolutionDocument

type HandleResolutionDocument struct {
	Handle  string       `json:"handle"`
	DID     string       `json:"did"`
	Status  HandleStatus `json:"status"`
	Updated string       `json:"updated,omitempty"`
}

HandleResolutionDocument is the response body of a WNS handle record.

func ResolveHandle

func ResolveHandle(ctx context.Context, handle string) (HandleResolutionDocument, error)

ResolveHandle resolves a handle over HTTPS.

func ResolveHandleFromURI

func ResolveHandleFromURI(ctx context.Context, uri string) (HandleResolutionDocument, error)

ResolveHandleFromURI resolves a wba:// URI.

func ResolveHandleWithOptions

func ResolveHandleWithOptions(ctx context.Context, handle string, options ResolveHandleOptions) (HandleResolutionDocument, error)

ResolveHandleWithOptions resolves a handle with explicit options.

type HandleServiceEntry

type HandleServiceEntry struct {
	ID              string `json:"id"`
	Type            string `json:"type"`
	ServiceEndpoint string `json:"serviceEndpoint"`
}

HandleServiceEntry is the DID service entry used for reverse handle binding.

func BuildHandleServiceEntry

func BuildHandleServiceEntry(did string, localPart string, domain string) HandleServiceEntry

BuildHandleServiceEntry builds the reverse binding service entry.

func ExtractHandleServiceFromDIDDocument

func ExtractHandleServiceFromDIDDocument(didDocument map[string]any) []HandleServiceEntry

ExtractHandleServiceFromDIDDocument extracts ANPHandleService entries from a DID document.

type HandleStatus

type HandleStatus string

HandleStatus identifies the state of a resolved handle.

const (
	HandleStatusActive    HandleStatus = "active"
	HandleStatusSuspended HandleStatus = "suspended"
	HandleStatusRevoked   HandleStatus = "revoked"
)

type ParsedWBAURI

type ParsedWBAURI struct {
	LocalPart   string `json:"local_part"`
	Domain      string `json:"domain"`
	Handle      string `json:"handle"`
	OriginalURI string `json:"original_uri"`
}

ParsedWBAURI is the parsed form of a wba:// handle URI.

func ParseWBAURI

func ParseWBAURI(uri string) (ParsedWBAURI, error)

ParseWBAURI parses a wba:// URI.

type ResolveHandleOptions

type ResolveHandleOptions struct {
	TimeoutSeconds  float64
	VerifySSL       *bool
	BaseURLOverride string
}

ResolveHandleOptions configures handle resolution.

Jump to

Keyboard shortcuts

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