Versions in this module Expand all Collapse all v0 v0.1.2 Oct 29, 2026 v0.1.1 Oct 29, 2026 v0.1.0 Oct 28, 2026 Changes in this version + const DefaultBoxCache + const ReceiveCeiling + var ErrExists = errors.New("already exists") + var ErrKeyRefused = errors.New("the adopt key is spent, expired or revoked") + var ErrNotFound = errors.New("not found") + var ErrStale = errors.New("the record changed since it was read") + var ErrUnknown = errors.New("the write may have been applied") + func AWSLogger(w io.Writer) logging.Logger + func HTTPServer(addr string, h http.Handler, l Limits, idle time.Duration) *http.Server + func IsThrottle(err error) bool + func NewAccountID() (string, error) + func NewAdoptKey(account string) (string, [32]byte, error) + func Redacting(w io.Writer) io.Writer + func SiteBackend(raw string) (*url.URL, error) + type Account struct + ID string + Rev uint64 + Unmetered bool + func NewAccount(id string, unmetered bool) (*Account, error) + type AdoptKey struct + Account string + Expires time.Time + Hash [32]byte + Uses int + type Backend interface + Account func(ctx context.Context, id string) (*Account, error) + Adopt func(ctx context.Context, b *Box, account string, key [32]byte) error + AdoptKey func(ctx context.Context, account string, hash [32]byte) (*AdoptKey, error) + CreateAccount func(ctx context.Context, a *Account) error + CreateBox func(ctx context.Context, b *Box) error + Dedupe func(ctx context.Context, box protocol.Address, id [32]byte) (*Header, error) + DeleteAll func(ctx context.Context, box protocol.Address, ...) error + DeleteBox func(ctx context.Context, a protocol.Address) error + DeleteMessage func(ctx context.Context, box protocol.Address, id [32]byte) (time.Time, error) + Leave func(ctx context.Context, b *Box) error + List func(ctx context.Context, box protocol.Address, after *Cursor, limit int) ([]Header, error) + Message func(ctx context.Context, box protocol.Address, id [32]byte, from int64) (*Header, []byte, error) + PutAdoptKey func(ctx context.Context, k *AdoptKey) error + PutMessage func(ctx context.Context, box protocol.Address, h *Header, body []byte) error + ReadAddress func(ctx context.Context, a protocol.Address) (*Box, *Revocations, error) + ReadLive func(ctx context.Context, box protocol.Address) ([]Header, error) + Ready func() bool + Retire func(ctx context.Context, box protocol.Address, id [32]byte) (time.Time, error) + Revoke func(ctx context.Context, a protocol.Address, rv *Revocations, want Expect) (*Revocations, error) + Start func(ctx context.Context, apply func(Change)) error + UpdateBox func(ctx context.Context, b *Box) error + type Box struct + ACL *protocol.ACL + Account string + Addr protocol.Address + Cert [32]byte + CertSerial uint64 + Created time.Time + Expires time.Time + Identity []byte + Prekey *protocol.Prekey + Retired []Retired + Rev uint64 + Revocation []byte + RevokedCerts []byte + RevokedCertsSig []byte + SenderKeyTypes []string + Signature []byte + State State + Statement []byte + type Change struct + Account *Account + AccountID string + Addr protocol.Address + Box *Box + Err error + Gone bool + Header *Header + Kind ChangeKind + Live bool + Revocations *Revocations + type ChangeKind int + const AccountChange + const MessageChange + const RecordChange + const RevocationsChange + func (k ChangeKind) String() string + type Config struct + IdentityTypes []string + Limits Limits + Log *log.Logger + Metrics *Metrics + Names []string + Now func() time.Time + Ready func() bool + SiteBackend *url.URL + Store Store + TrustedProxies []netip.Prefix + type Cursor struct + ID [32]byte + ReceivedAt time.Time + type DynamoConfig struct + AWS aws.Config + AccountsTable string + BoxCache int + BoxesTable string + Bucket string + ConsistentReads bool + Fatal func(error) + Log *log.Logger + Metrics *Metrics + MsgsTable string + Now func() time.Time + StreamInterval time.Duration + type Expect int + const ExpectAnything + const ExpectHeld + const ExpectNone + type Header struct + ExpiresAt time.Time + ID [32]byte + ReceivedAt time.Time + Size int + type Indebted struct + FullIn int64 + Key string + type Limits struct + ACLEntries int + AccountMaxSize int + BodyMinRate int + BodyTimeout time.Duration + BoxCap int + CallBurst int + CallRefill time.Duration + CertificateRevocationsPerDay int + CertificatesPerDay int + DrainBurst int + DrainRefill time.Duration + HeadBytes int + HeadTimeout time.Duration + HoldMax time.Duration + Holds int + MaxSize int + MissesPerMinute int + PollAfter int + PollBurst int + PollRefill time.Duration + RangeRegistrationsPerHour int + ReceiveBurst int + ReceiveRefill time.Duration + RegistrationsPerHour int + RenewalsPerDay int + RequestBurst int + RequestRefill time.Duration + RetiredKept int + SendsPerDay int + SendsPerMinutePerIP int + func DefaultLimits() Limits + type Memory struct + func NewDynamoStore(c DynamoConfig) *Memory + func NewMemStore(now func() time.Time) *Memory + func (s *Memory) Account(ctx context.Context, id string) (*Account, error) + func (s *Memory) Adopt(ctx context.Context, b *Box, account string, key [32]byte) error + func (s *Memory) AdoptKey(ctx context.Context, account string, hash [32]byte) (*AdoptKey, error) + func (s *Memory) After(ctx context.Context, box protocol.Address, c *Cursor) (int, error) + func (s *Memory) Begin(a protocol.Address) uint64 + func (s *Memory) Box(ctx context.Context, a protocol.Address) (*Box, error) + func (s *Memory) Changed(a protocol.Address) <-chan struct{} + func (s *Memory) Count(ctx context.Context, box protocol.Address) (int, error) + func (s *Memory) CreateAccount(ctx context.Context, a *Account) error + func (s *Memory) CreateBox(ctx context.Context, b *Box) error + func (s *Memory) Dedupe(ctx context.Context, box protocol.Address, id [32]byte) (*Header, error) + func (s *Memory) DeleteBox(ctx context.Context, a protocol.Address) error + func (s *Memory) DeleteMessage(ctx context.Context, box protocol.Address, id [32]byte) error + func (s *Memory) DeleteMessages(ctx context.Context, box protocol.Address) error + func (s *Memory) Fetched(ctx context.Context, box protocol.Address, id [32]byte) (held, again bool, err error) + func (s *Memory) Held(a protocol.Address) (Standing, bool) + func (s *Memory) Holds(ctx context.Context, box protocol.Address, id [32]byte) (bool, error) + func (s *Memory) Known(a protocol.Address) (*Box, bool) + func (s *Memory) Leave(ctx context.Context, b *Box) error + func (s *Memory) List(ctx context.Context, box protocol.Address, after *Cursor, limit int) ([]Header, error) + func (s *Memory) Message(ctx context.Context, box protocol.Address, id [32]byte, from int64) (*Header, []byte, error) + func (s *Memory) PutAdoptKey(ctx context.Context, k *AdoptKey) error + func (s *Memory) PutMessage(ctx context.Context, box protocol.Address, h *Header, body []byte) (*Header, error) + func (s *Memory) Ready() bool + func (s *Memory) Revoke(ctx context.Context, a protocol.Address, rv *Revocations, want Expect) error + func (s *Memory) Start(ctx context.Context) error + func (s *Memory) UpdateBox(ctx context.Context, b *Box) error + type Metrics struct + func NewMetrics(reg prometheus.Registerer) *Metrics + func (m *Metrics) ConnState(_ net.Conn, st http.ConnState) + func (m *Metrics) InstrumentAWS(cfg *aws.Config) + type Retired struct + KeyHash [32]byte + NotAfter time.Time + Type protocol.KeyType + type Revocations struct + Address []byte + Certs []byte + CertsSig []byte + Identity []byte + Through uint64 + type Server struct + func New(c Config) *Server + func (s *Server) AdminHandler() http.Handler + func (s *Server) ClearAddress(ip string) (key string, cleared []string, ok bool) + func (s *Server) Handler() http.Handler + func (s *Server) StopHolds() + func (s *Server) Top(name string, n int) (top []Indebted, ok bool) + type Standing struct + Cert [32]byte + CertSerial uint64 + InAccount bool + Key string + Listed bool + State State + type State string + const Active + const NoBox + const Revoked + type Store interface + Account func(ctx context.Context, id string) (*Account, error) + Adopt func(ctx context.Context, b *Box, account string, key [32]byte) error + AdoptKey func(ctx context.Context, account string, hash [32]byte) (*AdoptKey, error) + After func(ctx context.Context, box protocol.Address, c *Cursor) (int, error) + Begin func(a protocol.Address) uint64 + Box func(ctx context.Context, a protocol.Address) (*Box, error) + Changed func(a protocol.Address) <-chan struct{} + Count func(ctx context.Context, box protocol.Address) (n int, err error) + CreateAccount func(ctx context.Context, a *Account) error + CreateBox func(ctx context.Context, b *Box) error + Dedupe func(ctx context.Context, box protocol.Address, id [32]byte) (*Header, error) + DeleteBox func(ctx context.Context, a protocol.Address) error + DeleteMessage func(ctx context.Context, box protocol.Address, id [32]byte) error + DeleteMessages func(ctx context.Context, box protocol.Address) error + Fetched func(ctx context.Context, box protocol.Address, id [32]byte) (held, again bool, err error) + Held func(a protocol.Address) (st Standing, ok bool) + Holds func(ctx context.Context, box protocol.Address, id [32]byte) (bool, error) + Known func(a protocol.Address) (b *Box, ok bool) + Leave func(ctx context.Context, b *Box) error + List func(ctx context.Context, box protocol.Address, after *Cursor, limit int) ([]Header, error) + Message func(ctx context.Context, box protocol.Address, id [32]byte, from int64) (*Header, []byte, error) + PutAdoptKey func(ctx context.Context, k *AdoptKey) error + PutMessage func(ctx context.Context, box protocol.Address, h *Header, body []byte) (*Header, error) + Revoke func(ctx context.Context, a protocol.Address, rv *Revocations, want Expect) error + UpdateBox func(ctx context.Context, b *Box) error