operationparser

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 19 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrOperationEarly = errors.New("operation early")

ErrOperationEarly is thrown if anchor from time is greater then reference time(e.g. server time or anchoring time).

View Source
var ErrOperationExpired = errors.New("operation expired")

ErrOperationExpired is thrown if anchor until time is less then reference time(e.g. server time or anchoring time).

Functions

This section is empty.

Types

type ObjectValidator

type ObjectValidator interface {
	Validate(obj interface{}) error
}

ObjectValidator validates object. Currently used for anchor origin validation however it can be used for any object validation.

type Option

type Option func(opts *Parser)

Option is a parser instance option.

func WithAnchorOriginValidator

func WithAnchorOriginValidator(v ObjectValidator) Option

WithAnchorOriginValidator sets optional anchor origin validator.

func WithAnchorTimeValidator

func WithAnchorTimeValidator(v TimeValidator) Option

WithAnchorTimeValidator sets optional anchor time validator.

type Parser

type Parser struct {
	protocol.Protocol
	// contains filtered or unexported fields
}

Parser is an operation parser.

func New

func New(p protocol.Protocol, opts ...Option) *Parser

New returns a new operation parser.

func (*Parser) GetCommitment

func (p *Parser) GetCommitment(opBytes []byte) (string, error)

GetCommitment returns next operation commitment.

func (*Parser) GetRevealValue

func (p *Parser) GetRevealValue(opBytes []byte) (string, error)

GetRevealValue returns this operation reveal value.

func (*Parser) Parse

func (p *Parser) Parse(namespace string, operationBuffer []byte) (*operation.Operation, error)

Parse parses and validates operation.

func (*Parser) ParseCreateOperation

func (p *Parser) ParseCreateOperation(request []byte, batch bool) (*model.Operation, error)

ParseCreateOperation will parse create operation.

func (*Parser) ParseDID

func (p *Parser) ParseDID(namespace, shortOrLongFormDID string) (string, []byte, error)

ParseDID inspects resolution request and returns: - did and create request in case of long form resolution - just did in case of short form resolution (common scenario).

func (*Parser) ParseDeactivateOperation

func (p *Parser) ParseDeactivateOperation(request []byte, batch bool) (*model.Operation, error)

ParseDeactivateOperation will parse deactivate operation.

func (*Parser) ParseOperation

func (p *Parser) ParseOperation(namespace string, operationBuffer []byte, batch bool) (*model.Operation, error)

ParseOperation parses and validates operation. Batch mode flag gives hints for the validation of operation object (anticipating future pruning/checkpoint requirements).

func (*Parser) ParseRecoverOperation

func (p *Parser) ParseRecoverOperation(request []byte, batch bool) (*model.Operation, error)

ParseRecoverOperation will parse recover operation.

func (*Parser) ParseSignedDataForDeactivate

func (p *Parser) ParseSignedDataForDeactivate(compactJWS string) (*model.DeactivateSignedDataModel, error)

ParseSignedDataForDeactivate will parse and validate signed data for deactivate.

func (*Parser) ParseSignedDataForRecover

func (p *Parser) ParseSignedDataForRecover(compactJWS string) (*model.RecoverSignedDataModel, error)

ParseSignedDataForRecover will parse and validate signed data for recover.

func (*Parser) ParseSignedDataForUpdate

func (p *Parser) ParseSignedDataForUpdate(compactJWS string) (*model.UpdateSignedDataModel, error)

ParseSignedDataForUpdate will parse and validate signed data for update.

func (*Parser) ParseUpdateOperation

func (p *Parser) ParseUpdateOperation(request []byte, batch bool) (*model.Operation, error)

ParseUpdateOperation will parse update operation.

func (*Parser) ValidateDelta

func (p *Parser) ValidateDelta(delta *model.DeltaModel) error

ValidateDelta validates delta.

func (*Parser) ValidateSuffixData

func (p *Parser) ValidateSuffixData(suffixData *model.SuffixDataModel) error

ValidateSuffixData validates suffix data.

type TimeValidator

type TimeValidator interface {
	Validate(from, until int64) error
}

TimeValidator validates earliest and expiry time for an operation against server time.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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