did

package
v0.0.0-...-d3ca5b1 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// InitialKey the key reference assigned to the first key in a DidDoc
	InitialKey      = "key-1"
	IssuerDIDMethod = "did:work:"
)

Variables

This section is empty.

Functions

func GenerateDID

func GenerateDID(publicKey *ed25519.PublicKey) string

GenerateDID generate a DID

func ValidateDIDDocProof

func ValidateDIDDocProof(didDoc DIDDoc, pubKey ed25519.PublicKey) error

Types

type DIDDoc

type DIDDoc struct {
	*UnsignedDIDDoc
	*proof.Proof `json:"proof"`
}

DIDDoc a W3C compliant signed DID Document

func SignDIDDoc

func SignDIDDoc(unsignedDoc UnsignedDIDDoc, privKey ed25519.PrivateKey, keyRef string) (*DIDDoc, error)

func (*DIDDoc) GetProof

func (d *DIDDoc) GetProof() *proof.Proof

func (*DIDDoc) SetProof

func (d *DIDDoc) SetProof(p proof.Proof)

type KeyDef

type KeyDef struct {
	ID              string `json:"id"`
	Type            string `json:"type"`
	Controller      string `json:"controller,omitempty"`
	PublicKeyBase58 string `json:"publicKeyBase58"`
}

KeyDef represents a DID public key

type ServiceDef

type ServiceDef struct {
	ID              string `json:"id"`
	Type            string `json:"type"`
	ServiceEndpoint string `json:"serviceEndpoint"`
}

type UnsignedDIDDoc

type UnsignedDIDDoc struct {
	ID             string       `json:"id"`
	PublicKey      []KeyDef     `json:"publicKey"`
	Authentication []string     `json:"authentication"`
	Service        []ServiceDef `json:"service"`
}

Jump to

Keyboard shortcuts

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