Documentation
¶
Index ¶
- Constants
- func BuildResolutionURL(localPart string, domain string) string
- func BuildWBAURI(localPart string, domain string) string
- func NormalizeHandle(handle string) (string, error)
- func ValidateHandle(handle string) (string, string, error)
- func ValidateLocalPart(localPart string) bool
- type BindingVerificationOptions
- type BindingVerificationResult
- type HandleResolutionDocument
- func ResolveHandle(ctx context.Context, handle string) (HandleResolutionDocument, error)
- func ResolveHandleFromURI(ctx context.Context, uri string) (HandleResolutionDocument, error)
- func ResolveHandleWithOptions(ctx context.Context, handle string, options ResolveHandleOptions) (HandleResolutionDocument, error)
- type HandleServiceEntry
- type HandleStatus
- type ParsedWBAURI
- type ResolveHandleOptions
Constants ¶
const ANPHandleServiceType = "ANPHandleService"
Variables ¶
This section is empty.
Functions ¶
func BuildResolutionURL ¶
BuildResolutionURL builds the HTTPS resolution URL for a handle.
func BuildWBAURI ¶
BuildWBAURI builds a wba:// URI.
func NormalizeHandle ¶
NormalizeHandle validates and normalizes a handle.
func ValidateHandle ¶
ValidateHandle validates a handle and returns its normalized local-part and domain.
func ValidateLocalPart ¶
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 ¶
ResolveHandleOptions configures handle resolution.