did

package
v2.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: Apache-2.0 Imports: 23 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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

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

NewDIDDoc new did document by public key

func (*Doc) AddService

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

AddService add service to did document

func (*Doc) Bytes

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

Bytes did document bytes

func (*Doc) Hash

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

Hash did document hash

func (*Doc) JSON

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

JSON did document json

func (*Doc) Owner

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

Owner did document owner

func (*Doc) RemoveService

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

RemoveService remove service from did document

type Permit

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

Permit permit content for DID

type ServiceAddRequest

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

ServiceAddRequest add service to DID request

type ServiceRemoveRequest

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

ServiceRemoveRequest remove service from DID request

type Signature

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