Versions in this module Expand all Collapse all v0 v0.0.1 Jan 27, 2023 Changes in this version + const ChunkSize + const Magic256 + const OutputSize + var ErrInvalidRune = errors.New("invalid rune") + var ErrTooLongSecret = errors.New("too long secret") + var ErrTooShortSecret = errors.New("too short secret") + var ErrUnauthorizedRune = errors.New("unauthorized rune") + var KnownConditions = []string + type Alternative struct + Cond string + Field string + Value any + func MakeAlternative(field string, cond string, value any, allowIDField bool) (*Alternative, error) + func MakeAlternativeFromString(str string, allowIDField bool) (*Alternative, string, error) + func (a *Alternative) Evaluate(vals map[string]any) (bool, string) + func (a *Alternative) IsUniqueID() bool + func (a *Alternative) String() string + type Marshaller interface + MarshalBinary func() ([]byte, error) + UnmarshalBinary func([]byte) error + type MasterRune struct + SeedSecret []byte + func MakeMasterRune(seedsecret []byte, uniqueid, version any, restrictions []Restriction) (*MasterRune, error) + func MustMakeMasterRune(seedsecret []byte) MasterRune + func (r *MasterRune) Check(rune *Rune, vals map[string]any) error + func (r *MasterRune) IsRuneAuthorized(other *Rune) bool + type MidState struct + H [8]uint32 + Len uint64 + func (state *MidState) GetSum() [OutputSize]byte + type ObtainValue func() any + type Restriction struct + Alternatives []Alternative + func MakeRestriction(alternatives []Alternative) (*Restriction, error) + func MakeRestrictionFromString(str string, allowIDField bool) (*Restriction, string, error) + func MakeRestrictionsFromString(str string) ([]Restriction, error) + func MustMakeRestrictionsFromString(str string) []Restriction + func UniqueID(uniqueID any, version any) (*Restriction, error) + func (r *Restriction) Evaluate(vals map[string]any) (bool, string) + func (r *Restriction) String() string + type Rune struct + Restrictions []Restriction + Sha256 *Sha256 + func FromAuthCode(authcode []byte, restrictions []Restriction) (*Rune, error) + func FromBase64(str string) (*Rune, error) + func FromString(str string) (*Rune, error) + func MakeRune(authbase []byte, uniqueid, version any, restrictions []Restriction) (*Rune, error) + func MustGetFromBase64(str string) Rune + func MustGetFromString(str string) Rune + func (r *Rune) AddRestriction(restriction Restriction) error + func (r *Rune) Check(vals map[string]any) error + func (r *Rune) Evaluate(vals map[string]any) (bool, string) + func (r *Rune) GetAuthCode() []byte + func (r *Rune) GetRestricted(restrictions ...Restriction) (*Rune, error) + func (r *Rune) GetUniqueID() int + func (r *Rune) GetVersion() int + func (r *Rune) MustGetRestrictedFromString(str string) Rune + func (r *Rune) String() string + func (r *Rune) ToBase64() string + func (r *Rune) ToBase64Internal(trim bool) string + type Sha256 struct + func NewSha256() *Sha256 + func (s *Sha256) AddPadding() error + func (s *Sha256) GetLen() uint64 + func (s *Sha256) GetMidState() *MidState + func (s *Sha256) GetSum() [OutputSize]byte + func (s *Sha256) Reset() + func (s *Sha256) SetLen(len uint64) + func (s *Sha256) SetMidState(state *MidState) error + func (s *Sha256) Write(p []byte) (nn int, err error)