Documentation
¶
Index ¶
- func GetValidationOption(opts []Option, id OptionKey) (any, error)
- func ValidateCredential(cred credential.VerifiableCredential, _ ...Option) error
- func ValidateExpiry(cred credential.VerifiableCredential, _ ...Option) error
- func ValidateJSONSchema(cred credential.VerifiableCredential, opts ...Option) error
- type CredentialValidator
- type Option
- type OptionKey
- type Validate
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetValidationOption ¶
GetValidationOption returns a validation option given an ID
func ValidateCredential ¶
func ValidateCredential(cred credential.VerifiableCredential, _ ...Option) error
ValidateCredential verifies a credential's object model depending on the struct tags used on VerifiableCredential
func ValidateExpiry ¶
func ValidateExpiry(cred credential.VerifiableCredential, _ ...Option) error
ValidateExpiry verifies a credential's expiry date is not in the past. We assume the date is parseable as an RFC3339 date time value.
func ValidateJSONSchema ¶
func ValidateJSONSchema(cred credential.VerifiableCredential, opts ...Option) error
ValidateJSONSchema verifies a credential's data against a Verifiable Credential JSON Schema There is a required single option which is a string JSON value representing the Credential Schema Object
Types ¶
type CredentialValidator ¶
type CredentialValidator struct {
// contains filtered or unexported fields
}
func NewCredentialValidator ¶
func NewCredentialValidator(validators []Validator) (*CredentialValidator, error)
NewCredentialValidator creates a new credential validator which executes in the order of the validators provided The validators introspect the contents of the credential, and do not handle signature verification.
func (*CredentialValidator) ValidateCredential ¶
func (cv *CredentialValidator) ValidateCredential(cred credential.VerifiableCredential, opts ...Option) error
ValidateCredential validates a credential given a credential validator
type Option ¶
Option represents a single option that may be required for a validator
func WithSchema ¶
WithSchema provides a schema as a validation option
type OptionKey ¶
type OptionKey string
OptionKey uniquely represents an option to be used in a validator
const (
SchemaOption OptionKey = "schema"
)
type Validate ¶
type Validate func(cred credential.VerifiableCredential, opts ...Option) error