Documentation ¶
Index ¶
- Variables
- type ObjectValidator
- type Option
- type Parser
- func (p *Parser) GetCommitment(opBytes []byte) (string, error)
- func (p *Parser) GetRevealValue(opBytes []byte) (string, error)
- func (p *Parser) Parse(namespace string, operationBuffer []byte) (*operation.Operation, error)
- func (p *Parser) ParseCreateOperation(request []byte, batch bool) (*model.Operation, error)
- func (p *Parser) ParseDID(namespace, shortOrLongFormDID string) (string, []byte, error)
- func (p *Parser) ParseDeactivateOperation(request []byte, batch bool) (*model.Operation, error)
- func (p *Parser) ParseOperation(namespace string, operationBuffer []byte, batch bool) (*model.Operation, error)
- func (p *Parser) ParseRecoverOperation(request []byte, batch bool) (*model.Operation, error)
- func (p *Parser) ParseSignedDataForDeactivate(compactJWS string) (*model.DeactivateSignedDataModel, error)
- func (p *Parser) ParseSignedDataForRecover(compactJWS string) (*model.RecoverSignedDataModel, error)
- func (p *Parser) ParseSignedDataForUpdate(compactJWS string) (*model.UpdateSignedDataModel, error)
- func (p *Parser) ParseUpdateOperation(request []byte, batch bool) (*model.Operation, error)
- func (p *Parser) ValidateDelta(delta *model.DeltaModel) error
- func (p *Parser) ValidateSuffixData(suffixData *model.SuffixDataModel) error
- type TimeValidator
Constants ¶
This section is empty.
Variables ¶
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).
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 ¶
Parser is an operation parser.
func (*Parser) GetCommitment ¶
GetCommitment returns next operation commitment.
func (*Parser) GetRevealValue ¶
GetRevealValue returns this operation reveal value.
func (*Parser) ParseCreateOperation ¶
ParseCreateOperation will parse create operation.
func (*Parser) ParseDID ¶
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 ¶
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 ¶
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 ¶
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 ¶
TimeValidator validates earliest and expiry time for an operation against server time.