jsonld

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClaimBasicContext

type ClaimBasicContext struct {
	Version   float64 `json:"@version"`
	Protected bool    `json:"@protected"`
	ID        string  `json:"id"`
	Type      string  `json:"type"`
}

ClaimBasicContext is representation of default fields for claim schema

type ClaimContext

type ClaimContext struct {
	ClaimBasicContext
	Fields map[string]SerializationField
	Vocab  map[string]string
}

ClaimContext all parsed fields of ClaimSchema

type ClaimSchema

type ClaimSchema struct {
	ID      string                 `json:"@id"`
	Context map[string]interface{} `json:"@context"`
}

ClaimSchema is description of schema for specific claim type

type Parser

type Parser struct {
	ClaimType       string
	ParsingStrategy processor.ParsingStrategy
}

Parser can parse claim data according to specification

func (Parser) AssignSlots

func (p Parser) AssignSlots(content []byte, ctx *ClaimContext) (processor.ParsedSlots, error)

AssignSlots adds content to claim slots according its specification slot

func (Parser) FillSlots

func (p Parser) FillSlots(data []byte, ctx *ClaimContext) (processor.ParsedSlots, error)

FillSlots fills slots sequentially

func (Parser) GetFieldSlotIndex

func (p 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 (p Parser) ParseClaim(credential *verifiable.Iden3Credential, schemaBytes []byte) (*core.Claim, error)

ParseClaim creates Claim object from Iden3Credential

func (Parser) ParseSlots

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

ParseSlots converts payload to claim slots using provided schema

type SchemaContext

type SchemaContext struct {
	Context []map[string]interface{} `json:"@context"`
}

SchemaContext is top-level wrapper of json-ld schema

type SerializationField

type SerializationField struct {
	ID   string `json:"@id"`
	Type string `json:"@type"`
}

SerializationField represents fields that rather must be parsed to value or index

type Validator

type Validator struct {
	Type string
}

Validator is responsible for document verification

func (Validator) ValidateData

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

ValidateData validates JSON data by JSON-LD Schema

Jump to

Keyboard shortcuts

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