creator

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Overview

Package creator contains a DID document creator that can be used to create DIDs using various supported DID methods.

Index

Constants

View Source
const (
	// DIDMethodKey is the name recognized by the Create method for the did:key method.
	DIDMethodKey = "key"
	// DIDMethodIon is the name recognized by the Create method for the did:ion method.
	DIDMethodIon = "ion"
	// Ed25519VerificationKey2018 is a supported DID verification type.
	Ed25519VerificationKey2018 = "Ed25519VerificationKey2018"
	// JSONWebKey2020 is a supported DID verification type.
	JSONWebKey2020 = "JsonWebKey2020"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Creator

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

Creator is used for creating DID Documents using supported DID methods.

func NewCreator

func NewCreator(keyWriter api.KeyWriter, keyReader api.KeyReader) (*Creator, error)

NewCreator returns a new DID document Creator. KeyReader is optional.

func NewCreatorWithKeyReader

func NewCreatorWithKeyReader(keyReader api.KeyReader) (*Creator, error)

NewCreatorWithKeyReader returns a new DID document Creator. A Creator created with this function can be used to create DID documents using your own already-generated keys from the given KeyReader. At least one of keyHandleCreator and keyReader must be provided. See the Create method for more information.

func NewCreatorWithKeyWriter

func NewCreatorWithKeyWriter(keyWriter api.KeyWriter) (*Creator, error)

NewCreatorWithKeyWriter returns a new DID document Creator. A Creator created with this function will automatically generate keys for you when creating new DID documents. Those keys will be generated and stored using the given KeyWriter. See the Create method for more information.

func (*Creator) Create

func (d *Creator) Create(method string, createDIDOpts *api.CreateDIDOpts) (*did.DocResolution, error)

Create creates a DID document using the given DID method. The usage of createDIDOpts depends on the DID method you're using.

For creating did:key documents, there are two relevant options that can be set in the createDIDOpts object: KeyID and VerificationType.

If the Creator was created using the NewCreatorWithKeyWriter function, then both of those options are ignored.
ED25519 key will be generated and saved automatically, and the verification type will automatically be set to
Ed25519VerificationKey2018. TODO (#51): Support more key types. ED25519 is the chosen default for now.
If the Creator was created using the NewCreatorWithKeyReader function, then you must specify the KeyID and also
the VerificationType in the createDIDOpts object to use for the creation of the DID document.

Directories

Path Synopsis
Package ion contains a did:ion longform creator implementation.
Package ion contains a did:ion longform creator implementation.
Package key contains a did:key creator implementation.
Package key contains a did:key creator implementation.

Jump to

Keyboard shortcuts

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