types

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ModuleName is the name of the module
	ModuleName = "did"

	// StoreKey to be used when creating the KVStore
	StoreKey = ModuleName

	// RouterKey to be used for routing msgs
	RouterKey = ModuleName

	// QuerierRoute to be used for querier msgs
	QuerierRoute = ModuleName

	// did identifer prefix
	DidIdentifer = "did:cosmos:"

	// w3c spec context definition
	Context   = "https://www.w3.org/ns/did/v1"
	VcContext = "https://www.w3.org/2018/credentials/v1"
)
View Source
const (
	AttributeValueCategory = ModuleName
)

did module event types

View Source
const (
	DefaultParamspace = ModuleName
)

Default parameter namespace

View Source
const (
	// TODO: Describe query parameters, update <action> with your query
	// Query<Action>    = "<action>"
	QueryParams = "queryParams"
)

Query endpoints supported by the did querier

Variables

View Source
var (
	DidDocumentKey          = []byte{0x61} // prefix for each key to a DidDocument
	VerifiableCredentialKey = []byte{0x62} // prefix for each key to a DidDocument
)
View Source
var ModuleCdc *codec.Codec

ModuleCdc defines the module codec

Functions

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamKeyTable for did module

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on codec

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

ValidateGenesis validates the did genesis parameters

Types

type CredentialSubject

type CredentialSubject struct {
	Role       string `json:"role"`
	IsVerified bool   `json:"isverified"`
}

func NewCredentialSubject

func NewCredentialSubject(role string, isVerified bool) CredentialSubject

type DidDocument

type DidDocument struct {
	Context        string   `json:"@context"`
	ID             string   `json:"id"`
	Authentication PubKeys  `json:"authentication"`
	Service        Services `json:"service,omitempty"`
}

DidDocument is the data model defined by w3c

func NewDidDocument

func NewDidDocument(context string, id string, authentication PubKeys, services Services) DidDocument

type GenesisState

type GenesisState struct {
}

GenesisState - all did state that must be provided at genesis

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState - default GenesisState used by Cosmos Hub

func NewGenesisState

func NewGenesisState() GenesisState

NewGenesisState creates a new GenesisState object

type MsgCreateDidDocument

type MsgCreateDidDocument struct {
	Context        string         `json:"context"`
	ID             string         `json:"id"`
	Authentication PubKeys        `json:"authentication"`
	Services       Services       `json:"service,omitempty"`
	Owner          sdk.AccAddress `json:"owner"`
}

Vote messages

func NewMsgCreateDidDocument

func NewMsgCreateDidDocument(context string, id string, authentication PubKeys, services Services, owner sdk.AccAddress) MsgCreateDidDocument

func (MsgCreateDidDocument) GetSignBytes

func (msg MsgCreateDidDocument) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgCreateDidDocument) GetSigners

func (msg MsgCreateDidDocument) GetSigners() []sdk.AccAddress

GetSigners defines whose signature is required

func (MsgCreateDidDocument) Route

func (msg MsgCreateDidDocument) Route() string

Route should return the name of the module

func (MsgCreateDidDocument) Type

func (msg MsgCreateDidDocument) Type() string

Type should return the action

func (MsgCreateDidDocument) ValidateBasic

func (msg MsgCreateDidDocument) ValidateBasic() error

ValidateBasic runs stateless checks on the message

type MsgCreateVerifiableCredential

type MsgCreateVerifiableCredential struct {
	DidUrl            string            `json:"didurl"`
	Context           string            `json:"@context"`
	ID                string            `json:"id"`
	VcType            string            `json:"type"`
	Issuer            string            `json:"issuer"`
	CredentialSubject CredentialSubject `json:"credentialsubject"`
	Proof             Proof             `json:"proof"`
	Owner             sdk.AccAddress    `json:"owner"`
}

Verifiable Credential message

func NewMsgCreateVerifiableCredential

func NewMsgCreateVerifiableCredential(didurl string, context string, id string, vctype string, issuer string, proof Proof, owner sdk.AccAddress) MsgCreateVerifiableCredential

func (MsgCreateVerifiableCredential) GetSignBytes

func (msg MsgCreateVerifiableCredential) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgCreateVerifiableCredential) GetSigners

func (msg MsgCreateVerifiableCredential) GetSigners() []sdk.AccAddress

GetSigners defines whose signature is required

func (MsgCreateVerifiableCredential) Route

Route should return the name of the module

func (MsgCreateVerifiableCredential) Type

Type should return the action

func (MsgCreateVerifiableCredential) ValidateBasic

func (msg MsgCreateVerifiableCredential) ValidateBasic() error

ValidateBasic runs stateless checks on the message

type ParamSubspace

type ParamSubspace interface {
	WithKeyTable(table params.KeyTable) params.Subspace
	Get(ctx sdk.Context, key []byte, ptr interface{})
	GetParamSet(ctx sdk.Context, ps params.ParamSet)
	SetParamSet(ctx sdk.Context, ps params.ParamSet)
}

ParamSubspace defines the expected Subspace interfcace

type Params

type Params struct {
}

Params - used for initializing default parameter for did at genesis

func DefaultParams

func DefaultParams() Params

DefaultParams defines the parameters for this module

func NewParams

func NewParams() Params

NewParams creates a new Params object

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() params.ParamSetPairs

ParamSetPairs - Implements params.ParamSet

func (Params) String

func (p Params) String() string

String implements the stringer interface for Params

type Proof

type Proof struct {
	Type                      string `json:"type"`
	IssuerData                string `json:"issuerdata"`
	Attributes                string `json:"attributes"`
	Signature                 string `json:"signature"`
	SignatureCorrectnessProof string `json:"signatureproof"`
}

func NewProof

func NewProof(ptype string, issuerData string, attributes string, signature string, signatureProof string) Proof

type PubKey

type PubKey struct {
	ID              string         `json:"id"`
	Type            string         `json:"type"`
	Controller      sdk.AccAddress `json:"controller"`
	PublicKeyBase58 string         `json:"publicKeyBase58"`
}

PubKey contains the information of a public key contained inside a Did Document

func NewPubKey

func NewPubKey(id string, pubKeyType string, controller sdk.AccAddress, base58Value string) PubKey

type PubKeys

type PubKeys []PubKey

type Service

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

Service represents a service type needed for DidDocument

func NewService

func NewService(id string, serviceType string, serviceEndpoint string) Service

type Services

type Services []Service

type VerifiableCredential

type VerifiableCredential struct {
	Context           string            `json:"@context"`
	ID                string            `json:"id"`
	Type              string            `json:"type"`
	Issuer            string            `json:"issuer"`
	CredentialSubject CredentialSubject `json:"credentialsubject"`
	Proof             Proof             `json:"proof"`
}

func NewVerifiableCredential

func NewVerifiableCredential(context string, id string, vctype string, issuer string, credentialSubject CredentialSubject, proof Proof) VerifiableCredential

Jump to

Keyboard shortcuts

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