id

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StoreNamespace store name space for DID Store.
	StoreNamespace = "peer"
	// DefaultServiceType default service type.
	DefaultServiceType = "defaultServiceType"
	// DefaultServiceEndpoint default service endpoint.
	DefaultServiceEndpoint = "defaultServiceEndpoint"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Db                    state.DBManager
	Ion                   Ion
	KeyManager            key.KeyManager
	UniversalResolverUrls []string
}

type DIDUpdateInfo

type DIDUpdateInfo struct {
	DID            string   `json:"did"`
	LongFormDID    string   `json:"longFormDID"`
	Document       *did.Doc `json:"document"`
	DIDDerivation  uint32   `json:"didDerivation"`
	KeyDerivations []uint32 `json:"keyDerivations"`
}

type DidDocumentMetadata

type DidDocumentMetadata struct {
	Method struct {
		Published          bool   `json:"published"`
		RecoveryCommitment string `json:"recoveryCommitment"`
		UpdateCommitment   string `json:"updateCommitment"`
	} `json:"method"`
	CanonicalID string `json:"canonicalId"`
}

type DidResolutionMetadata

type DidResolutionMetadata struct {
	Pattern   string `json:"pattern"`
	DriverURL string `json:"driverUrl"`
	Duration  int    `json:"duration"`
	Did       struct {
		DidString        string `json:"didString"`
		MethodSpecificID string `json:"methodSpecificId"`
		Method           string `json:"method"`
	} `json:"did"`
	ContentType   string `json:"contentType"`
	ConvertedFrom string `json:"convertedFrom"`
	ConvertedTo   string `json:"convertedTo"`
}

type Identity

type Identity interface {
	ResolveDID(did string) (*did.Doc, string, error)
	UpdateDID(documentPatch string) (*DIDUpdateInfo, error)
	CreateDID(didType string, serviceEndpoints []Service) (*DIDUpdateInfo, error)
	DeleteDID(did string) error
	BackupDID(did string) (*DIDUpdateInfo, error)
	RecoverDID(*DIDUpdateInfo) error
	ImportDID(document, longFormDID string) error
	ListDIDs() ([]*did.Doc, error)
	GetLastUserDID() (*did.Doc, string, error)
	GetUserDIDs() ([]did.Doc, error)

	SignWithDID(did string, msg []byte) (string, error)
	VerifyFromDID(didStr string, msg string) ([]byte, error)
}

func New

func New(cfg Config) (Identity, error)

type Ion

type Ion interface {
	ResolveDid(id string) (*did.Doc, error)
	CreateDid(serviceEndpoints []ion.Service) (*did.Doc, uint32, []uint32, error)
	UpdateDid(newDidUpdates *did.Doc) (*did.Doc, uint32, []uint32, error)
}

func NewIon

func NewIon(cfg *IonConfig) (Ion, error)

type IonConfig

type IonConfig struct {
	IonUrl     string
	Db         state.DBManager
	KeyManager key.KeyManager
}

type PatchJson

type PatchJson struct {
	IetfJsonPatch []jsonpatch_create.JsonPatchOperation `json:"ietf-json-patch"`
}

type RelaxedDoc

type RelaxedDoc struct {
	Context     string `json:"@context"`
	DidDocument struct {
		Context            []string    `json:"@context"`
		ID                 string      `json:"id"`
		VerificationMethod interface{} `json:"verificationMethod"`
		Service            interface{} `json:"service"`
		Authentication     interface{} `json:"authentication"`
		KeyAgreement       interface{} `json:"keyAgreement"`
		AssertionMethod    interface{} `json:"assertionMethod"`
	} `json:"didDocument"`
	DidResolutionMetadata interface{} `json:"didResolutionMetadata"`
	DidDocumentMetadata   interface{} `json:"didDocumentMetadata"`
}

type ResolveDIDResponse

type ResolveDIDResponse struct {
	ResolutionMetadata *DidResolutionMetadata `json:"didResolutionMetadata"`
	Document           *did.Doc               `json:"didDocument"`
	DocumentMetadata   *DidDocumentMetadata   `json:"didDocumentMetadata"`
}

type Service

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

type VDR

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

VDR is a overridden implementation of the Peer DID Storage API used to implement things not yet implemented by the library (ie, updates).

func (*VDR) Accept

func (v *VDR) Accept(method string) bool

func (*VDR) Close

func (v *VDR) Close() error

func (*VDR) Create

func (v *VDR) Create(didDoc *did.Doc, opts ...vdrapi.DIDMethodOption) (*did.DocResolution, error)

func (*VDR) Deactivate

func (v *VDR) Deactivate(did string, opts ...vdrapi.DIDMethodOption) error

func (*VDR) Read

func (v *VDR) Read(didStr string, opts ...vdrapi.DIDMethodOption) (*did.DocResolution, error)

func (*VDR) Update

func (v *VDR) Update(doc *did.Doc, opts ...vdrapi.DIDMethodOption) error

type VerificationMethod

type VerificationMethod struct {
	ID           string `json:"id"`
	Controller   string `json:"controller"`
	Type         string `json:"type"`
	PublicKeyJwk struct {
		Kty string `json:"kty"`
		Crv string `json:"crv"`
		X   string `json:"x"`
		Y   string `json:"y"`
	} `json:"publicKeyJwk"`
}

Directories

Path Synopsis
ion
mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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