Commit graph naco-api/internal/server/auth.go
Author SHA1 Message Date
c965eb51d3
refactor(server): type CDP private key as crypto.Signer
Store the CDP auth key as a crypto.Signer interface so ECDSA and Ed25519 keys
share one signing path, and detect raw base64 Ed25519 keys inline instead of a
separate helper.
2026-09-13 22:24:43 +00:00
fe22a9779f
Add comprehensive debugging for CDP auth 401 issue
Some checks failed
CI/CD Go Verification / build_and_test (push) Successful in 1m11s
Test Every Endpoint on Base Sepolia / test_endpoints (push) Failing after 1m40s
- Workflow: Debug CDP Secret Format step prints secret characteristics (length, newlines, first/last chars)
- check-facilitator: Added extensive debug logging:
  - Key name, secret length, first 80 chars
  - Literal vs actual newline detection
  - PEM block parsing (SEC1 vs PKCS8 detection)
  - Signing method used
  - JWT claims decoded from generated tokens
  - Full request/response logging
- auth.go: Added GetSigningMethod() for debugging
- All tests pass, gofmt/go vet clean
2026-09-05 00:25:59 +00:00
3287e15ac0
Fix CDP auth to match official SDK implementation
Some checks failed
Test Every Endpoint on Base Sepolia / test_endpoints (push) Failing after 1m31s
CI/CD Go Verification / build_and_test (push) Successful in 1m10s
- Proper key type detection: Ed25519 (base64, 64 bytes) vs EC (PEM)
- Fixed PKCS8 fallback - removed incorrect PKCS8->EdDSA path for EC keys
- Added 'iat' claim to match official SDK
- Added base64 import for Ed25519 key decoding
- Return proper errors instead of ignoring them in GetAuthHeaders
- Added unit tests for EC/Ed25519 keys, token generation, and auth headers
2026-09-04 23:37:00 +00:00
6f6b952e46
fix: handle single-line PEM with \n and make MATRIX optional
Some checks failed
CI/CD Go Verification / build_and_test (push) Successful in 1m0s
Test Every Endpoint on Base Sepolia / test_endpoints (push) Failing after 1m22s
- config: MATRIX_WEBHOOK_URL / MATRIX_SERVER_ID via os.Getenv (optional),
  keep hostname fallback for MatrixServerID, avoid Fatal when webhook
  not configured (test-endpoints omits it, webhook.go nil-safe)
- auth: NewCDPAuth converts literal \n to real newlines before
  pem.Decode, so Forgejo single-line secret
  -----BEGIN EC PRIVATE KEY-----\n... works while malformed
  still returns error and CI fails via log.Fatal (as required)
2026-09-04 00:46:26 +00:00
b655faca4a rewrite wrapper
migrate server from v1 to v2
2026-07-29 22:09:27 +00:00