types

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModuleName   = "id"
	StoreKey     = ModuleName
	QuerierRoute = ModuleName

	IdentitiesStorePrefix = StoreKey + ":identities:"

	KeyTypeRsa       = "RsaVerificationKey2018"
	KeyTypeSecp256k1 = "Secp256k1VerificationKey2018"
	KeyTypeEd25519   = "Ed25519VerificationKey2018"

	DidDepositRequestStorePrefix               = StoreKey + "depositRequest"
	DidPowerUpRequestStorePrefix               = StoreKey + "powerUpRequest"
	HandledPowerUpRequestsReferenceStorePrefix = StoreKey + "handledPowerUpRequestsReference"

	StatusApproved = "approved"
	StatusRejected = "rejected"
	StatusCanceled = "canceled"

	QueryResolveDid = "identities"

	QueryResolveDepositRequest = "depositRequest"
	QueryResolvePowerUpRequest = "powerUpRequest"

	MsgTypeSetIdentity = "setIdentity"

	MsgTypeRequestDidDeposit           = "requestDidDeposit"
	MsgTypeInvalidateDidDepositRequest = "invalidateDidDepositRequest"
	MsgTypeRequestDidPowerUp           = "requestDidPowerUp"
	MsgTypeInvalidateDidPowerUpRequest = "invalidateDidPowerUpRequest"

	MsgTypeMoveDeposit = "moveDeposit"
	MsgTypePowerUpDid  = "powerUpDid"
)

Variables

View Source
var ModuleCdc *codec.Codec

Functions

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on wire codec

func ValidateHex added in v1.3.0

func ValidateHex(value string) bool

ValidateHex returns true if the given value is a valid hexadecimal-encoded string, false otherwise

Types

type DidDepositRequest added in v1.3.0

type DidDepositRequest struct {
	Status        *RequestStatus `json:"status"`         // Type of the request
	Recipient     sdk.AccAddress `json:"recipient"`      // Address that should be funded
	Amount        sdk.Coins      `json:"amount"`         // Amount that should be taken
	Proof         string         `json:"proof"`          // Proof of the deposit, encrypted using an AES-256 key and hex encoded
	EncryptionKey string         `json:"encryption_key"` // AES-256 key encrypted using reader's public key and hex encoded
	FromAddress   sdk.AccAddress `json:"from_address"`   // Address from which the funds should be taken
}

DidDepositRequest represents the request that is sent from a user when he wants to use some amounts from his public identity to later power up his pairwise Did. This request will later be read and unencrypted from a central organization that will move the funds.

type DidDocument added in v1.2.0

type DidDocument struct {
	Context        string         `json:"@context"`
	ID             sdk.AccAddress `json:"id"`
	PubKeys        PubKeys        `json:"publicKey"`
	Authentication ctypes.Strings `json:"authentication"`
	Proof          Proof          `json:"proof"`
	Services       Services       `json:"service"`
}

DidDocument is the concrete serialization of the data model, according to a particular syntax. The Did Document contains attributes or claims about the DID Subject, and the DID itself is contained in the id property.

func (DidDocument) Equals added in v1.2.0

func (didDocument DidDocument) Equals(other DidDocument) bool

Equals returns true iff didDocument and other contain the same data

func (DidDocument) Validate added in v1.2.0

func (didDocument DidDocument) Validate() sdk.Error

Validate checks the data present inside this Did Document and returns an error if something is wrong

type DidPowerUpRequest added in v1.3.0

type DidPowerUpRequest struct {
	Status        *RequestStatus `json:"status"`
	Claimant      sdk.AccAddress `json:"claimant"`
	Amount        sdk.Coins      `json:"amount"`
	Proof         string         `json:"proof"`
	EncryptionKey string         `json:"encryption_key"`
}

DidDepositRequest represents the request that is sent from a user when he wants to send something to his pairwise Did. This request will be read and unencrypted from a central identity that will later update the status and send the funds to the pairwise Did

type MsgInvalidateDidDepositRequest added in v1.3.0

type MsgInvalidateDidDepositRequest struct {
	Editor       sdk.AccAddress `json:"editor"`
	DepositProof string         `json:"deposit_proof"`
	Status       RequestStatus  `json:"status"`
}

func NewMsgInvalidateDidDepositRequest added in v1.3.0

func NewMsgInvalidateDidDepositRequest(status RequestStatus, proof string, editor sdk.AccAddress) MsgInvalidateDidDepositRequest

func (MsgInvalidateDidDepositRequest) GetSignBytes added in v1.3.0

func (msg MsgInvalidateDidDepositRequest) GetSignBytes() []byte

GetSignBytes Implements Msg.

func (MsgInvalidateDidDepositRequest) GetSigners added in v1.3.0

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

GetSigners Implements Msg.

func (MsgInvalidateDidDepositRequest) Route added in v1.3.0

Route Implements Msg.

func (MsgInvalidateDidDepositRequest) Type added in v1.3.0

Type Implements Msg.

func (MsgInvalidateDidDepositRequest) ValidateBasic added in v1.3.0

func (msg MsgInvalidateDidDepositRequest) ValidateBasic() sdk.Error

ValidateBasic Implements Msg.

type MsgInvalidateDidPowerUpRequest added in v1.3.0

type MsgInvalidateDidPowerUpRequest struct {
	PowerUpProof string         `json:"power_up_proof"`
	Status       RequestStatus  `json:"status"`
	Editor       sdk.AccAddress `json:"editor"`
}

func NewMsgInvalidateDidPowerUpRequest added in v1.3.0

func NewMsgInvalidateDidPowerUpRequest(status RequestStatus, proof string, editor sdk.AccAddress) MsgInvalidateDidPowerUpRequest

func (MsgInvalidateDidPowerUpRequest) GetSignBytes added in v1.3.0

func (msg MsgInvalidateDidPowerUpRequest) GetSignBytes() []byte

GetSignBytes Implements Msg.

func (MsgInvalidateDidPowerUpRequest) GetSigners added in v1.3.0

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

GetSigners Implements Msg.

func (MsgInvalidateDidPowerUpRequest) Route added in v1.3.0

Route Implements Msg.

func (MsgInvalidateDidPowerUpRequest) Type added in v1.3.0

Type Implements Msg.

func (MsgInvalidateDidPowerUpRequest) ValidateBasic added in v1.3.0

func (msg MsgInvalidateDidPowerUpRequest) ValidateBasic() sdk.Error

ValidateBasic Implements Msg.

type MsgMoveDeposit added in v1.3.0

type MsgMoveDeposit struct {
	DepositProof string         `json:"deposit_proof"`
	Signer       sdk.AccAddress `json:"signer"`
}

func NewMsgMoveDeposit added in v1.3.0

func NewMsgMoveDeposit(proof string, signer sdk.AccAddress) MsgMoveDeposit

func (MsgMoveDeposit) GetSignBytes added in v1.3.0

func (msg MsgMoveDeposit) GetSignBytes() []byte

GetSignBytes Implements Msg.

func (MsgMoveDeposit) GetSigners added in v1.3.0

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

GetSigners Implements Msg.

func (MsgMoveDeposit) Route added in v1.3.0

func (msg MsgMoveDeposit) Route() string

Route Implements Msg.

func (MsgMoveDeposit) Type added in v1.3.0

func (msg MsgMoveDeposit) Type() string

Type Implements Msg.

func (MsgMoveDeposit) ValidateBasic added in v1.3.0

func (msg MsgMoveDeposit) ValidateBasic() sdk.Error

ValidateBasic Implements Msg.

type MsgPowerUpDid added in v1.3.0

type MsgPowerUpDid struct {
	Recipient           sdk.AccAddress `json:"recipient"`
	Amount              sdk.Coins      `json:"amount"`
	ActivationReference string         `json:"activation_reference"`
	Signer              sdk.AccAddress `json:"signer"`
}

func (MsgPowerUpDid) GetSignBytes added in v1.3.0

func (msg MsgPowerUpDid) GetSignBytes() []byte

GetSignBytes Implements Msg.

func (MsgPowerUpDid) GetSigners added in v1.3.0

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

GetSigners Implements Msg.

func (MsgPowerUpDid) Route added in v1.3.0

func (msg MsgPowerUpDid) Route() string

Route Implements Msg.

func (MsgPowerUpDid) Type added in v1.3.0

func (msg MsgPowerUpDid) Type() string

Type Implements Msg.

func (MsgPowerUpDid) ValidateBasic added in v1.3.0

func (msg MsgPowerUpDid) ValidateBasic() sdk.Error

ValidateBasic Implements Msg.

type MsgRequestDidDeposit added in v1.3.0

type MsgRequestDidDeposit struct {
	Recipient     sdk.AccAddress `json:"recipient"`      // Address that should be funded
	Amount        sdk.Coins      `json:"amount"`         // Amount that should be taken
	Proof         string         `json:"proof"`          // Proof of the deposit, encrypted using an AES-256 key and hex encoded
	EncryptionKey string         `json:"encryption_key"` // AES-256 key encrypted using reader's public key and hex encoded
	FromAddress   sdk.AccAddress `json:"from_address"`   // Address from which the funds should be taken
}

func (MsgRequestDidDeposit) GetSignBytes added in v1.3.0

func (msg MsgRequestDidDeposit) GetSignBytes() []byte

GetSignBytes Implements Msg.

func (MsgRequestDidDeposit) GetSigners added in v1.3.0

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

GetSigners Implements Msg.

func (MsgRequestDidDeposit) Route added in v1.3.0

func (msg MsgRequestDidDeposit) Route() string

Route Implements Msg.

func (MsgRequestDidDeposit) Type added in v1.3.0

func (msg MsgRequestDidDeposit) Type() string

Type Implements Msg.

func (MsgRequestDidDeposit) ValidateBasic added in v1.3.0

func (msg MsgRequestDidDeposit) ValidateBasic() sdk.Error

ValidateBasic Implements Msg.

type MsgRequestDidPowerUp added in v1.3.0

type MsgRequestDidPowerUp struct {
	Claimant      sdk.AccAddress `json:"claimant"`
	Amount        sdk.Coins      `json:"amount"`
	Proof         string         `json:"proof"`
	EncryptionKey string         `json:"encryption_key"`
}

func (MsgRequestDidPowerUp) GetSignBytes added in v1.3.0

func (msg MsgRequestDidPowerUp) GetSignBytes() []byte

GetSignBytes Implements Msg.

func (MsgRequestDidPowerUp) GetSigners added in v1.3.0

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

GetSigners Implements Msg.

func (MsgRequestDidPowerUp) Route added in v1.3.0

func (msg MsgRequestDidPowerUp) Route() string

Route Implements Msg.

func (MsgRequestDidPowerUp) Type added in v1.3.0

func (msg MsgRequestDidPowerUp) Type() string

Type Implements Msg.

func (MsgRequestDidPowerUp) ValidateBasic added in v1.3.0

func (msg MsgRequestDidPowerUp) ValidateBasic() sdk.Error

ValidateBasic Implements Msg.

type MsgSetIdentity

type MsgSetIdentity DidDocument

func NewMsgSetIdentity

func NewMsgSetIdentity(document DidDocument) MsgSetIdentity

func (MsgSetIdentity) GetSignBytes

func (msg MsgSetIdentity) GetSignBytes() []byte

GetSignBytes Implements Msg.

func (MsgSetIdentity) GetSigners

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

GetSigners Implements Msg.

func (MsgSetIdentity) Route

func (msg MsgSetIdentity) Route() string

Route Implements Msg.

func (MsgSetIdentity) Type

func (msg MsgSetIdentity) Type() string

Type Implements Msg.

func (MsgSetIdentity) ValidateBasic

func (msg MsgSetIdentity) ValidateBasic() sdk.Error

ValidateBasic Implements Msg.

type Proof added in v1.3.0

type Proof struct {
	Type           string    `json:"type"`
	Created        time.Time `json:"created"`
	Creator        string    `json:"creator"`
	SignatureValue string    `json:"signatureValue"`
}

A proof on a DID Document is cryptographic proof of the integrity of the DID Document according to either: 1. The subject, or: 1. The controller, if present.

func NewProof added in v1.3.2

func NewProof(proofType string, created time.Time, creator, signatureValue string) Proof

func (Proof) Equals added in v1.3.0

func (proof Proof) Equals(other Proof) bool

Equals returns true iff proof and other contain the same data.

func (Proof) Validate added in v1.3.0

func (proof Proof) Validate() sdk.Error

Validate checks for the content contained inside the proof and returns an error if something is invalid

type PubKey added in v1.3.0

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

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

func NewPubKey added in v1.3.2

func NewPubKey(pubKeyID string, pubKeyType string, controller sdk.AccAddress, hexValue string) PubKey

func (PubKey) Equals added in v1.3.0

func (pubKey PubKey) Equals(other PubKey) bool

Equals returns true iff pubKey and other contain the same data

func (PubKey) Validate added in v1.3.0

func (pubKey PubKey) Validate() sdk.Error

Validate checks the data contained inside pubKey and returns an error if something is wrong

type PubKeys added in v1.3.0

type PubKeys []PubKey

PubKeys represents a slice of PubKey objects

func (PubKeys) Equals added in v1.3.0

func (pubKeys PubKeys) Equals(other PubKeys) bool

Equals returns true iff pubKeys contains the same data as other in the same order

func (PubKeys) FindByID added in v1.3.2

func (pubKeys PubKeys) FindByID(id string) (PubKey, bool)

FindByID returns the key having the given id present inside the pubKeys object If no key has been found, returns false

type RequestStatus added in v1.3.0

type RequestStatus struct {
	Type    string `json:"type"`
	Message string `json:"message"`
}

RequestStatus represents the status that can be associated to a Did Deposit request or a Did Power Up request

func NewRequestStatus added in v1.3.2

func NewRequestStatus(statusType, message string) RequestStatus

func (RequestStatus) Validate added in v1.3.0

func (status RequestStatus) Validate() sdk.Error

Validate returns an error if something present inside the status is wrong

type Service added in v1.3.0

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

Service represents any type of service the subject wishes to advertise, including decentralized identity management services for further discovery, authentication, authorization, or interaction.

func NewService added in v1.3.2

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

func (Service) Equals added in v1.3.0

func (service Service) Equals(other Service) bool

Equals returns true service and other contain the same data

func (Service) Validate added in v1.3.0

func (service Service) Validate() sdk.Error

Validate checks the data present inside service and returns an error if something is invalid

type Services added in v1.3.0

type Services []Service

Services represents a list of Service objects

func (Services) Equals added in v1.3.0

func (services Services) Equals(other Services) bool

Equals allows to easily tells if two Services objects contain the same data in the same order

Jump to

Keyboard shortcuts

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