Skip to content

feat: gestão de chaves de API com hash, escopos e rotação - #1

Merged
Ph20sr merged 1 commit into
mainfrom
feat/chaves-de-api
Oct 7, 2026
Merged

Ph20sr merged 1 commit into
mainfrom
feat/chaves-de-api

Conversation

@Ph20sr

@Ph20sr Ph20sr commented Oct 7, 2026

Copy link
Copy Markdown
Owner

O que entra

Gestão de chaves de API para PHP/PDO.

  • KeyFormat: prefixo, id público, segredo base62 sem viés de módulo e checksum CRC32; parse, mask e scanPattern
  • ApiKeys: create (o segredo aparece uma única vez), verify (com escopo opcional), revoke, rotate com período de carência, list e find
  • Só o hash fica no banco (HMAC-SHA256 com pepper opcional), comparado com hash_equals
  • Verification: motivo da rejeição para log e httpStatus() (401 ou 403)
  • ApiKey::can(): escopos com curinga (invoices:*, *)
  • CI do GitHub Actions (PHP 8.1 a 8.3)

Testes

10 testes com SQLite em memória e relógio controlado.

@Ph20sr
Ph20sr merged commit 808c791 into main Oct 7, 2026
3 checks passed
@Ph20sr
Ph20sr deleted the feat/chaves-de-api branch October 7, 2026 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant