Versions in this module Expand all Collapse all v0 v0.0.1 Apr 6, 2022 Changes in this version + var ErrChallengeExpired = fmt.Errorf("challenge expired") + var ErrExtInvalid = fmt.Errorf("extension sum invalid") + var ErrHashcashEmpty = fmt.Errorf("hashcash empty") + var ErrMaxIterationsExceeded = fmt.Errorf("max iterations exceeded") + var ErrWrongChallenge = fmt.Errorf("wrong challenge") + var ErrWrongResource = fmt.Errorf("wrong resource") + type ExtGeneratorFunc func(*Hashcach) (string, error) + func SignExt(secret string, hasher hash.Hasher) ExtGeneratorFunc + type ExtValidatorFunc func(*Hashcach) error + func VerifyExt(secret string, hasher hash.Hasher) ExtValidatorFunc + type Hashcach struct + Bits int32 + Counter int64 + Date time.Time + Ext string + Rand []byte + Resource string + Version int32 + func InitHashcash(bits int32, resource string, extGenerator ExtGeneratorFunc) (*Hashcach, error) + func NewHashcach(version int32, bits int32, date time.Time, resource string, ext string, ...) *Hashcach + func (h *Hashcach) String() string + type Options func(*options) + func WithChallengeExpDuration(callback time.Duration) Options + func WithValidateExtFunc(callback ExtValidatorFunc) Options + type POW struct + func New(s hash.Hasher, opts ...Options) *POW + func (p *POW) Compute(ctx context.Context, h *Hashcach, max int64) (*Hashcach, error) + func (p *POW) Verify(h *Hashcach, resource string) error