verifiable

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: AGPL-3.0 Imports: 3 Imported by: 7

Documentation

Index

Constants

View Source
const BJJSignatureProof = "BJJSignature2021"

BJJSignatureProof schema

View Source
const Iden3SparseMerkleProof = "Iden3SparseMerkleProof"

Iden3SparseMerkleProof schema

View Source
const JSONSchemaValidator2018 = "JsonSchemaValidator2018"

JSONSchemaValidator2018 JSON schema

View Source
const SparseMerkleProof = "SparseMerkleProof"

SparseMerkleProof schema

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicProof

type BasicProof struct {
	Type   string `json:"@type"`
	Issuer string `json:"issuer"`
	HIndex string `json:"h_index"`
	HValue string `json:"h_value"`
}

BasicProof is basic proof for Iden3Claim

type CredentialStatus

type CredentialStatus struct {
	ID   string               `json:"id"`
	Type CredentialStatusType `json:"type"`
}

CredentialStatus contains type and revocation Url

type CredentialStatusType

type CredentialStatusType string

CredentialStatusType type for understanding revocation type

const SparseMerkleTreeProof CredentialStatusType = "SparseMerkleTreeProof"

SparseMerkleTreeProof is CredentialStatusType

type Iden3Credential

type Iden3Credential struct {
	ID                string                 `json:"id"`
	Context           []string               `json:"@context"`
	Type              []string               `json:"@type"`
	Expiration        time.Time              `json:"expiration,omitempty"`
	Updatable         bool                   `json:"updatable"`
	Version           uint32                 `json:"version"`
	RevNonce          uint64                 `json:"rev_nonce"`
	CredentialSubject map[string]interface{} `json:"credentialSubject"`
	CredentialStatus  *CredentialStatus      `json:"credentialStatus,omitempty"`
	CredentialSchema  struct {
		ID   string `json:"@id"`
		Type string `json:"type"`
	} `json:"credentialSchema"`
	Proof interface{} `json:"proof,omitempty"`
}

Iden3Credential is struct that represents claim json-ld document

type MTP

type MTP struct {
	Type      string     `json:"@type,omitempty"`
	Existence bool       `json:"existence"`
	Siblings  []*mt.Hash `json:"siblings"`
	NodeAux   *struct {
		HIndex string `json:"h_index,omitempty"`
		HValue string `json:"h_value,omitempty"`
	} `json:"node_aux,omitempty"`
}

MTP is merkle tree mtp but in lower case and with type

type MTPProof

type MTPProof struct {
	BasicProof
	State struct {
		TxID               *string `json:"tx_id,omitempty"`
		BlockTimestamp     *int    `json:"block_timestamp,omitempty"`
		BlockNumber        *int    `json:"block_number,omitempty"`
		RootOfRoots        *string `json:"root_of_roots,omitempty"`
		ClaimsTreeRoot     *string `json:"claims_tree_root,omitempty"`
		RevocationTreeRoot *string `json:"revocation_tree_root,omitempty"`
		Value              *string `json:"value,omitempty"`
		Status             string  `json:"status,omitempty"`
	} `json:"state"`

	Mtp MTP `json:"mtp"`
}

MTPProof JSON-LD merkle tree proof

type ProofData added in v0.0.19

type ProofData struct {
	A        []string   `json:"pi_a"`
	B        [][]string `json:"pi_b"`
	C        []string   `json:"pi_c"`
	Protocol string     `json:"protocol"`
}

ProofData is structure that represents SnarkJS library result of proof generation

type ProofPurpose

type ProofPurpose string

ProofPurpose is alias for string, represents proof purpose

const (
	// ProofPurposeAuthentication is a proof for authentication
	ProofPurposeAuthentication ProofPurpose = "Authentication"
)

type ProofRequest added in v0.0.19

type ProofRequest interface {
	GetType() ProofType
	GetRules() map[string]interface{}
	GetID() string
	GetChallenge() *big.Int
}

ProofRequest is a request for zk / signature proof generation

type ProofType added in v0.0.19

type ProofType string

ProofType is a type that must be used for proof definition

var (
	// ZeroKnowledgeProofType describes zkp type
	ZeroKnowledgeProofType ProofType = "zeroknowledge"
	// SignatureProofType describes signature
	SignatureProofType ProofType = "signature"
)

func (ProofType) String added in v0.0.19

func (p ProofType) String() string

String returns string representation of ProofType

type RevocationStatus added in v0.0.19

type RevocationStatus struct {
	Issuer struct {
		State              *string `json:"state"`
		RootOfRoots        *string `json:"root_of_roots,omitempty"`
		ClaimsTreeRoot     *string `json:"claims_tree_root,omitempty"`
		RevocationTreeRoot *string `json:"revocation_tree_root,omitempty"`
	} `json:"issuer"`
	MTP `json:"mtp"`
}

RevocationStatus status of revocation nonce. Info required to check revocation state of claim in circuits

type SignatureProof

type SignatureProof struct {
	BasicProof

	Created            int64    `json:"created"`
	IssuerMTP          MTPProof `json:"issuer_mtp"`
	VerificationMethod string   `json:"verification_method"`
	ProofValue         string   `json:"proof_value"`
	ProofPurpose       string   `json:"proof_purpose"`
}

SignatureProof is proof that contains signature of content

type ZKProof added in v0.0.19

type ZKProof struct {
	Proof      *ProofData `json:"proof"`
	PubSignals []string   `json:"pub_signals"`
}

ZKProof is proof data with public signals

type ZeroKnowledgeProofRequest added in v0.0.19

type ZeroKnowledgeProofRequest struct {
	Type      ProofType              `json:"type"`
	CircuitID string                 `json:"circuit_id"`
	Challenge *big.Int               `json:"challenge"`
	Rules     map[string]interface{} `json:"rules,omitempty"`
}

ZeroKnowledgeProofRequest represents structure of zkp object

func (*ZeroKnowledgeProofRequest) GetChallenge added in v0.0.19

func (r *ZeroKnowledgeProofRequest) GetChallenge() *big.Int

GetChallenge challenge from zkp request

func (*ZeroKnowledgeProofRequest) GetID added in v0.0.19

func (r *ZeroKnowledgeProofRequest) GetID() string

GetID returns id from zkp request

func (*ZeroKnowledgeProofRequest) GetRules added in v0.0.19

func (r *ZeroKnowledgeProofRequest) GetRules() map[string]interface{}

GetRules rules from zkp request

func (*ZeroKnowledgeProofRequest) GetType added in v0.0.19

func (r *ZeroKnowledgeProofRequest) GetType() ProofType

GetType returns type from zkp request

Jump to

Keyboard shortcuts

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