Key lifecycle: lifetime limits by scope, rotation with overlap, kinds and expiry in the listing

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ilker ManapandClaude Opus 5.5 committed 2026-10-04 16:45:05 +02:00
1 parent 178964cf6a
commit 8866a1ea0f
14 files changed
+463 -5

No files matched your search

+5 -1
View File
@@ -168,7 +168,11 @@ func (s *DB) CreateKey(ctx context.Context, k Key) error {
if len(k.Hash) == 0 {
return errors.New("store: a key needs a hash")
}
_, err := s.db.ExecContext(ctx,
k, err := s.keyTTL(ctx, k)
if err != nil {
return err
}
_, err = s.db.ExecContext(ctx,
`INSERT INTO api_keys (`+keyColumns+`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
k.ID, k.Hash, k.Prefix, k.Name, nullString(k.ProjectID),
nullString(k.Band), nullString(k.RoutingProfile),