Skip to content

feat(bry-medical): add BRy Medical Signature/KMS endpoints - #14

Merged
rluders merged 2 commits into
mainfrom
feature/bry-medical-kms
Sep 1, 2026
Merged

feat(bry-medical): add BRy Medical Signature/KMS endpoints#14
rluders merged 2 commits into
mainfrom
feature/bry-medical-kms

Conversation

@rluders

@rluders rluders commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds POST /bry-kms/chaves/{uuidChave}/autorizacoes (pré-autorização) and POST /bry-medical/fw/v1/pdf/kms/lote/assinaturas (HUB Signer medical PDF signing) to simulate BRy's Medical Signature/KMS flow.
  • New internal/providers/brymedical/ package, DB-backed pré-autorização token store (new migration 0005_bry_medical.sql) with real wall-clock TTL expiry, registered alongside the existing providers in providers.go.
  • Contract derived from golgimed's bry_medical.go/bry_medical_test.go adapter code and BRy's KMS/HUB Signer OpenAPI specs, cross-checked for discrepancies (all confirmed harmless since golgimed's adapter never parses BRy error bodies).
  • Existing BRy SCAD, IntegraICP, SNCR, and Zenvia providers are untouched — go test -race ./... passes (124/124, no regressions).

Verified end-to-end against a locally built image: golgimed's real BRy adapter (PreAuthorizeSignWithPreAuthToken) run against a running Mimic container built from this branch, alongside the existing SCAD/VIDaaS/SNCR Mimic integration tests.

Test plan

  • go build ./..., go vet ./..., gofmt -l . clean
  • go test -race ./... — 124/124 pass, no regressions to SCAD/IntegraICP/SNCR/Zenvia
  • New tests/brymedical/*_test.go — pré-autorização success/missing-credential/bearer, signing success (TIMESTAMP/COMPLETE), unsupported profile, unknown/expired token, malformed request, missing kms_type header, fault-injected provider failure
  • Docker build (docker build -f docker/Dockerfile) verified locally
  • Live end-to-end: golgimed's real bry adapter against a running container of this branch — pré-autorização + medical signing both succeed

…gning endpoints

Adds POST /bry-kms/chaves/{uuidChave}/autorizacoes and POST
/bry-medical/fw/v1/pdf/kms/lote/assinaturas to simulate BRy's
Medical Signature/KMS flow (pré-autorização + HUB Signer medical
PDF signing), so golgimed's BRy Medical adapter can be exercised
locally against a real Mimic instance instead of only httptest
doubles.

Follows the existing provider convention (one package under
internal/providers/, DB-backed Store, requireBearer + fault-hook
middleware). Pré-autorização tokens are tracked in a new SQLite
table with real wall-clock expiry — no fake-clock machinery, tests
use short TTLs. Contract derived from golgimed's bry_medical.go /
bry_medical_test.go and BRy's KMS/HUB Signer OpenAPI specs.

Existing SCAD, IntegraICP, SNCR, and Zenvia providers are untouched.
@sonarqubecloud

sonarqubecloud Bot commented Sep 1, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
3.2% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@rluders
rluders merged commit 25ca1f2 into main Sep 1, 2026
2 of 3 checks passed
@rluders
rluders deleted the feature/bry-medical-kms branch September 1, 2026 01:07
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