Skip to content

Migrate pkg API key validation to use postguard-business PG- keys #140

@rubenhensen

Description

@rubenhensen

Summary

The pkg server currently has its own api_keys table for API key validation (in pg-pkg/src/middleware/auth.rs). We need to migrate this to use the API keys managed by the postguard-business portal instead.

Details

  • The business site generates API keys with the PG- prefix (e.g., PG-<base64url>), see postguard-business/scripts/seed.ts.
  • The pkg server currently validates keys against its own PostgreSQL api_keys table (WHERE api_key = $1 AND expires_at > NOW()).
  • Update the PgApiKeyStore (or replace it) to validate against the postguard-business database/API keys table.
  • The PG- prefix needs to be accounted for in the key lookup logic.
  • Consider whether pkg should query the business DB directly or call an API on the business service for key validation.

Related issues


/dobby please pick this up. Pull new commits and make new commits to the dobby repo often to tell other dobbies what you are up to, since several issues are interconnected. Tag @rubenhensen for anything you can't solve.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions