models

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chunk

type Chunk struct {
	ChunkFileURI string `json:"chunkFileUri"`
}

Chunk holds chunk file URI.

type ChunkFile

type ChunkFile struct {
	// Deltas included in this chunk file, each delta is an encoded string
	Deltas []*model.DeltaModel `json:"deltas"`
}

ChunkFile defines chunk file schema.

func CreateChunkFile

func CreateChunkFile(ops *SortedOperations) *ChunkFile

CreateChunkFile will combine all operation deltas into chunk file. returns chunk file model.

func ParseChunkFile

func ParseChunkFile(content []byte) (*ChunkFile, error)

ParseChunkFile will parse chunk file model from content.

type CoreIndexFile

type CoreIndexFile struct {

	// ProvisionalIndexFileURI is provisional index file URI
	ProvisionalIndexFileURI string `json:"provisionalIndexFileUri,omitempty"`

	// CoreProofFileURI is core proof file URI
	CoreProofFileURI string `json:"coreProofFileUri,omitempty"`

	// CoreOperations contain proving data for create, recover and deactivate operations.
	Operations *CoreOperations `json:"operations,omitempty"`
}

CoreIndexFile defines the schema of an core index file.

func CreateCoreIndexFile

func CreateCoreIndexFile(coreProofURI, provisionalIndexURI string, ops *SortedOperations) *CoreIndexFile

CreateCoreIndexFile will create core index file from provided operations. returns core index file model.

func ParseCoreIndexFile

func ParseCoreIndexFile(content []byte) (*CoreIndexFile, error)

ParseCoreIndexFile will parse core index file from content.

type CoreOperations

type CoreOperations struct {
	Create     []CreateReference    `json:"create,omitempty"`
	Recover    []OperationReference `json:"recover,omitempty"`
	Deactivate []OperationReference `json:"deactivate,omitempty"`
}

CoreOperations contains operation references.

type CoreProofFile

type CoreProofFile struct {

	// Operations contain proving data for recover and deactivate operations.
	Operations CoreProofOperations `json:"operations,omitempty"`
}

CoreProofFile defines the schema for core proof file. Core proof file contains the cryptographic proofs (signatures, hashes, etc.) that form the signature-chained backbone for the state lineages of all DIDs in the system. The cryptographic proofs present in core proof file also link a given operation to its verbose state data, which resides in a related chunk file.

func CreateCoreProofFile

func CreateCoreProofFile(recoverOps, deactivateOps []*model.Operation) *CoreProofFile

CreateCoreProofFile will create core proof file from provided operations. returns core proof file model.

func ParseCoreProofFile

func ParseCoreProofFile(content []byte) (*CoreProofFile, error)

ParseCoreProofFile will parse core proof model from content.

type CoreProofOperations

type CoreProofOperations struct {
	Recover    []string `json:"recover,omitempty"`
	Deactivate []string `json:"deactivate,omitempty"`
}

CoreProofOperations contains proving data for any recover and deactivate operations to be included in a batch.

type CreateReference

type CreateReference struct {
	// SuffixData object
	SuffixData *model.SuffixDataModel `json:"suffixData"`
}

CreateReference contains create operation reference.

type OperationReference

type OperationReference struct {
	// DidSuffix is the suffix of the DID
	DidSuffix string `json:"didSuffix"`

	// RevealValue is multihash of JWK
	RevealValue string `json:"revealValue"`
}

OperationReference contains minimum proving data.

type ProvisionalIndexFile

type ProvisionalIndexFile struct {

	// ProvisionalProofFileURI is provisional proof file URI
	ProvisionalProofFileURI string `json:"provisionalProofFileUri,omitempty"`

	// Chunks are chunk entries for the related delta data for a given chunk of operations in the batch.
	Chunks []Chunk `json:"chunks"`

	// Operations will contain provisional (update) operations
	Operations *ProvisionalOperations `json:"operations,omitempty"`
}

ProvisionalIndexFile defines the schema for provisional index file and its related operations.

func CreateProvisionalIndexFile

func CreateProvisionalIndexFile(chunkURIs []string, provisionalProofURI string, updateOps []*model.Operation) *ProvisionalIndexFile

CreateProvisionalIndexFile will create provisional index file model from operations and chunk file URI. returns chunk file model.

func ParseProvisionalIndexFile

func ParseProvisionalIndexFile(content []byte) (*ProvisionalIndexFile, error)

ParseProvisionalIndexFile will parse content into provisional index file model.

type ProvisionalOperations

type ProvisionalOperations struct {
	Update []OperationReference `json:"update,omitempty"`
}

ProvisionalOperations contains minimal operation proving data for provisional (update) operations.

type ProvisionalProofFile

type ProvisionalProofFile struct {
	Operations ProvisionalProofOperations `json:"operations,omitempty"`
}

ProvisionalProofFile defines the schema for provisional proof file. Provisional proof file contains the cryptographic proofs (signatures, hashes, etc.) for all the (eventually) prunable DID operations in the system. The cryptographic proofs present in provisional proof file also link a given operation to its verbose state data, which resides in a related chunk file.

func CreateProvisionalProofFile

func CreateProvisionalProofFile(updateOps []*model.Operation) *ProvisionalProofFile

CreateProvisionalProofFile will create provisional proof file model from operations. returns provisional proof file model.

func ParseProvisionalProofFile

func ParseProvisionalProofFile(content []byte) (*ProvisionalProofFile, error)

ParseProvisionalProofFile will parse provisional proof file model from content.

type ProvisionalProofOperations

type ProvisionalProofOperations struct {
	Update []string `json:"update,omitempty"`
}

ProvisionalProofOperations contains proving data for any update operation to be included in the batch.

type SortedOperations

type SortedOperations struct {
	Create     []*model.Operation
	Update     []*model.Operation
	Recover    []*model.Operation
	Deactivate []*model.Operation
}

SortedOperations stores operations per type.

func (*SortedOperations) Size

func (o *SortedOperations) Size() int

Size returns the length of all operations(combined).

Jump to

Keyboard shortcuts

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