conditions

package
v0.0.0-...-55a0270 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvalConditions

func EvalConditions(scope Scope, conditions []Condition) (bool, error)

Types

type ComparisonValue

type ComparisonValue struct {
	Constant interface{} `json:"constant,omitempty" `
	Variable string      `json:"variable,omitempty"`
}

ComparisonValue is an AST node representing a value we're going to compare with: a constant, a variable, a moment in time or a calendar date.

type Condition

type Condition struct {
	Op              string          `json:"op"`
	CredentialValue CredentialValue `json:"credentialValue"`
	ComparisonValue ComparisonValue `json:"comparisonValue"`
	FailureMessage  string          `json:"failureMessage"`
}

Condition is a predicate condition on a credential attribute.

type CredentialValue

type CredentialValue struct {
	Data     string `json:"data,omitempty"`
	Metadata string `json:"metadata,omitempty"`
}

CredentialValue is an AST node that represents data on the credential.

type Evaler

type Evaler interface {
	Eval(scope Scope) value
}

type Scope

type Scope struct {
	Credential     credential.VerifiableCredential
	VariableValues map[string]interface{}
}

Scope represents all of the context needed to evaluate the condition.

Jump to

Keyboard shortcuts

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