Problem
src/orb/broker.ts already solves "prove installation ownership, then mint/cache a short-lived secret" — but it's GitHub-token-specific as written: orb_enrollments has no secret_type/kind column, brokerOrbToken's return shape is hardcoded to GitHub's { token, expiresAt, permissions }, and the mint call is GitHub's installation-token endpoint specifically (confirmed by direct code read). Hosted ORB and AMS both need to broker more than GitHub tokens — AI-provider keys at minimum, DB credentials once #7173's storage migration lands.
Area
src/orb/broker.ts, src/orb/oauth.ts, migrations/ (new column on orb_enrollments or a new table).
Proposal
Add a secret_type discriminator and a pluggable per-type mint/refresh strategy, keeping the parts that are already generic unchanged: the admin-ownership proof (verifyInstallationAdmin), the opaque-secret issuance + hash-storage pattern (createOpaqueToken/hashToken), and the AES-256-GCM cache encryption (encryptSecret/decryptSecret) all carry over as-is. Only the mint/refresh call and the returned shape need to become type-aware.
Deliverables
Boundaries
Links & Resources
Problem
src/orb/broker.tsalready solves "prove installation ownership, then mint/cache a short-lived secret" — but it's GitHub-token-specific as written:orb_enrollmentshas nosecret_type/kindcolumn,brokerOrbToken's return shape is hardcoded to GitHub's{ token, expiresAt, permissions }, and the mint call is GitHub's installation-token endpoint specifically (confirmed by direct code read). Hosted ORB and AMS both need to broker more than GitHub tokens — AI-provider keys at minimum, DB credentials once #7173's storage migration lands.Area
src/orb/broker.ts,src/orb/oauth.ts,migrations/(new column onorb_enrollmentsor a new table).Proposal
Add a
secret_typediscriminator and a pluggable per-type mint/refresh strategy, keeping the parts that are already generic unchanged: the admin-ownership proof (verifyInstallationAdmin), the opaque-secret issuance + hash-storage pattern (createOpaqueToken/hashToken), and the AES-256-GCM cache encryption (encryptSecret/decryptSecret) all carry over as-is. Only the mint/refresh call and the returned shape need to become type-aware.Deliverables
secret_typecolumn onorb_enrollments(or equivalent), migration includedBoundaries
Links & Resources
src/orb/broker.ts,src/orb/oauth.ts,src/orb/app-auth.ts