types

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeAddDidDoc     = "add_did_doc"
	EventTypeAddCredential = "add_credential"

	AttributeKeyDid          = "did"
	AttributeKeyPubKey       = "pub_key"
	AttributeKeyCredType     = "cred_type"
	AttributeKeyIssuer       = "issuer"
	AttributeKeyIssued       = "issued"
	AttributeKeyClaimID      = "claim"
	AttributeKeyKYCValidated = "kyc_validated"
	AttributeValueCategory   = ModuleName
)
View Source
const (
	ModuleName   = "did"
	StoreKey     = ModuleName
	RouterKey    = ModuleName
	QuerierRoute = ModuleName
)
View Source
const (
	TypeMsgAddDid        = "add-did"
	TypeMsgAddCredential = "add-credential"
)
View Source
const (
	DefaultCodespace = ModuleName
)

Variables

View Source
var (
	ErrInvalidDid         = sdkerrors.Register(DefaultCodespace, 2, "invalid did")
	ErrInvalidPubKey      = sdkerrors.Register(DefaultCodespace, 3, "invalid pubKey")
	ErrDidPubKeyMismatch  = sdkerrors.Register(DefaultCodespace, 4, "did pubKey mismatch")
	ErrInvalidIssuer      = sdkerrors.Register(DefaultCodespace, 5, "invalid issuer")
	ErrInvalidCredentials = sdkerrors.Register(DefaultCodespace, 6, "invalid credentials")
	ErrInvalidClaimId     = sdkerrors.Register(DefaultCodespace, 7, "invalid claim ID")
)
View Source
var (
	ValidDid      = regexp.MustCompile(`^did:(ixo:|sov:)([a-zA-Z0-9]){21,22}([/][a-zA-Z0-9:]+|)$`)
	ValidPubKey   = regexp.MustCompile(`^[123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ]{43,44}$`)
	IsValidDid    = ValidDid.MatchString
	IsValidPubKey = ValidPubKey.MatchString
)
View Source
var DidKey = []byte{0x01}
View Source
var (
	EmptyDid = ""
)
View Source
var ModuleCdc *codec.Codec

ModuleCdc is the codec for the module

View Source
var ValidDidDoc = BaseDidDoc{
	Did:         "FrNMgb6xmPoVfWoFk5zDGn",
	PubKey:      "96UYka2KZEw3nNb58GfP48wPeBUjPrUFrM4AnFhoBzqx",
	Credentials: []exported.DidCredential{},
}

Functions

func GetDidPrefixKey

func GetDidPrefixKey(did exported.Did) []byte

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

func UnmarshalIxoDid

func UnmarshalIxoDid(jsonIxoDid string) (exported.IxoDid, error)

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

noinspection GoUnusedParameter

Types

type BaseDidDoc

type BaseDidDoc struct {
	Did         exported.Did             `json:"did" yaml:"did"`
	PubKey      string                   `json:"pubKey" yaml:"pubKey"`
	Credentials []exported.DidCredential `json:"credentials" yaml:"credentials"`
}

func NewBaseDidDoc

func NewBaseDidDoc(did exported.Did, pubKey string) BaseDidDoc

func (*BaseDidDoc) AddCredential

func (dd *BaseDidDoc) AddCredential(cred exported.DidCredential)

func (BaseDidDoc) Address

func (dd BaseDidDoc) Address() sdk.AccAddress

func (BaseDidDoc) GetCredentials

func (dd BaseDidDoc) GetCredentials() []exported.DidCredential

func (BaseDidDoc) GetDid

func (dd BaseDidDoc) GetDid() exported.Did

func (BaseDidDoc) GetPubKey

func (dd BaseDidDoc) GetPubKey() string

func (BaseDidDoc) SetDid

func (dd BaseDidDoc) SetDid(did exported.Did) error

func (BaseDidDoc) SetPubKey

func (dd BaseDidDoc) SetPubKey(pubKey string) error

type Credential

type Credential struct{}

type GenesisState

type GenesisState struct {
	DidDocs []exported.DidDoc `json:"did_docs" yaml:"did_docs"`
}

func DefaultGenesisState

func DefaultGenesisState() GenesisState

func NewGenesisState

func NewGenesisState(didDocs []exported.DidDoc) GenesisState

type MsgAddCredential

type MsgAddCredential struct {
	DidCredential exported.DidCredential `json:"credential" yaml:"credential"`
}

func NewMsgAddCredential

func NewMsgAddCredential(did string, credType []string, issuer string, issued string) MsgAddCredential

func (MsgAddCredential) GetSignBytes

func (msg MsgAddCredential) GetSignBytes() []byte

func (MsgAddCredential) GetSignerDid

func (msg MsgAddCredential) GetSignerDid() exported.Did

func (MsgAddCredential) GetSigners

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

func (MsgAddCredential) Route

func (msg MsgAddCredential) Route() string

func (MsgAddCredential) String

func (msg MsgAddCredential) String() string

func (MsgAddCredential) Type

func (msg MsgAddCredential) Type() string

func (MsgAddCredential) ValidateBasic

func (msg MsgAddCredential) ValidateBasic() error

type MsgAddDid

type MsgAddDid struct {
	Did    exported.Did `json:"did" yaml:"did"`
	PubKey string       `json:"pubKey" yaml:"pubKey"`
}

func NewMsgAddDid

func NewMsgAddDid(did string, publicKey string) MsgAddDid

func (MsgAddDid) GetSignBytes

func (msg MsgAddDid) GetSignBytes() []byte

func (MsgAddDid) GetSignerDid

func (msg MsgAddDid) GetSignerDid() exported.Did

func (MsgAddDid) GetSigners

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

func (MsgAddDid) Route

func (msg MsgAddDid) Route() string

func (MsgAddDid) String

func (msg MsgAddDid) String() string

func (MsgAddDid) Type

func (msg MsgAddDid) Type() string

func (MsgAddDid) ValidateBasic

func (msg MsgAddDid) ValidateBasic() error

Jump to

Keyboard shortcuts

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