Documentation ¶
Index ¶
- func Create(opts ...CreateOption) (did.BearerDID, error)
- func CreateWithContext(ctx context.Context, opts ...CreateOption) (did.BearerDID, error)
- type CreateOption
- func AlsoKnownAs(aka ...string) CreateOption
- func Controllers(controllers ...string) CreateOption
- func Gateway(gatewayURL string, client *http.Client) CreateOption
- func KeyManager(km crypto.KeyManager) CreateOption
- func PrivateKey(algorithmID string, purposes ...didcore.Purpose) CreateOption
- func Service(id string, svcType string, endpoint ...string) CreateOption
- type Resolver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
func Create(opts ...CreateOption) (did.BearerDID, error)
Create creates a new `did:dht` DID and publishes it to the DHT network via a Pkarr gateway.
If no gateway is passed in the options, Create uses a default Pkarr gateway.
func CreateWithContext ¶
CreateWithContext creates a new `did:dht` DID and publishes it to the DHT network via a Pkarr gateway.
Types ¶
type CreateOption ¶
type CreateOption func(*createOptions)
CreateOption is the type returned from each individual option function
func AlsoKnownAs ¶
func AlsoKnownAs(aka ...string) CreateOption
AlsoKnownAs is used to set the 'alsoKnownAs' property of the DID Document. more details here: https://www.w3.org/TR/did-core/#also-known-as
func Controllers ¶
func Controllers(controllers ...string) CreateOption
Controllers is used to set the 'controller' property of the DID Document. more details here: https://www.w3.org/TR/did-core/#controller
func Gateway ¶
func Gateway(gatewayURL string, client *http.Client) CreateOption
Gateway sets the gateway to use for publishing the DID to the DHT.
func KeyManager ¶
func KeyManager(km crypto.KeyManager) CreateOption
KeyManager is used to set the key manager that will be used to generate the private keys for the DID.
func PrivateKey ¶
func PrivateKey(algorithmID string, purposes ...didcore.Purpose) CreateOption
PrivateKey is used to add a private key to the DID being created with the Create function. Each PrivateKey provided will be used to generate a private key in the key manager and then added to the DID Document as a VerificationMethod.
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver is a client for resolving DIDs using the DHT network.
func DefaultResolver ¶
func DefaultResolver() *Resolver
DefaultResolver uses the default Pkarr gateway client
func NewResolver ¶
NewResolver creates a new Resolver instance with the given relay and HTTP client. TODO make this relay an option and use default relay if not provided
func (*Resolver) Resolve ¶
func (r *Resolver) Resolve(uri string) (didcore.ResolutionResult, error)
Resolve resolves a DID using the DHT method
func (*Resolver) ResolveWithContext ¶
func (r *Resolver) ResolveWithContext(ctx context.Context, uri string) (didcore.ResolutionResult, error)
ResolveWithContext resolves a DID using the DHT method. This is the context aware version of Resolve.