Versions in this module Expand all Collapse all v0 v0.1.1 Oct 20, 2026 v0.1.0 Oct 20, 2026 Changes in this version + const GenesisKind + const V1 + var ErrBrokenLink = errors.New("prev hash does not match previous entry") + var ErrCheckpointMismatch = errors.New("checkpoint hash mismatch") + var ErrEncoding = errors.New("entry cannot be encoded") + var ErrGenesis = errors.New("invalid genesis entry") + var ErrHashMismatch = errors.New("hash mismatch") + var ErrKindTooLong = errors.New("hashchain: kind longer than 2^32-1 bytes") + var ErrMalformed = errors.New("hashchain: malformed v1 encoding") + var ErrPayloadTooLong = errors.New("hashchain: payload longer than 2^32-1 bytes") + var ErrPrevHashTooLong = errors.New("hashchain: prev hash longer than 255 bytes") + var ErrSequence = errors.New("sequence gap or reorder") + var ErrTruncated = errors.New("chain truncated") + var ErrUnknownVersion = errors.New("unknown encoding version") + func AppendV1(dst []byte, e *Entry) ([]byte, error) + type Chain struct + func New(store Store, cfg Config) (*Chain, error) + func (c *Chain) Append(ctx context.Context, rec Record) (Entry, error) + func (c *Chain) AppendBatch(ctx context.Context, recs ...Record) ([]Entry, error) + func (c *Chain) Head(ctx context.Context) (Checkpoint, error) + func (c *Chain) Verify(ctx context.Context) (Report, error) + func (c *Chain) VerifyFrom(ctx context.Context, cp Checkpoint) (Report, error) + func (c *Chain) VerifyRange(ctx context.Context, from, to uint64) (Report, error) + type Checkpoint struct + Hash []byte + Seq uint64 + func (c Checkpoint) IsZero() bool + type Codec interface + AppendPreimage func(dst []byte, e *Entry) ([]byte, error) + Version func() uint8 + type Config struct + Codec Codec + ExtraCodecs []Codec + Hash crypto.Hash + Key []byte + Name string + NoGenesis bool + Now func() time.Time + type Entry struct + Hash []byte + Kind string + Payload []byte + PrevHash []byte + Seq uint64 + Time time.Time + Version uint8 + func DecodeV1(b []byte) (Entry, error) + func (e *Entry) Clone() Entry + type HashMatcher interface + MatchHash func(e *Entry, sum func(preimage []byte) []byte) (bool, error) + type MemoryStore struct + func NewMemoryStore() *MemoryStore + func (s *MemoryStore) Append(ctx context.Context, build func(head *Entry) ([]Entry, error)) error + func (s *MemoryStore) Head(ctx context.Context) (*Entry, error) + func (s *MemoryStore) Len() int + func (s *MemoryStore) Scan(ctx context.Context, from, to uint64, fn func(*Entry) error) error + type Record struct + Kind string + Payload []byte + Time time.Time + type Report struct + Entries uint64 + First Checkpoint + Last Checkpoint + type Store interface + Append func(ctx context.Context, build func(head *Entry) ([]Entry, error)) error + Head func(ctx context.Context) (*Entry, error) + Scan func(ctx context.Context, from, to uint64, fn func(*Entry) error) error + type V1Codec struct + func (V1Codec) AppendPreimage(dst []byte, e *Entry) ([]byte, error) + func (V1Codec) Version() uint8 + type VerifyError struct + Actual []byte + Detail string + Err error + Expected []byte + Reason error + Seq uint64 + func (e *VerifyError) Error() string + func (e *VerifyError) Unwrap() []error