web

package
v0.0.0-...-f93f300 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const (
	WellKnownURLPath = ".well-known/"
	DIDDocFilename   = "did.json"
	Prefix           = "did:web"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DIDWeb

type DIDWeb string

did:web method specification https://w3c-ccg.github.io/did-method-web/ DID Web create and resolve methods are implemented in this package but NOT the update and deactivate methods please refer to web_test.go for example and test cases

func (DIDWeb) CreateDoc

func (d DIDWeb) CreateDoc(kt crypto.KeyType, publicKey []byte) (*did.Document, error)

CreateDoc constructs a did:web Document from a specific key type and its corresponding public key. This method does not attempt to validate that the provided public key is of the specified key type. The returned Document is expected further turned into a JSON file named did.json and stored under the expected path of the target web domain specification: https://w3c-ccg.github.io/did-method-web/#create-register

func (DIDWeb) CreateDocBytes

func (d DIDWeb) CreateDocBytes(kt crypto.KeyType, publicKey []byte) ([]byte, error)

CreateDocBytes simply takes the output from CreateDoc and returns the bytes of the JSON DID document

func (DIDWeb) GetDocURL

func (d DIDWeb) GetDocURL() (string, error)

GetDocURL returns the expected URL of the DID Document where https:// prefix is required by the specification optional path supported

func (DIDWeb) Method

func (DIDWeb) Method() did.Method

func (DIDWeb) Resolve

func (d DIDWeb) Resolve(ctx context.Context) (*did.Document, error)

func (DIDWeb) String

func (d DIDWeb) String() string

func (DIDWeb) Suffix

func (d DIDWeb) Suffix() (string, error)

func (DIDWeb) Validate

func (d DIDWeb) Validate(ctx context.Context) error

Validate return nil if DID is valid, otherwise the validation error.

type Resolver

type Resolver struct{}

func (Resolver) Methods

func (Resolver) Methods() []did.Method

func (Resolver) Resolve

func (Resolver) Resolve(ctx context.Context, id string, _ ...resolution.Option) (*resolution.Result, error)

Resolve fetches and returns the Document from the expected URL specification: https://w3c-ccg.github.io/did-method-web/#read-resolve

Jump to

Keyboard shortcuts

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