model

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: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAnchoredOperation

func GetAnchoredOperation(op *Operation) (*operation.AnchoredOperation, error)

GetAnchoredOperation is utility method for converting operation model into anchored operation.

func GetUniqueSuffix

func GetUniqueSuffix(model *SuffixDataModel, algs []uint) (string, error)

GetUniqueSuffix calculates unique suffix from suffix data and multihash algorithms.

Types

type CreateRequest

type CreateRequest struct {
	// operation
	// Required: true
	Operation operation.Type `json:"type,omitempty"`

	// Suffix data object
	// Required: true
	SuffixData *SuffixDataModel `json:"suffixData,omitempty"`

	// Delta object
	// Required: true
	Delta *DeltaModel `json:"delta,omitempty"`
}

CreateRequest is the struct for create payload JCS.

type DeactivateRequest

type DeactivateRequest struct {
	// Operation
	// Required: true
	Operation operation.Type `json:"type"`

	// DidSuffix of the DID
	// Required: true
	DidSuffix string `json:"didSuffix"`

	// RevealValue is the reveal value
	RevealValue string `json:"revealValue"`

	// Compact JWS - signature information
	SignedData string `json:"signedData"`
}

DeactivateRequest is the struct for deactivating document.

type DeactivateSignedDataModel

type DeactivateSignedDataModel struct {

	// DidSuffix is the suffix of the DID
	// Required: true
	DidSuffix string `json:"didSuffix"`

	// RevealValue is the reveal value
	RevealValue string `json:"revealValue"`

	// RecoveryKey is the current recovery key
	RecoveryKey *jws.JWK `json:"recoveryKey"`

	// AnchorFrom defines earliest time for this operation.
	AnchorFrom int64 `json:"anchorFrom,omitempty"`

	// AnchorUntil defines expiry time for this operation.
	AnchorUntil int64 `json:"anchorUntil,omitempty"`
}

DeactivateSignedDataModel defines data model for deactivate.

type DeltaModel

type DeltaModel struct {

	// Commitment hash for the next update operation
	UpdateCommitment string `json:"updateCommitment,omitempty"`

	// Patches defines document patches
	Patches []patch.Patch `json:"patches,omitempty"`
}

DeltaModel contains patch data (patches used for create, recover, update).

type Operation

type Operation struct {

	// Type defines operation type
	Type operation.Type

	// Namespace defines document namespace
	Namespace string

	// ID is full ID for this document -  namespace + unique suffix
	ID string

	// UniqueSuffix is unique suffix
	UniqueSuffix string

	// OperationRequest is the original operation request
	OperationRequest []byte

	// SignedData is signed data for the operation (compact JWS)
	SignedData string

	// RevealValue is multihash of JWK
	RevealValue string

	// Delta is operation delta model
	Delta *DeltaModel

	// SuffixDataModel is suffix data model
	SuffixData *SuffixDataModel

	// AnchorOrigin is anchor origin
	AnchorOrigin interface{}
}

Operation is used for parsing operation request.

type RecoverRequest

type RecoverRequest struct {
	// operation
	// Required: true
	Operation operation.Type `json:"type"`

	// DidSuffix is the suffix of the DID
	// Required: true
	DidSuffix string `json:"didSuffix"`

	// RevealValue is the reveal value
	RevealValue string `json:"revealValue"`

	// Compact JWS - signature information
	SignedData string `json:"signedData"`

	// Delta object
	// Required: true
	Delta *DeltaModel `json:"delta"`
}

RecoverRequest is the struct for document recovery payload.

type RecoverSignedDataModel

type RecoverSignedDataModel struct {

	// DeltaHash of the unsigned delta object
	DeltaHash string `json:"deltaHash"`

	// RecoveryKey is The current recovery key
	RecoveryKey *jws.JWK `json:"recoveryKey"`

	// RecoveryCommitment is the commitment used for the next recovery/deactivate
	RecoveryCommitment string `json:"recoveryCommitment"`

	// AnchorOrigin signifies the system(s) that know the most recent anchor for this DID (optional)
	AnchorOrigin interface{} `json:"anchorOrigin,omitempty"`

	// AnchorFrom defines earliest time for this operation.
	AnchorFrom int64 `json:"anchorFrom,omitempty"`

	// AnchorUntil defines expiry time for this operation.
	AnchorUntil int64 `json:"anchorUntil,omitempty"`
}

RecoverSignedDataModel defines signed data model for recovery.

type SuffixDataModel

type SuffixDataModel struct {

	// Hash of the delta object (required)
	DeltaHash string `json:"deltaHash,omitempty"`

	// Commitment hash for the next recovery or deactivate operation (required)
	RecoveryCommitment string `json:"recoveryCommitment,omitempty"`

	// AnchorOrigin signifies the system(s) that know the most recent anchor for this DID (optional)
	AnchorOrigin interface{} `json:"anchorOrigin,omitempty"`

	// Type signifies the type of entity a DID represents (optional)
	Type string `json:"type,omitempty"`
}

SuffixDataModel is part of create request.

type UpdateRequest

type UpdateRequest struct {
	// Operation defines operation type
	Operation operation.Type `json:"type"`

	// DidSuffix is the suffix of the DID
	DidSuffix string `json:"didSuffix"`

	// RevealValue is the reveal value
	RevealValue string `json:"revealValue"`

	// SignedData is compact JWS - signature information
	SignedData string `json:"signedData"`

	// Delta is encoded delta object
	Delta *DeltaModel `json:"delta"`
}

UpdateRequest is the struct for update request.

type UpdateSignedDataModel

type UpdateSignedDataModel struct {
	// UpdateKey is the current update key
	UpdateKey *jws.JWK `json:"updateKey"`

	// DeltaHash of the unsigned delta object
	DeltaHash string `json:"deltaHash"`

	// AnchorFrom defines earliest time for this operation.
	AnchorFrom int64 `json:"anchorFrom,omitempty"`

	// AnchorUntil defines expiry time for this operation.
	AnchorUntil int64 `json:"anchorUntil,omitempty"`
}

UpdateSignedDataModel defines signed data model for update.

Jump to

Keyboard shortcuts

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