Versions in this module Expand all Collapse all v1 v1.0.1 Sep 13, 2023 Changes in this version type Rune + func (r *Rune) Clone() (*Rune, error) v1.0.0 Aug 31, 2023 Changes in this version + var ErrCondValueTypeMismatch = errors.New("condition and test value type mismatch") + var ErrExtraChars = errors.New("restriction has extra ending characters") + var ErrFieldIsPresent = errors.New("field is present") + var ErrForbiddenValue = errors.New("forbidden value") + var ErrIdFieldForbidden = errors.New("unique_id fiield not valid here") + var ErrIdFieldHasAlts = errors.New("unique_id field can't have alternatives") + var ErrIdHasHyphens = errors.New("hyphen not allowed in unique_id") + var ErrIdUknownVersion = errors.New("unique_id unknown version") + var ErrInvalidCondition = errors.New("condition not valid") + var ErrInvalidField = errors.New("field not valid") + var ErrInvalidRunePrefix = errors.New("rune strings must start with 64 hex digits then '-'") + var ErrInvalidUniqueIdCond = errors.New("unique_id condition must be '='") + var ErrInvalidValuePrefix = errors.New("value has invalid perfix") + var ErrInvalidValueSuffix = errors.New("value has invalid suffix") + var ErrMissingField = errors.New("missing field in test") + var ErrNoOperator = errors.New("restriction contains no operator") + var ErrNoRestrictions = errors.New("no restrictions") + var ErrSecretTooLarge = errors.New("secret too large") + var ErrUnauthorizedRune = errors.New("unauthorized rune") + var ErrValueDoesntContain = errors.New("value does not contain substring") + var ErrValueTooLarge = errors.New("value too large") + var ErrValueTooSmall = errors.New("value too small") + var ErrWrongLexicOrder = errors.New("wrong lexicographical order") + var Punctuation = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~" + func EndShastream(length int) []byte + type Alternative struct + Condition string + Field string + Value string + func NewAlternative(field, cond, value string, allowIdField bool) (*Alternative, error) + func (a *Alternative) String() string + func (a *Alternative) Test(tests map[string]Test) error + type Restriction []*Alternative + func RestrictionFromString(encodedString string, allowIdField bool) (Restriction, error) + func UniqueIdRestriction(id, version string) (Restriction, error) + func (r Restriction) String() string + func (r Restriction) Test(tests map[string]Test) error + type Rune struct + Restrictions []Restriction + func NewMasterRune(secret []byte, id, version string) (*Rune, error) + func NewRuneFromAuthbase(authbase []byte, uniqueId, version string, restrictions []Restriction) (*Rune, error) + func RuneFromAuthcode(authcode []byte, restrictions []Restriction) (*Rune, error) + func RuneFromEncodedString(encodedString string) (*Rune, error) + func RuneFromString(runeString string) (*Rune, error) + func (r *Rune) AddRestriction(restriction Restriction) error + func (r *Rune) AreRestrictionsMet(tests map[string]Test) error + func (r *Rune) Authcode() []byte + func (r *Rune) Check(encodedRune string, tests map[string]Test) error + func (r *Rune) Encode() string + func (r *Rune) IsRuneAuthorized(otherRune *Rune) bool + func (r *Rune) String() string + type Test struct + TestFunc TestFunc + Value interface{} + type TestFunc func(alt *Alternative, v interface{}) error + var StandardTestFunc TestFunc = func(alt *Alternative, v interface{}) error { ... }