wns

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 12 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 CompareBindingGenerations added in v0.8.9

func CompareBindingGenerations(current, previous BindingGeneration) int

CompareBindingGenerations compares two validated arbitrary-precision values.

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 BindingGeneration added in v0.8.9

type BindingGeneration string

BindingGeneration is a canonical, arbitrary-precision positive integer.

func ParseBindingGeneration added in v0.8.9

func ParseBindingGeneration(value string) (BindingGeneration, error)

ParseBindingGeneration validates and canonicalizes a binding generation.

func (BindingGeneration) IsNewerThan added in v0.8.9

func (generation BindingGeneration) IsNewerThan(previous BindingGeneration) bool

IsNewerThan reports whether generation is strictly newer than previous.

func (*BindingGeneration) UnmarshalJSON added in v0.8.9

func (generation *BindingGeneration) UnmarshalJSON(data []byte) error

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"`
	BindingGeneration *BindingGeneration `json:"binding_generation,omitempty"`
	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 DIDSubjectProfile added in v0.8.8

type DIDSubjectProfile struct {
	Type            string         `json:"type,omitempty"`
	SubjectDID      string         `json:"subject_did"`
	SubjectType     SubjectType    `json:"subject_type,omitempty"`
	Handle          string         `json:"handle,omitempty"`
	DisplayName     string         `json:"display_name,omitempty"`
	Description     string         `json:"description,omitempty"`
	AvatarURI       string         `json:"avatar_uri,omitempty"`
	ProfileURI      string         `json:"profile_uri,omitempty"`
	Discoverability string         `json:"discoverability,omitempty"`
	Labels          map[string]any `json:"labels,omitempty"`
	Updated         string         `json:"updated,omitempty"`
	VersionID       string         `json:"versionId,omitempty"`
	TTL             *int           `json:"ttl,omitempty"`
	Proof           map[string]any `json:"proof,omitempty"`
}

DIDSubjectProfile is public presentational metadata for a DID subject.

type HandleResolutionDocument

type HandleResolutionDocument struct {
	Handle            string             `json:"handle"`
	DID               string             `json:"did"`
	Status            HandleStatus       `json:"status"`
	BindingGeneration BindingGeneration  `json:"binding_generation"`
	Updated           string             `json:"updated,omitempty"`
	VersionID         string             `json:"versionId,omitempty"`
	TTL               *int               `json:"ttl,omitempty"`
	Profile           *DIDSubjectProfile `json:"profile,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.

type SubjectType added in v0.8.8

type SubjectType string

SubjectType identifies the recommended DID Subject Profile subject type.

const (
	SubjectTypePerson       SubjectType = "person"
	SubjectTypeAgent        SubjectType = "agent"
	SubjectTypeGroup        SubjectType = "group"
	SubjectTypeOrganization SubjectType = "organization"
	SubjectTypeService      SubjectType = "service"
	SubjectTypeApplication  SubjectType = "application"
	SubjectTypeUnknown      SubjectType = "unknown"
)

Jump to

Keyboard shortcuts

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