did

package
v1.14.2 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DIDPrefix is the prefix string
	DIDPrefix = "did:io:"
	// DIDAuthType is the authentication type
	DIDAuthType = "EcdsaSecp256k1VerificationKey2019"
	// DIDOwner is the suffix string
	DIDOwner = "#owner"

	// KnownDIDContext known context for did
	KnownDIDContext = "https://www.w3.org/ns/did/v1"
	// Secp256k1DIDContext secp256k1 context for did
	Secp256k1DIDContext = "https://w3id.org/security/suites/secp256k1-2019/v1"
)

Variables

View Source
var DIDCmd = &cobra.Command{
	Use:   "did",
	Short: config.TranslateInLang(DIDCmdShorts, config.UILanguage),
}

DIDCmd represents the DID command

View Source
var (
	DIDCmdShorts = map[config.Language]string{
		config.English: "DID command",
		config.Chinese: "DID command",
	}
)

Multi-language support

Functions

This section is empty.

Types

type CreateRequest added in v1.11.0

type CreateRequest struct {
	Signature
	PublicKey string `json:"publicKey"`
}

CreateRequest create DID request

type Doc

type Doc struct {
	Context            interface{}             `json:"@context,omitempty"`
	ID                 string                  `json:"id,omitempty"`
	Controller         string                  `json:"controller,omitempty"`
	VerificationMethod []verificationMethod    `json:"verificationMethod,omitempty"`
	Authentication     []verificationMethodSet `json:"authentication,omitempty"`
	AssertionMethod    []verificationMethodSet `json:"assertionMethod,omitempty"`
	Service            []serviceStruct         `json:"service,omitempty"`
}

Doc is the DID document struct

func NewDIDDoc added in v1.11.0

func NewDIDDoc(publicKey []byte) (*Doc, error)

NewDIDDoc new did document by public key

func (*Doc) AddService added in v1.11.0

func (doc *Doc) AddService(tag, serviceType, endpoint string)

AddService add service to did document

func (*Doc) Bytes added in v1.11.0

func (doc *Doc) Bytes() ([]byte, error)

Bytes did document bytes

func (*Doc) Hash added in v1.11.0

func (doc *Doc) Hash() ([32]byte, error)

Hash did document hash

func (*Doc) JSON added in v1.11.0

func (doc *Doc) JSON() (string, error)

JSON did document json

func (*Doc) Owner added in v1.11.0

func (doc *Doc) Owner() common.Address

Owner did document owner

func (*Doc) RemoveService added in v1.11.0

func (doc *Doc) RemoveService(tag string) error

RemoveService remove service from did document

type Permit added in v1.11.0

type Permit struct {
	Separator  string `json:"DOMAIN_SEPARATOR"`
	PermitHash string `json:"permitHash"`
}

Permit permit content for DID

type ServiceAddRequest added in v1.11.0

type ServiceAddRequest struct {
	Signature
	Tag             string `json:"tag"`
	Type            string `json:"type"`
	ServiceEndpoint string `json:"serviceEndpoint"`
}

ServiceAddRequest add service to DID request

type ServiceRemoveRequest added in v1.11.0

type ServiceRemoveRequest struct {
	Signature
	Tag string `json:"tag"`
}

ServiceRemoveRequest remove service from DID request

type Signature added in v1.11.0

type Signature struct {
	R string `json:"r"`
	S string `json:"s"`
	V uint64 `json:"v"`
}

Signature signature for typed message

Jump to

Keyboard shortcuts

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