types

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2022 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticationMetadata

type AuthenticationMetadata struct {
	UserIdentifier          string
	UserState               string
	AuthenticationChallenge string
}

AuthenticationMetadata defines basic metadata that can be retrieved from auth proof

type AuthenticationRules

type AuthenticationRules struct {
	Challenge int64  `json:"challenge"`
	Audience  string `json:"audience"`
}

AuthenticationRules represents structure rules for zkp authentication proof

type AuthorizationMessageRequest

type AuthorizationMessageRequest struct {
	Type    ProtocolMessage                 `json:"type"`
	Data    AuthorizationMessageRequestData `json:"data"`
	Message `json:"-"`
}

AuthorizationMessageRequest is struct the represents authentication request message format

func (*AuthorizationMessageRequest) GetData

func (m *AuthorizationMessageRequest) GetData() interface{}

GetData returns data of AuthorizationMessageRequest

func (*AuthorizationMessageRequest) GetType

GetType returns defined type of AuthorizationMessageRequest

func (*AuthorizationMessageRequest) WithDefaultAuth

func (m *AuthorizationMessageRequest) WithDefaultAuth(challenge int64) error

WithDefaultAuth adds authentication request to scope

func (*AuthorizationMessageRequest) WithZeroKnowledgeProofRequest

func (m *AuthorizationMessageRequest) WithZeroKnowledgeProofRequest(proof ZeroKnowledgeProofRequest)

WithZeroKnowledgeProofRequest adds zkp proof to scope of request

type AuthorizationMessageRequestData

type AuthorizationMessageRequestData struct {
	CallbackURL string       `json:"callbackUrl"`
	Audience    string       `json:"audience"`
	Scope       []TypedScope `json:"scope"`
}

AuthorizationMessageRequestData is struct the represents authorization request data

type AuthorizationMessageResponse

type AuthorizationMessageResponse struct {
	Type    ProtocolMessage                  `json:"type"`
	Data    AuthorizationMessageResponseData `json:"data"`
	Message `json:"-"`
}

AuthorizationMessageResponse is struct the represents authentication response message format

func (*AuthorizationMessageResponse) GetData

func (m *AuthorizationMessageResponse) GetData() interface{}

GetData returns data of AuthorizationMessage

func (*AuthorizationMessageResponse) GetType

GetType returns defined type of AuthorizationMessage

type AuthorizationMessageResponseData

type AuthorizationMessageResponseData struct {
	Scope []interface{} `json:"scope"`
}

AuthorizationMessageResponseData is struct the represents authorization response data

type BasicMessage

type BasicMessage struct {
	Type ProtocolMessage `json:"type"`
	Data json.RawMessage `json:"data"`
	Message
}

BasicMessage is structure for message with unknown data format

func (*BasicMessage) GetData

func (m *BasicMessage) GetData() interface{}

GetData returns data of BasicMessage

func (*BasicMessage) GetType

func (m *BasicMessage) GetType() ProtocolMessage

GetType returns defined type of BasicMessage

type CircuitData

type CircuitData struct {
	ID              circuits.CircuitID
	Description     string
	VerificationKey circuits.VerificationKeyJSON
	Metadata        circuits.PublicSchemaJSON
}

CircuitData represents data that describes circuit

type CredentialFetchRequest added in v0.0.5

type CredentialFetchRequest struct {
	Type    ProtocolMessage                   `json:"type"`
	Data    CredentialFetchRequestMessageData `json:"data"`
	Message `json:"-"`
}

CredentialFetchRequest is struct the represents credential fetch request message format

func (*CredentialFetchRequest) GetData added in v0.0.5

func (m *CredentialFetchRequest) GetData() interface{}

GetData returns data of AuthorizationMessage

func (*CredentialFetchRequest) GetType added in v0.0.5

GetType returns defined type of AuthorizationMessage

type CredentialFetchRequestMessageData added in v0.0.5

type CredentialFetchRequestMessageData struct {
	ClaimID string        `json:"claim_id"`
	Schema  string        `json:"schema"`
	Scope   []interface{} `json:"scope"`
}

CredentialFetchRequestMessageData is struct the represents credential fetch request data

type KYCBySignatureRules

type KYCBySignatureRules struct {
	Challenge        int      `json:"challenge"`
	CountryBlacklist []int    `json:"countryBlacklist"`
	CurrentYear      int      `json:"currentYear"`
	CurrentMonth     int      `json:"currentMonth"`
	CurrentDay       int      `json:"currentDay"`
	MinAge           int      `json:"minAge"`
	Audience         string   `json:"audience"`
	AllowedIssuers   []string `json:"allowedIssuers"`
}

KYCBySignatureRules represents structure rules zkp kycBySignatures proof

type Message

type Message interface {
	GetType() ProtocolMessage
	GetData() interface{}
}

Message restricts objects that can be presented as protocol messages

type ProofData

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

ProofData describes three components of zkp proof

type ProofMetadata

type ProofMetadata struct {
	AuthData       *AuthenticationMetadata `json:"auth_data,omitempty"`
	AdditionalData map[string]interface{}  `json:"additional_data,omitempty"`
}

ProofMetadata defines basic metadata that can be retrieved from any proof

type ProofType

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

func (p ProofType) String() string

type ProtocolMessage

type ProtocolMessage string

ProtocolMessage is type for protocol messages

type SignatureProof

type SignatureProof struct {
	Type      ProofType `json:"type"`
	KeyType   string    `json:"key_type"`
	Signature string    `json:"signature"`
	Challenge string    `json:"challenge"`
	ProofMetadata
	TypedScope `json:"-"`
}

SignatureProof represents structure of signature proof object

type SignatureProofRequest

type SignatureProofRequest struct {
	Rules   map[string]interface{} `json:"rules,omitempty"`
	KeyType string                 `json:"keyType,omitempty"`
	Format  string                 `json:"format,omitempty"`
	Message int                    `json:"message,omitempty"`
	Type    ProofType              `json:"type"`
	TypedScope
}

SignatureProofRequest represents structure for request of signature proof

type TypedScope

type TypedScope interface {
	GetType() ProofType
}

TypedScope is interface that restricts objects that can be used for scope in authorization request

type VerificationKeyJSON

type VerificationKeyJSON string

VerificationKeyJSON describes type verification key in JSON format

type ZeroKnowledgeProof

type ZeroKnowledgeProof struct {
	Type        ProofType          `json:"type"`
	CircuitID   circuits.CircuitID `json:"circuit_id"`
	PubSignals  []string           `json:"pub_signals"`
	ProofData   *ProofData         `json:"proof_data"`
	CircuitData *CircuitData       `json:"circuit_data,omitempty"`
	ProofMetadata
	TypedScope `json:"-"`
}

ZeroKnowledgeProof represents structure of zkp object

type ZeroKnowledgeProofRequest

type ZeroKnowledgeProofRequest struct {
	CircuitID  circuits.CircuitID     `json:"circuit_id,omitempty"`
	Type       ProofType              `json:"type"`
	Rules      map[string]interface{} `json:"rules,omitempty"`
	TypedScope `json:"-"`
}

ZeroKnowledgeProofRequest represents structure for request of zkp proof

Jump to

Keyboard shortcuts

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