Skip to content

Parametrize the email attribute type (pbdf.sidn-pbdf.email.email hardcoded across pg-js, cryptify, PKG) #236

Description

@rubenhensen

Finding from building the e2e golden flow (#205): the production email attribute type pbdf.sidn-pbdf.email.email is hardcoded in (at least) three layers:

  • postguard-js src/recipients/builders.ts — every recipient policy starts from the pbdf email attribute; there is no way to build a recipient for another attribute type
  • cryptify src/main.rs (~line 828) — finalize rejects any upload whose sender identity lacks exactly pbdf.sidn-pbdf.email.email ("no email attribute")
  • pg-pkg src/middleware/auth.rs (~lines 277-299) — the API-key signing identity is built with hardcoded pbdf attribute types

Why this matters:

  1. Testability. No test environment can issue pbdf credentials (the issuer private keys are production secrets). The e2e harness therefore cannot drive the real @e4a/pg-js decrypt path and had to re-implement the client flow against test-scheme attributes, with API-key signing as a workaround for cryptify's sender check. Un-hardcoding this unblocks testing the real SDKs end to end (see Phase 2).
  2. Environment parity. Staging/test and production could run identical code paths, differing only in configuration.
  3. Scheme evolution. Any future change of the email attribute (scheme rename, EUDI migration) currently requires coordinated code changes in 3+ repos — exactly the "fix one thing, three others break" pattern this EPIC exists to kill.

Suggestion. Make the email attribute type a configuration value: an option in pg-js (PostGuard({emailAttribute?: ...}) or a generic recipient builder), a config key in cryptify, and a config/env value in the PKG. Default everywhere stays pbdf.sidn-pbdf.email.email.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestrepo:cryptifyTouches the cryptify reporepo:postguardTouches the postguard reporepo:sdkTouches the sdk repo

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions