Documentation ¶
Index ¶
- Constants
- Variables
- func ParamKeyTable() params.KeyTable
- func RegisterCodec(cdc *codec.Codec)
- func ValidateGenesis(data GenesisState) error
- type CredentialSubject
- type DidDocument
- type GenesisState
- type MsgCreateDidDocument
- type MsgCreateVerifiableCredential
- func (msg MsgCreateVerifiableCredential) GetSignBytes() []byte
- func (msg MsgCreateVerifiableCredential) GetSigners() []sdk.AccAddress
- func (msg MsgCreateVerifiableCredential) Route() string
- func (msg MsgCreateVerifiableCredential) Type() string
- func (msg MsgCreateVerifiableCredential) ValidateBasic() error
- type ParamSubspace
- type Params
- type Proof
- type PubKey
- type PubKeys
- type Service
- type Services
- type VerifiableCredential
Constants ¶
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" )
const (
AttributeValueCategory = ModuleName
)
did module event types
const (
DefaultParamspace = ModuleName
)
Default parameter namespace
const ( // TODO: Describe query parameters, update <action> with your query // Query<Action> = "<action>" QueryParams = "queryParams" )
Query endpoints supported by the did querier
Variables ¶
var ( DidDocumentKey = []byte{0x61} // prefix for each key to a DidDocument VerifiableCredentialKey = []byte{0x62} // prefix for each key to a DidDocument )
var ModuleCdc *codec.Codec
ModuleCdc defines the module codec
Functions ¶
func RegisterCodec ¶
RegisterCodec registers concrete types on codec
func ValidateGenesis ¶
func ValidateGenesis(data GenesisState) error
ValidateGenesis validates the did genesis parameters
Types ¶
type CredentialSubject ¶
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 ¶
func (msg MsgCreateVerifiableCredential) Route() string
Route should return the name of the module
func (MsgCreateVerifiableCredential) Type ¶
func (msg MsgCreateVerifiableCredential) Type() string
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 (*Params) ParamSetPairs ¶
func (p *Params) ParamSetPairs() params.ParamSetPairs
ParamSetPairs - Implements params.ParamSet
type 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
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
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