services

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNetworkIsNotSupported = errors.New("network is not supported")
	ErrResolverAlreadyExists = errors.New("resolver already exists")

	ErrNotFound = errors.New("not found")
)

Functions

This section is empty.

Types

type DidDocumentServices

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

func NewDidDocumentServices

func NewDidDocumentServices(resolvers *ResolverRegistry, registry *ens.Registry) *DidDocumentServices

func (*DidDocumentServices) GetDidDocument

func (d *DidDocumentServices) GetDidDocument(ctx context.Context, did string, opts *ResolverOpts) (*document.DidResolution, error)

GetDidDocument return did document by identifier.

func (*DidDocumentServices) GetGist

func (d *DidDocumentServices) GetGist(ctx context.Context, chain, network string, opts *ResolverOpts) (*document.GistInfo, error)

func (*DidDocumentServices) ResolveDNSDomain

func (d *DidDocumentServices) ResolveDNSDomain(ctx context.Context, domain string) (*document.DidResolution, error)

ResolveDNSDomain return did document by domain via DNS.

func (*DidDocumentServices) ResolveENSDomain

func (d *DidDocumentServices) ResolveENSDomain(ctx context.Context, domain string) (*document.DidResolution, error)

ResolveENSDomain return did document via ENS resolver.

type GistInfo

type GistInfo struct {
	Root                *big.Int
	ReplacedByRoot      *big.Int
	CreatedAtTimestamp  *big.Int
	ReplacedAtTimestamp *big.Int
	CreatedAtBlock      *big.Int
	ReplacedAtBlock     *big.Int
}

func (*GistInfo) ToDidRepresentation

func (gi *GistInfo) ToDidRepresentation() (*document.GistInfo, error)

type IdentityState

type IdentityState struct {
	StateInfo *StateInfo
	GistInfo  *GistInfo
}

type Resolver

type Resolver interface {
	Resolve(ctx context.Context, did w3c.DID, opts *ResolverOpts) (IdentityState, error)
	ResolveGist(ctx context.Context, opts *ResolverOpts) (*GistInfo, error)
	BlockchainID() string
}

type ResolverOpts

type ResolverOpts struct {
	State    *big.Int
	GistRoot *big.Int
}

type ResolverRegistry

type ResolverRegistry map[string]Resolver

func NewChainResolvers

func NewChainResolvers() *ResolverRegistry

func (*ResolverRegistry) Add

func (ch *ResolverRegistry) Add(prefix string, resolver Resolver)

func (*ResolverRegistry) Append

func (ch *ResolverRegistry) Append(prefix string, resolver Resolver) error

func (*ResolverRegistry) GetResolverByNetwork

func (ch *ResolverRegistry) GetResolverByNetwork(chain, networkID string) (Resolver, error)

type StateInfo

type StateInfo struct {
	ID                  w3c.DID
	State               *big.Int
	ReplacedByState     *big.Int
	CreatedAtTimestamp  *big.Int
	ReplacedAtTimestamp *big.Int
	CreatedAtBlock      *big.Int
	ReplacedAtBlock     *big.Int
}

func (*StateInfo) ToDidRepresentation

func (si *StateInfo) ToDidRepresentation() (*document.StateInfo, error)

Directories

Path Synopsis
blockchain
eth
eth/contract/mock
Package mock_eth is a generated GoMock package.
Package mock_eth is a generated GoMock package.
ens

Jump to

Keyboard shortcuts

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