mirror of
https://github.com/hanzoai/iam.git
synced 2026-11-19 18:37:16 +00:00
A Cert ROW is the key's IDENTITY — owner, name (the JWKS `kid`), algorithm, expiry — and identity is public: the JWKS publishes it. The private half is `json:"-"`, and since every orm backend persists an entity as json.Marshal(entity), that tag IS the storage contract: no write path reaches a column with it, and the API neither serves nor accepts it. internal/keyring holds the material for the life of the process and fills it on load. ONE source, and only one: a directory of PEM files, one per Cert name, at $IAM_SIGNING_KEYS — the shape both of the estate's KMS readers already deliver, so something else performs the KMS read and iam holds no KMS credential. A cert under a reserved signing owner is the only kind ever given a key, because material is addressed by name and the name is the `kid`. Resolution is fail-closed. With nothing mounted a Cert resolves to no key and the token endpoint refuses. A dev box mounts a PEM like every other deployment does; nothing mints one in process, so two replicas of one image either hold the same key or hold none, never different keys under one `kid`. The seed therefore files cert METADATA and stops there. Everything downstream — the signer, the verifier, the JWKS, the session-cookie key — reads cert.PrivateKey off the value the store hands it, exactly as before. A deployment MUST mount $IAM_SIGNING_KEYS with one PEM per signing cert name before this rolls; a process that resolves no key refuses to serve. Co-authored-by: Hanzo Dev <[email protected]>