Documentation
¶
Overview ¶
Package creator contains a DID document creator that can be used to create DIDs using various supported DID methods.
Index ¶
Constants ¶
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 ¶
NewCreator returns a new DID document Creator. KeyReader is optional.
func NewCreatorWithKeyReader ¶
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 ¶
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.