Documentation
¶
Index ¶
- Constants
- func BuildResolutionURL(localPart string, domain string) string
- func BuildWBAURI(localPart string, domain string) string
- func CompareBindingGenerations(current, previous BindingGeneration) int
- func NormalizeHandle(handle string) (string, error)
- func ValidateHandle(handle string) (string, string, error)
- func ValidateLocalPart(localPart string) bool
- type BindingGeneration
- type BindingVerificationOptions
- type BindingVerificationResult
- type DIDSubjectProfile
- 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
- type SubjectType
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 CompareBindingGenerations ¶ added in v0.8.9
func CompareBindingGenerations(current, previous BindingGeneration) int
CompareBindingGenerations compares two validated arbitrary-precision values.
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 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 ¶
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" )