json

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: May 9, 2022 License: AGPL-3.0 Imports: 9 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommonJSONSerializationSchema

type CommonJSONSerializationSchema struct {
	Index struct {
		Type    string   `json:"type"`
		Default []string `json:"default"`
	} `json:"index"`
	Value struct {
		Type    string   `json:"type"`
		Default []string `json:"default"`
	} `json:"value"`
}

CommonJSONSerializationSchema Common JSON

type Parser

type Parser struct {
	ParsingStrategy processor.ParsingStrategy
}

Parser can parse claim data according to specification

func (Parser) AssignSlots

func (s Parser) AssignSlots(content []byte, indexFields, valueFields []string) (processor.ParsedSlots, error)

AssignSlots assigns index and value fields to specific slot according array order

func (Parser) GetFieldSlotIndex

func (s Parser) GetFieldSlotIndex(field string, schema []byte) (int, error)

GetFieldSlotIndex return index of slot from 0 to 7 (each claim has by default 8 slots)

func (Parser) ParseClaim

func (s Parser) ParseClaim(credential *verifiable.Iden3Credential, schemaBytes []byte) (*core.Claim, error)

ParseClaim creates Claim object from Iden3Credential

func (Parser) ParseSlots

func (s Parser) ParseSlots(data, schema []byte) (processor.ParsedSlots, error)

ParseSlots converts payload to claim slots using provided schema

type Validator

type Validator struct {
}

Validator validate json data

func (Validator) ValidateData

func (v Validator) ValidateData(data, schema []byte) error

ValidateData validate JSON data by JSON Schema

func (Validator) ValidateDocument

func (v Validator) ValidateDocument(doc, schema []byte) error

ValidateDocument validate json document by json schema

Jump to

Keyboard shortcuts

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