processor

package
v2.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: Apache-2.0, MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CoreClaimOptions

type CoreClaimOptions verifiable.CoreClaimOptions

CoreClaimOptions is params for core claim parsing Deprecated: use verifiable.CoreClaimOptions instead

type Opt

type Opt func(opts *Processor)

Opt returns configuration options for processor suite

func WithDocumentLoader

func WithDocumentLoader(s ld.DocumentLoader) Opt

WithDocumentLoader return new options

func WithParser

func WithParser(s Parser) Opt

WithParser return new options

func WithValidator

func WithValidator(s Validator) Opt

WithValidator return new options

type Parser

type Parser interface {
	// Deprecated: use credential.ToCoreClaim instead
	ParseClaim(ctx context.Context, credential verifiable.W3CCredential,
		options *CoreClaimOptions) (*core.Claim, error)
	GetFieldSlotIndex(field string, typeName string, schema []byte) (int, error)
}

Parser is an interface to parse claim slots

type Processor

type Processor struct {
	Validator      Validator
	DocumentLoader ld.DocumentLoader
	Parser         Parser
}

Processor is set of tool for claim processing

func InitProcessorOptions

func InitProcessorOptions(processor *Processor, opts ...Opt) *Processor

InitProcessorOptions initializes processor with options.

func (*Processor) GetFieldSlotIndex

func (s *Processor) GetFieldSlotIndex(field string, typeName string,
	schema []byte) (int, error)

GetFieldSlotIndex returns index of slot for specified field according to schema

func (*Processor) Load

func (s *Processor) Load(ctx context.Context, url string) (schema []byte, err error)

Load will load a schema by given url.

func (*Processor) ParseClaim

func (s *Processor) ParseClaim(ctx context.Context,
	credential verifiable.W3CCredential,
	opts *CoreClaimOptions) (*core.Claim, error)

ParseClaim will serialize input data to index and value fields.

func (*Processor) ValidateData

func (s *Processor) ValidateData(data, schema []byte) error

ValidateData will validate a claim content by given schema.

type Validator

type Validator interface {
	ValidateData(data, schema []byte) error
}

Validator is interface to validate data and documents

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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