identity

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DidToDocUrl

func DidToDocUrl(did string) (string, error)

func ResolveHandle

func ResolveHandle(ctx context.Context, cli *http.Client, handle string) (string, error)

func ResolveHandleFromTXT

func ResolveHandleFromTXT(ctx context.Context, handle string) (string, error)

func ResolveHandleFromWellKnown

func ResolveHandleFromWellKnown(ctx context.Context, cli *http.Client, handle string) (string, error)

func ResolveService

func ResolveService(ctx context.Context, cli *http.Client, did string) (string, error)

Types

type BackingCache

type BackingCache interface {
	GetDoc(did string) (*DidDoc, bool)
	PutDoc(did string, doc *DidDoc) error
	BustDoc(did string) error

	GetDid(handle string) (string, bool)
	PutDid(handle string, did string) error
	BustDid(handle string) error
}

type DidAuditEntry

type DidAuditEntry struct {
	Did       string      `json:"did"`
	Operation DidLogEntry `json:"operation"`
	Cid       string      `json:"cid"`
	Nullified bool        `json:"nullified"`
	CreatedAt string      `json:"createdAt"`
}

type DidAuditLog

type DidAuditLog []DidAuditEntry

func FetchDidAuditLog

func FetchDidAuditLog(ctx context.Context, cli *http.Client, did string) (DidAuditLog, error)

type DidData

type DidData struct {
	Did                 string                      `json:"did"`
	VerificationMethods map[string]string           `json:"verificationMethods"`
	RotationKeys        []string                    `json:"rotationKeys"`
	AlsoKnownAs         []string                    `json:"alsoKnownAs"`
	Services            map[string]OperationService `json:"services"`
}

func FetchDidData

func FetchDidData(ctx context.Context, cli *http.Client, did string) (*DidData, error)

type DidDoc

type DidDoc struct {
	Context             []string                   `json:"@context"`
	Id                  string                     `json:"id"`
	AlsoKnownAs         []string                   `json:"alsoKnownAs"`
	VerificationMethods []DidDocVerificationMethod `json:"verificationMethod"`
	Service             []DidDocService            `json:"service"`
}

func FetchDidDoc

func FetchDidDoc(ctx context.Context, cli *http.Client, did string) (*DidDoc, error)

type DidDocService

type DidDocService struct {
	Id              string `json:"id"`
	Type            string `json:"type"`
	ServiceEndpoint string `json:"serviceEndpoint"`
}

type DidDocVerificationMethod

type DidDocVerificationMethod struct {
	Id                 string `json:"id"`
	Type               string `json:"type"`
	Controller         string `json:"controller"`
	PublicKeyMultibase string `json:"publicKeyMultibase"`
}

type DidLog

type DidLog []DidLogEntry

type DidLogEntry

type DidLogEntry struct {
	Sig                 string                      `json:"sig"`
	Prev                *string                     `json:"prev"`
	Type                string                      `json:"string"`
	Services            map[string]OperationService `json:"services"`
	AlsoKnownAs         []string                    `json:"alsoKnownAs"`
	RotationKeys        []string                    `json:"rotationKeys"`
	VerificationMethods map[string]string           `json:"verificationMethods"`
}

type MemCache

type MemCache struct {
	// contains filtered or unexported fields
}

func NewMemCache

func NewMemCache(size int) *MemCache

func (*MemCache) BustDid

func (mc *MemCache) BustDid(handle string) error

func (*MemCache) BustDoc

func (mc *MemCache) BustDoc(did string) error

func (*MemCache) GetDid

func (mc *MemCache) GetDid(handle string) (string, bool)

func (*MemCache) GetDoc

func (mc *MemCache) GetDoc(did string) (*DidDoc, bool)

func (*MemCache) PutDid

func (mc *MemCache) PutDid(handle string, did string) error

func (*MemCache) PutDoc

func (mc *MemCache) PutDoc(did string, doc *DidDoc) error

type OperationService

type OperationService struct {
	Type     string `json:"type"`
	Endpoint string `json:"endpoint"`
}

type Passport

type Passport struct {
	// contains filtered or unexported fields
}

func NewPassport

func NewPassport(h *http.Client, bc BackingCache) *Passport

func (*Passport) BustDid

func (p *Passport) BustDid(ctx context.Context, handle string) error

func (*Passport) BustDoc

func (p *Passport) BustDoc(ctx context.Context, did string) error

func (*Passport) FetchDoc

func (p *Passport) FetchDoc(ctx context.Context, did string) (*DidDoc, error)

func (*Passport) ResolveHandle

func (p *Passport) ResolveHandle(ctx context.Context, handle string) (string, error)

Jump to

Keyboard shortcuts

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