oficina / home Public

Clone
git clone https://amadan.net/oficina/home

Plain git — no account needed to clone.

Download

Download this file

1package home
2
3import (
4 "context"
5 "strings"
6 "time"
7
8 "github.com/keymaildev/signin"
9)
10
11// Keep Flow's address budget without retaining its readable key. IP keys stay
12// shared with /resolve's budget. The upstream blind-auth-store adapter can use
13// this same Limiter seam without changing the stored person identity.
14type blindSigninLimiter struct {
15 next signin.Limiter
16 pepper []byte
17}
18
19func (l blindSigninLimiter) Allow(ctx context.Context, key string, now time.Time, budget int) (bool, error) {
20 if address, ok := strings.CutPrefix(key, "addr:"); ok {
21 key = "addr:" + blindIndex(l.pepper, address)
22 }
23 return l.next.Allow(ctx, key, now, budget)
24}
25