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   = "docs"
	StoreKey     = ModuleName
	QuerierRoute = ModuleName

	SupportedMetadataSchemesStoreKey = StoreKey + "supportedMetadata"
	MetadataSchemaProposersStoreKey  = StoreKey + "metadataSchemaProposers"

	DocumentStorePrefix     = StoreKey + ":document:"
	SentDocumentsPrefix     = StoreKey + ":documents:sent:"
	ReceivedDocumentsPrefix = StoreKey + ":documents:received:"

	ReceiptsStorePrefix             = StoreKey + ":receipts:"
	SentDocumentsReceiptsPrefix     = StoreKey + ":receipts:sent:"
	ReceivedDocumentsReceiptsPrefix = StoreKey + ":receipts:received:"

	MsgTypeShareDocument                    = "shareDocument"
	MsgTypeSendDocumentReceipt              = "sendDocumentReceipt"
	MsgTypeAddSupportedMetadataSchema       = "addSupportedMetadataSchema"
	MsgTypeAddTrustedMetadataSchemaProposer = "addTrustedMetadataSchemaProposer"

	QuerySentDocuments            = "sent"
	QueryReceivedDocuments        = "received"
	QueryReceivedReceipts         = "receivedReceipts"
	QuerySentReceipts             = "sentReceipts"
	QuerySupportedMetadataSchemes = "supportedMetadataSchemes"
	QueryTrustedMetadataProposers = "trustedMetadataProposers"
)

Variables

View Source
var ModuleCdc *codec.Codec

Functions

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on wire codec

Types

type Document

type Document struct {
	Sender         sdk.AccAddress          `json:"sender"`
	Recipients     types.Addresses         `json:"recipients"`
	UUID           string                  `json:"uuid"`
	Metadata       DocumentMetadata        `json:"metadata"`
	ContentURI     string                  `json:"content_uri"`     // Optional
	Checksum       *DocumentChecksum       `json:"checksum"`        // Optional
	EncryptionData *DocumentEncryptionData `json:"encryption_data"` // Optional
}

Document contains the generic information about a single document which has been sent from a user to another user. It contains the information about its content, its associated metadata and the related checksum. In order to be valid, a document must have a non-empty and unique UUID and a valid metadata information. Both the content and the checksum information are optional.

func (Document) Equals

func (doc Document) Equals(other Document) bool

Equals returns true when doc equals other, false otherwise.

func (Document) Validate added in v1.2.0

func (doc Document) Validate() sdk.Error

Validate certify whether doc is a valid Document instance or not. It returns an error with the validation failure motivation when the validation process fails.

type DocumentChecksum

type DocumentChecksum struct {
	Value     string `json:"value"`
	Algorithm string `json:"algorithm"`
}

DocumentChecksum represents the information related to the checksum of a document, if any

func (DocumentChecksum) Equals

func (checksum DocumentChecksum) Equals(other DocumentChecksum) bool

Equals returns true iff this DocumentChecksum and other have the same contents

func (DocumentChecksum) Validate added in v1.2.0

func (checksum DocumentChecksum) Validate() error

Validate returns an error if there is something wrong inside this DocumentChecksum

type DocumentEncryptionData added in v1.2.0

type DocumentEncryptionData struct {
	Keys          []DocumentEncryptionKey `json:"keys"`           // contains the keys used to encrypt the data
	EncryptedData []string                `json:"encrypted_data"` // contains the list of data that have been encrypted
}

DocumentEncryptionData contains the data that are related to the way that a document's contents or other data have been encrypted

func (DocumentEncryptionData) ContainsRecipient added in v1.3.2

func (data DocumentEncryptionData) ContainsRecipient(recipient sdk.AccAddress) bool

ContainsRecipient returns true iff data contains a key with recipient inside.

func (DocumentEncryptionData) Equals added in v1.2.0

Equals returns true iff this dat and other contain the same data

func (DocumentEncryptionData) Validate added in v1.2.0

func (data DocumentEncryptionData) Validate() error

Validate tries to validate all the data contained inside the given DocumentEncryptionData and returns an error if something is wrong

type DocumentEncryptionKey added in v1.2.0

type DocumentEncryptionKey struct {
	Recipient sdk.AccAddress `json:"recipient"` // Recipient that should use this data
	Value     string         `json:"value"`     // Value of the key that should be used. This is encrypted with the recipient's public key
}

DocumentEncryptionKey contains the data related to a specific encryption key used to encrypt some document's data when sending it to a specific recipient

func (DocumentEncryptionKey) Equals added in v1.2.0

Equals returns true iff this dat and other contain the same data

func (DocumentEncryptionKey) Validate added in v1.2.0

func (key DocumentEncryptionKey) Validate() error

Validate tries to validate all the data contained inside the given DocumentEncryptionKey and returns an error if something bad occurs

type DocumentMetadata

type DocumentMetadata struct {
	ContentURI string                  `json:"content_uri"`
	SchemaType string                  `json:"schema_type"` // Optional - Either this or schema must be defined
	Schema     *DocumentMetadataSchema `json:"schema"`      // Optional - Either this or schema_type must be defined
}

DocumentMetadata represents the information about the metadata associated to a document

func (DocumentMetadata) Equals

func (metadata DocumentMetadata) Equals(other DocumentMetadata) bool

Equals returns true iff this metadata and other contain the same data

func (DocumentMetadata) Validate added in v1.2.0

func (metadata DocumentMetadata) Validate() error

Validate tries to validate all the data contained inside the given DocumentMetadata and returns an error if something is wrong

type DocumentMetadataSchema

type DocumentMetadataSchema struct {
	URI     string `json:"uri"`
	Version string `json:"version"`
}

DocumentMetadataSchema represents the information about the schema that should be used in order to validate the metadata associated with a document.

func (DocumentMetadataSchema) Equals

func (metaSchema DocumentMetadataSchema) Equals(metSchema2 DocumentMetadataSchema) bool

type DocumentReceipt

type DocumentReceipt struct {
	UUID         string         `json:"uuid"`
	Sender       sdk.AccAddress `json:"sender"`
	Recipient    sdk.AccAddress `json:"recipient"`
	TxHash       string         `json:"tx_hash"`
	DocumentUUID string         `json:"document_uuid"`
	Proof        string         `json:"proof"` // Optional
}

DocumentReceipt contains the generic information about the proof that a shared document (identified by the DocumentUUID field) has been read by the recipient. It contains information about the sender of the receipt's proof, the recipient, the original shared Document transaction's hash, a uuid that identifies which document has been received and the proof that document been read by its recipient. To be valid, all the fields of document receipt can't be empty and in particular transaction hash need to be referred to an existing transaction on chain and the uuid associated with document has to be non-empty and unique.

func (DocumentReceipt) Equals

func (receipt DocumentReceipt) Equals(rec DocumentReceipt) bool

Equals implements equatable

type MetadataSchema

type MetadataSchema struct {
	Type      string `json:"type"`
	SchemaURI string `json:"schema_uri"`
	Version   string `json:"version"`
}

MetadataSchema contains the information about an officially supported document metadata schema

func (MetadataSchema) Equals

func (m MetadataSchema) Equals(other MetadataSchema) bool

Equals returns true iff other contains the same data as this metadata schema

func (MetadataSchema) Validate

func (m MetadataSchema) Validate() error

Validate allows to validate the content of the schema, returning an error if something is not valid

type MsgAddSupportedMetadataSchema

type MsgAddSupportedMetadataSchema struct {
	Signer sdk.AccAddress `json:"signer"`
	Schema MetadataSchema `json:"schema"`
}

func (MsgAddSupportedMetadataSchema) GetSignBytes

func (msg MsgAddSupportedMetadataSchema) GetSignBytes() []byte

GetSignBytes Implements Msg.

func (MsgAddSupportedMetadataSchema) GetSigners

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

GetSigners Implements Msg.

func (MsgAddSupportedMetadataSchema) Route

RouterKey Implements Msg.

func (MsgAddSupportedMetadataSchema) Type

Type Implements Msg.

func (MsgAddSupportedMetadataSchema) ValidateBasic

func (msg MsgAddSupportedMetadataSchema) ValidateBasic() sdk.Error

ValidateBasic Implements Msg.

type MsgAddTrustedMetadataSchemaProposer

type MsgAddTrustedMetadataSchemaProposer struct {
	Proposer sdk.AccAddress `json:"proposer"`
	Signer   sdk.AccAddress `json:"signer"`
}

func (MsgAddTrustedMetadataSchemaProposer) GetSignBytes

func (msg MsgAddTrustedMetadataSchemaProposer) GetSignBytes() []byte

GetSignBytes Implements Msg.

func (MsgAddTrustedMetadataSchemaProposer) GetSigners

GetSigners Implements Msg.

func (MsgAddTrustedMetadataSchemaProposer) Route

RouterKey Implements Msg.

func (MsgAddTrustedMetadataSchemaProposer) Type

Type Implements Msg.

func (MsgAddTrustedMetadataSchemaProposer) ValidateBasic

func (msg MsgAddTrustedMetadataSchemaProposer) ValidateBasic() sdk.Error

ValidateBasic Implements Msg.

type MsgSendDocumentReceipt

type MsgSendDocumentReceipt DocumentReceipt

func NewMsgSendDocumentReceipt added in v1.3.0

func NewMsgSendDocumentReceipt(receipt DocumentReceipt) MsgSendDocumentReceipt

func (MsgSendDocumentReceipt) GetSignBytes

func (msg MsgSendDocumentReceipt) GetSignBytes() []byte

GetSignBytes Implements Msg.

func (MsgSendDocumentReceipt) GetSigners

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

GetSigners Implements Msg.

func (MsgSendDocumentReceipt) Route

func (msg MsgSendDocumentReceipt) Route() string

RouterKey Implements Msg.

func (MsgSendDocumentReceipt) Type

func (msg MsgSendDocumentReceipt) Type() string

Type Implements Msg.

func (MsgSendDocumentReceipt) ValidateBasic

func (msg MsgSendDocumentReceipt) ValidateBasic() sdk.Error

ValidateBasic Implements Msg.

type MsgShareDocument

type MsgShareDocument Document

func NewMsgShareDocument

func NewMsgShareDocument(document Document) MsgShareDocument

func (MsgShareDocument) GetSignBytes

func (msg MsgShareDocument) GetSignBytes() []byte

GetSignBytes Implements Msg.

func (MsgShareDocument) GetSigners

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

GetSigners Implements Msg.

func (MsgShareDocument) Route

func (msg MsgShareDocument) Route() string

RouterKey Implements Msg.

func (MsgShareDocument) Type

func (msg MsgShareDocument) Type() string

Type Implements Msg.

func (MsgShareDocument) ValidateBasic

func (msg MsgShareDocument) ValidateBasic() sdk.Error

ValidateBasic Implements Msg.

Jump to

Keyboard shortcuts

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