@hilbras/keystone 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +53 -0
- package/LICENSE +21 -0
- package/README.md +691 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +144 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +68 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +118 -0
- package/dist/config.js.map +1 -0
- package/dist/container.d.ts +27 -0
- package/dist/container.d.ts.map +1 -0
- package/dist/container.js +14 -0
- package/dist/container.js.map +1 -0
- package/dist/db/index.d.ts +17 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +46 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/migrations/0000_skinny_ben_parker.sql +553 -0
- package/dist/db/migrations/0001_brief_joseph.sql +10 -0
- package/dist/db/migrations/0002_add_account_lockout.sql +3 -0
- package/dist/db/migrations/0003_steep_rachel_grey.sql +1 -0
- package/dist/db/migrations/0004_clever_bill_hollister.sql +20 -0
- package/dist/db/migrations/0005_steep_the_call.sql +2 -0
- package/dist/db/migrations/0006_ambitious_boomer.sql +17 -0
- package/dist/db/migrations/0007_greedy_vindicator.sql +40 -0
- package/dist/db/migrations/meta/0000_snapshot.json +2964 -0
- package/dist/db/migrations/meta/0001_snapshot.json +3031 -0
- package/dist/db/migrations/meta/0003_snapshot.json +3051 -0
- package/dist/db/migrations/meta/0004_snapshot.json +3163 -0
- package/dist/db/migrations/meta/0005_snapshot.json +3177 -0
- package/dist/db/migrations/meta/0006_snapshot.json +3270 -0
- package/dist/db/migrations/meta/0007_snapshot.json +3489 -0
- package/dist/db/migrations/meta/_journal.json +62 -0
- package/dist/db/schema.d.ts +3671 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +475 -0
- package/dist/db/schema.js.map +1 -0
- package/dist/db/seed.d.ts +2 -0
- package/dist/db/seed.d.ts.map +1 -0
- package/dist/db/seed.js +139 -0
- package/dist/db/seed.js.map +1 -0
- package/dist/di.d.ts +12 -0
- package/dist/di.d.ts.map +1 -0
- package/dist/di.js +56 -0
- package/dist/di.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +295 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/errors.d.ts +46 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/errors.js +78 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/result.d.ts +21 -0
- package/dist/lib/result.d.ts.map +1 -0
- package/dist/lib/result.js +22 -0
- package/dist/lib/result.js.map +1 -0
- package/dist/lib/webhookSignature.d.ts +11 -0
- package/dist/lib/webhookSignature.d.ts.map +1 -0
- package/dist/lib/webhookSignature.js +35 -0
- package/dist/lib/webhookSignature.js.map +1 -0
- package/dist/plugins/appContext.d.ts +4 -0
- package/dist/plugins/appContext.d.ts.map +1 -0
- package/dist/plugins/appContext.js +63 -0
- package/dist/plugins/appContext.js.map +1 -0
- package/dist/plugins/audit.d.ts +11 -0
- package/dist/plugins/audit.d.ts.map +1 -0
- package/dist/plugins/audit.js +23 -0
- package/dist/plugins/audit.js.map +1 -0
- package/dist/plugins/auth.d.ts +21 -0
- package/dist/plugins/auth.d.ts.map +1 -0
- package/dist/plugins/auth.js +190 -0
- package/dist/plugins/auth.js.map +1 -0
- package/dist/plugins/metrics.d.ts +8 -0
- package/dist/plugins/metrics.d.ts.map +1 -0
- package/dist/plugins/metrics.js +36 -0
- package/dist/plugins/metrics.js.map +1 -0
- package/dist/plugins/mtls.d.ts +14 -0
- package/dist/plugins/mtls.d.ts.map +1 -0
- package/dist/plugins/mtls.js +76 -0
- package/dist/plugins/mtls.js.map +1 -0
- package/dist/plugins/permissions.d.ts +9 -0
- package/dist/plugins/permissions.d.ts.map +1 -0
- package/dist/plugins/permissions.js +20 -0
- package/dist/plugins/permissions.js.map +1 -0
- package/dist/plugins/rateLimit.d.ts +20 -0
- package/dist/plugins/rateLimit.d.ts.map +1 -0
- package/dist/plugins/rateLimit.js +101 -0
- package/dist/plugins/rateLimit.js.map +1 -0
- package/dist/plugins/requestLogger.d.ts +4 -0
- package/dist/plugins/requestLogger.d.ts.map +1 -0
- package/dist/plugins/requestLogger.js +20 -0
- package/dist/plugins/requestLogger.js.map +1 -0
- package/dist/plugins/tracing.d.ts +3 -0
- package/dist/plugins/tracing.d.ts.map +1 -0
- package/dist/plugins/tracing.js +21 -0
- package/dist/plugins/tracing.js.map +1 -0
- package/dist/repositories/apiKey.d.ts +40 -0
- package/dist/repositories/apiKey.d.ts.map +1 -0
- package/dist/repositories/apiKey.js +122 -0
- package/dist/repositories/apiKey.js.map +1 -0
- package/dist/repositories/application.d.ts +13 -0
- package/dist/repositories/application.d.ts.map +1 -0
- package/dist/repositories/application.js +57 -0
- package/dist/repositories/application.js.map +1 -0
- package/dist/repositories/audit.d.ts +13 -0
- package/dist/repositories/audit.d.ts.map +1 -0
- package/dist/repositories/audit.js +26 -0
- package/dist/repositories/audit.js.map +1 -0
- package/dist/repositories/index.d.ts +10 -0
- package/dist/repositories/index.d.ts.map +1 -0
- package/dist/repositories/index.js +10 -0
- package/dist/repositories/index.js.map +1 -0
- package/dist/repositories/oidcConnection.d.ts +131 -0
- package/dist/repositories/oidcConnection.d.ts.map +1 -0
- package/dist/repositories/oidcConnection.js +59 -0
- package/dist/repositories/oidcConnection.js.map +1 -0
- package/dist/repositories/organization.d.ts +44 -0
- package/dist/repositories/organization.d.ts.map +1 -0
- package/dist/repositories/organization.js +145 -0
- package/dist/repositories/organization.js.map +1 -0
- package/dist/repositories/permission.d.ts +24 -0
- package/dist/repositories/permission.d.ts.map +1 -0
- package/dist/repositories/permission.js +133 -0
- package/dist/repositories/permission.js.map +1 -0
- package/dist/repositories/samlConnection.d.ts +107 -0
- package/dist/repositories/samlConnection.d.ts.map +1 -0
- package/dist/repositories/samlConnection.js +53 -0
- package/dist/repositories/samlConnection.js.map +1 -0
- package/dist/repositories/session.d.ts +73 -0
- package/dist/repositories/session.d.ts.map +1 -0
- package/dist/repositories/session.js +68 -0
- package/dist/repositories/session.js.map +1 -0
- package/dist/repositories/types.d.ts +155 -0
- package/dist/repositories/types.d.ts.map +1 -0
- package/dist/repositories/types.js +2 -0
- package/dist/repositories/types.js.map +1 -0
- package/dist/repositories/user.d.ts +40 -0
- package/dist/repositories/user.d.ts.map +1 -0
- package/dist/repositories/user.js +135 -0
- package/dist/repositories/user.js.map +1 -0
- package/dist/routes/admin/billing.d.ts +3 -0
- package/dist/routes/admin/billing.d.ts.map +1 -0
- package/dist/routes/admin/billing.js +31 -0
- package/dist/routes/admin/billing.js.map +1 -0
- package/dist/routes/admin/helpers.d.ts +36 -0
- package/dist/routes/admin/helpers.d.ts.map +1 -0
- package/dist/routes/admin/helpers.js +45 -0
- package/dist/routes/admin/helpers.js.map +1 -0
- package/dist/routes/admin/index.d.ts +3 -0
- package/dist/routes/admin/index.d.ts.map +1 -0
- package/dist/routes/admin/index.js +15 -0
- package/dist/routes/admin/index.js.map +1 -0
- package/dist/routes/admin/organizations.d.ts +3 -0
- package/dist/routes/admin/organizations.d.ts.map +1 -0
- package/dist/routes/admin/organizations.js +222 -0
- package/dist/routes/admin/organizations.js.map +1 -0
- package/dist/routes/admin/permissions.d.ts +3 -0
- package/dist/routes/admin/permissions.d.ts.map +1 -0
- package/dist/routes/admin/permissions.js +63 -0
- package/dist/routes/admin/permissions.js.map +1 -0
- package/dist/routes/admin/platform.d.ts +3 -0
- package/dist/routes/admin/platform.d.ts.map +1 -0
- package/dist/routes/admin/platform.js +294 -0
- package/dist/routes/admin/platform.js.map +1 -0
- package/dist/routes/admin/sso.d.ts +3 -0
- package/dist/routes/admin/sso.d.ts.map +1 -0
- package/dist/routes/admin/sso.js +97 -0
- package/dist/routes/admin/sso.js.map +1 -0
- package/dist/routes/admin/webhooks.d.ts +3 -0
- package/dist/routes/admin/webhooks.d.ts.map +1 -0
- package/dist/routes/admin/webhooks.js +68 -0
- package/dist/routes/admin/webhooks.js.map +1 -0
- package/dist/routes/admin.d.ts +2 -0
- package/dist/routes/admin.d.ts.map +1 -0
- package/dist/routes/admin.js +2 -0
- package/dist/routes/admin.js.map +1 -0
- package/dist/routes/apiKeys.d.ts +3 -0
- package/dist/routes/apiKeys.d.ts.map +1 -0
- package/dist/routes/apiKeys.js +50 -0
- package/dist/routes/apiKeys.js.map +1 -0
- package/dist/routes/auth.d.ts +3 -0
- package/dist/routes/auth.d.ts.map +1 -0
- package/dist/routes/auth.js +174 -0
- package/dist/routes/auth.js.map +1 -0
- package/dist/routes/authz.d.ts +3 -0
- package/dist/routes/authz.d.ts.map +1 -0
- package/dist/routes/authz.js +28 -0
- package/dist/routes/authz.js.map +1 -0
- package/dist/routes/config.d.ts +3 -0
- package/dist/routes/config.d.ts.map +1 -0
- package/dist/routes/config.js +63 -0
- package/dist/routes/config.js.map +1 -0
- package/dist/routes/emailVerification.d.ts +3 -0
- package/dist/routes/emailVerification.d.ts.map +1 -0
- package/dist/routes/emailVerification.js +64 -0
- package/dist/routes/emailVerification.js.map +1 -0
- package/dist/routes/federation.d.ts +3 -0
- package/dist/routes/federation.d.ts.map +1 -0
- package/dist/routes/federation.js +133 -0
- package/dist/routes/federation.js.map +1 -0
- package/dist/routes/helpers.d.ts +14 -0
- package/dist/routes/helpers.d.ts.map +1 -0
- package/dist/routes/helpers.js +15 -0
- package/dist/routes/helpers.js.map +1 -0
- package/dist/routes/magicLinks.d.ts +3 -0
- package/dist/routes/magicLinks.d.ts.map +1 -0
- package/dist/routes/magicLinks.js +82 -0
- package/dist/routes/magicLinks.js.map +1 -0
- package/dist/routes/oauth.d.ts +3 -0
- package/dist/routes/oauth.d.ts.map +1 -0
- package/dist/routes/oauth.js +146 -0
- package/dist/routes/oauth.js.map +1 -0
- package/dist/routes/oauth2.d.ts +3 -0
- package/dist/routes/oauth2.d.ts.map +1 -0
- package/dist/routes/oauth2.js +219 -0
- package/dist/routes/oauth2.js.map +1 -0
- package/dist/routes/oidcEnterprise.d.ts +3 -0
- package/dist/routes/oidcEnterprise.d.ts.map +1 -0
- package/dist/routes/oidcEnterprise.js +119 -0
- package/dist/routes/oidcEnterprise.js.map +1 -0
- package/dist/routes/password.d.ts +3 -0
- package/dist/routes/password.d.ts.map +1 -0
- package/dist/routes/password.js +83 -0
- package/dist/routes/password.js.map +1 -0
- package/dist/routes/profile.d.ts +3 -0
- package/dist/routes/profile.d.ts.map +1 -0
- package/dist/routes/profile.js +43 -0
- package/dist/routes/profile.js.map +1 -0
- package/dist/routes/saml.d.ts +3 -0
- package/dist/routes/saml.d.ts.map +1 -0
- package/dist/routes/saml.js +164 -0
- package/dist/routes/saml.js.map +1 -0
- package/dist/routes/scim.d.ts +3 -0
- package/dist/routes/scim.d.ts.map +1 -0
- package/dist/routes/scim.js +175 -0
- package/dist/routes/scim.js.map +1 -0
- package/dist/routes/sdk.d.ts +3 -0
- package/dist/routes/sdk.d.ts.map +1 -0
- package/dist/routes/sdk.js +129 -0
- package/dist/routes/sdk.js.map +1 -0
- package/dist/routes/serviceAccounts.d.ts +3 -0
- package/dist/routes/serviceAccounts.d.ts.map +1 -0
- package/dist/routes/serviceAccounts.js +82 -0
- package/dist/routes/serviceAccounts.js.map +1 -0
- package/dist/routes/sessions.d.ts +3 -0
- package/dist/routes/sessions.d.ts.map +1 -0
- package/dist/routes/sessions.js +55 -0
- package/dist/routes/sessions.js.map +1 -0
- package/dist/routes/setup.d.ts +3 -0
- package/dist/routes/setup.d.ts.map +1 -0
- package/dist/routes/setup.js +304 -0
- package/dist/routes/setup.js.map +1 -0
- package/dist/routes/smsOtp.d.ts +3 -0
- package/dist/routes/smsOtp.d.ts.map +1 -0
- package/dist/routes/smsOtp.js +50 -0
- package/dist/routes/smsOtp.js.map +1 -0
- package/dist/routes/totp.d.ts +3 -0
- package/dist/routes/totp.d.ts.map +1 -0
- package/dist/routes/totp.js +78 -0
- package/dist/routes/totp.js.map +1 -0
- package/dist/routes/webauthn.d.ts +3 -0
- package/dist/routes/webauthn.d.ts.map +1 -0
- package/dist/routes/webauthn.js +100 -0
- package/dist/routes/webauthn.js.map +1 -0
- package/dist/routes/workflows.d.ts +3 -0
- package/dist/routes/workflows.d.ts.map +1 -0
- package/dist/routes/workflows.js +140 -0
- package/dist/routes/workflows.js.map +1 -0
- package/dist/sdk/index.d.ts +5 -0
- package/dist/sdk/index.d.ts.map +1 -0
- package/dist/sdk/index.js +125 -0
- package/dist/sdk/index.js.map +1 -0
- package/dist/sdk/types.d.ts +110 -0
- package/dist/sdk/types.d.ts.map +1 -0
- package/dist/sdk/types.js +2 -0
- package/dist/sdk/types.js.map +1 -0
- package/dist/services/anomalyDetection.d.ts +14 -0
- package/dist/services/anomalyDetection.d.ts.map +1 -0
- package/dist/services/anomalyDetection.js +68 -0
- package/dist/services/anomalyDetection.js.map +1 -0
- package/dist/services/application/authentication.d.ts +38 -0
- package/dist/services/application/authentication.d.ts.map +1 -0
- package/dist/services/application/authentication.js +48 -0
- package/dist/services/application/authentication.js.map +1 -0
- package/dist/services/application/identity.d.ts +34 -0
- package/dist/services/application/identity.d.ts.map +1 -0
- package/dist/services/application/identity.js +34 -0
- package/dist/services/application/identity.js.map +1 -0
- package/dist/services/application/index.d.ts +4 -0
- package/dist/services/application/index.d.ts.map +1 -0
- package/dist/services/application/index.js +4 -0
- package/dist/services/application/index.js.map +1 -0
- package/dist/services/application/organization.d.ts +44 -0
- package/dist/services/application/organization.d.ts.map +1 -0
- package/dist/services/application/organization.js +53 -0
- package/dist/services/application/organization.js.map +1 -0
- package/dist/services/applications.d.ts +25 -0
- package/dist/services/applications.d.ts.map +1 -0
- package/dist/services/applications.js +64 -0
- package/dist/services/applications.js.map +1 -0
- package/dist/services/audit.d.ts +16 -0
- package/dist/services/audit.d.ts.map +1 -0
- package/dist/services/audit.js +28 -0
- package/dist/services/audit.js.map +1 -0
- package/dist/services/auditExport.d.ts +17 -0
- package/dist/services/auditExport.d.ts.map +1 -0
- package/dist/services/auditExport.js +37 -0
- package/dist/services/auditExport.js.map +1 -0
- package/dist/services/billing.d.ts +23 -0
- package/dist/services/billing.d.ts.map +1 -0
- package/dist/services/billing.js +67 -0
- package/dist/services/billing.js.map +1 -0
- package/dist/services/cache.d.ts +23 -0
- package/dist/services/cache.d.ts.map +1 -0
- package/dist/services/cache.js +114 -0
- package/dist/services/cache.js.map +1 -0
- package/dist/services/configuration/profiles.d.ts +13 -0
- package/dist/services/configuration/profiles.d.ts.map +1 -0
- package/dist/services/configuration/profiles.js +108 -0
- package/dist/services/configuration/profiles.js.map +1 -0
- package/dist/services/configuration.d.ts +50 -0
- package/dist/services/configuration.d.ts.map +1 -0
- package/dist/services/configuration.js +74 -0
- package/dist/services/configuration.js.map +1 -0
- package/dist/services/connectors/google.d.ts +17 -0
- package/dist/services/connectors/google.d.ts.map +1 -0
- package/dist/services/connectors/google.js +81 -0
- package/dist/services/connectors/google.js.map +1 -0
- package/dist/services/connectors/oidc.d.ts +14 -0
- package/dist/services/connectors/oidc.d.ts.map +1 -0
- package/dist/services/connectors/oidc.js +100 -0
- package/dist/services/connectors/oidc.js.map +1 -0
- package/dist/services/connectors/registry.d.ts +13 -0
- package/dist/services/connectors/registry.d.ts.map +1 -0
- package/dist/services/connectors/registry.js +109 -0
- package/dist/services/connectors/registry.js.map +1 -0
- package/dist/services/connectors/types.d.ts +36 -0
- package/dist/services/connectors/types.d.ts.map +1 -0
- package/dist/services/connectors/types.js +2 -0
- package/dist/services/connectors/types.js.map +1 -0
- package/dist/services/connectors/zitadel.d.ts +14 -0
- package/dist/services/connectors/zitadel.d.ts.map +1 -0
- package/dist/services/connectors/zitadel.js +70 -0
- package/dist/services/connectors/zitadel.js.map +1 -0
- package/dist/services/devices.d.ts +4 -0
- package/dist/services/devices.d.ts.map +1 -0
- package/dist/services/devices.js +59 -0
- package/dist/services/devices.js.map +1 -0
- package/dist/services/domain/authentication.d.ts +51 -0
- package/dist/services/domain/authentication.d.ts.map +1 -0
- package/dist/services/domain/authentication.js +218 -0
- package/dist/services/domain/authentication.js.map +1 -0
- package/dist/services/domain/authorization.d.ts +20 -0
- package/dist/services/domain/authorization.d.ts.map +1 -0
- package/dist/services/domain/authorization.js +36 -0
- package/dist/services/domain/authorization.js.map +1 -0
- package/dist/services/domain/identity.d.ts +43 -0
- package/dist/services/domain/identity.d.ts.map +1 -0
- package/dist/services/domain/identity.js +75 -0
- package/dist/services/domain/identity.js.map +1 -0
- package/dist/services/domain/index.d.ts +5 -0
- package/dist/services/domain/index.d.ts.map +1 -0
- package/dist/services/domain/index.js +5 -0
- package/dist/services/domain/index.js.map +1 -0
- package/dist/services/domain/organization.d.ts +60 -0
- package/dist/services/domain/organization.d.ts.map +1 -0
- package/dist/services/domain/organization.js +87 -0
- package/dist/services/domain/organization.js.map +1 -0
- package/dist/services/email.d.ts +24 -0
- package/dist/services/email.d.ts.map +1 -0
- package/dist/services/email.js +127 -0
- package/dist/services/email.js.map +1 -0
- package/dist/services/emailVerification.d.ts +20 -0
- package/dist/services/emailVerification.d.ts.map +1 -0
- package/dist/services/emailVerification.js +58 -0
- package/dist/services/emailVerification.js.map +1 -0
- package/dist/services/enterpriseSso.d.ts +34 -0
- package/dist/services/enterpriseSso.d.ts.map +1 -0
- package/dist/services/enterpriseSso.js +40 -0
- package/dist/services/enterpriseSso.js.map +1 -0
- package/dist/services/events/bus.d.ts +9 -0
- package/dist/services/events/bus.d.ts.map +1 -0
- package/dist/services/events/bus.js +36 -0
- package/dist/services/events/bus.js.map +1 -0
- package/dist/services/events/subscribers/anomaly.d.ts +3 -0
- package/dist/services/events/subscribers/anomaly.d.ts.map +1 -0
- package/dist/services/events/subscribers/anomaly.js +13 -0
- package/dist/services/events/subscribers/anomaly.js.map +1 -0
- package/dist/services/events/subscribers/auditLog.d.ts +3 -0
- package/dist/services/events/subscribers/auditLog.d.ts.map +1 -0
- package/dist/services/events/subscribers/auditLog.js +21 -0
- package/dist/services/events/subscribers/auditLog.js.map +1 -0
- package/dist/services/events/subscribers/webhook.d.ts +3 -0
- package/dist/services/events/subscribers/webhook.d.ts.map +1 -0
- package/dist/services/events/subscribers/webhook.js +36 -0
- package/dist/services/events/subscribers/webhook.js.map +1 -0
- package/dist/services/events/subscribers/webhookDispatch.d.ts +7 -0
- package/dist/services/events/subscribers/webhookDispatch.d.ts.map +1 -0
- package/dist/services/events/subscribers/webhookDispatch.js +14 -0
- package/dist/services/events/subscribers/webhookDispatch.js.map +1 -0
- package/dist/services/events/types.d.ts +21 -0
- package/dist/services/events/types.d.ts.map +1 -0
- package/dist/services/events/types.js +8 -0
- package/dist/services/events/types.js.map +1 -0
- package/dist/services/events/validate.d.ts +9 -0
- package/dist/services/events/validate.d.ts.map +1 -0
- package/dist/services/events/validate.js +103 -0
- package/dist/services/events/validate.js.map +1 -0
- package/dist/services/featureFlags.d.ts +15 -0
- package/dist/services/featureFlags.d.ts.map +1 -0
- package/dist/services/featureFlags.js +74 -0
- package/dist/services/featureFlags.js.map +1 -0
- package/dist/services/features.d.ts +12 -0
- package/dist/services/features.d.ts.map +1 -0
- package/dist/services/features.js +17 -0
- package/dist/services/features.js.map +1 -0
- package/dist/services/federation.d.ts +12 -0
- package/dist/services/federation.d.ts.map +1 -0
- package/dist/services/federation.js +22 -0
- package/dist/services/federation.js.map +1 -0
- package/dist/services/hibp.d.ts +2 -0
- package/dist/services/hibp.d.ts.map +1 -0
- package/dist/services/hibp.js +29 -0
- package/dist/services/hibp.js.map +1 -0
- package/dist/services/ipControls.d.ts +7 -0
- package/dist/services/ipControls.d.ts.map +1 -0
- package/dist/services/ipControls.js +92 -0
- package/dist/services/ipControls.js.map +1 -0
- package/dist/services/magicLinks.d.ts +16 -0
- package/dist/services/magicLinks.d.ts.map +1 -0
- package/dist/services/magicLinks.js +39 -0
- package/dist/services/magicLinks.js.map +1 -0
- package/dist/services/oauth2.d.ts +58 -0
- package/dist/services/oauth2.d.ts.map +1 -0
- package/dist/services/oauth2.js +144 -0
- package/dist/services/oauth2.js.map +1 -0
- package/dist/services/organizations.d.ts +39 -0
- package/dist/services/organizations.d.ts.map +1 -0
- package/dist/services/organizations.js +135 -0
- package/dist/services/organizations.js.map +1 -0
- package/dist/services/permissions.d.ts +19 -0
- package/dist/services/permissions.d.ts.map +1 -0
- package/dist/services/permissions.js +119 -0
- package/dist/services/permissions.js.map +1 -0
- package/dist/services/plugins/registry.d.ts +17 -0
- package/dist/services/plugins/registry.d.ts.map +1 -0
- package/dist/services/plugins/registry.js +196 -0
- package/dist/services/plugins/registry.js.map +1 -0
- package/dist/services/plugins/types.d.ts +86 -0
- package/dist/services/plugins/types.d.ts.map +1 -0
- package/dist/services/plugins/types.js +2 -0
- package/dist/services/plugins/types.js.map +1 -0
- package/dist/services/queue/bullmq.d.ts +16 -0
- package/dist/services/queue/bullmq.d.ts.map +1 -0
- package/dist/services/queue/bullmq.js +89 -0
- package/dist/services/queue/bullmq.js.map +1 -0
- package/dist/services/queue/inProcess.d.ts +15 -0
- package/dist/services/queue/inProcess.d.ts.map +1 -0
- package/dist/services/queue/inProcess.js +63 -0
- package/dist/services/queue/inProcess.js.map +1 -0
- package/dist/services/queue/index.d.ts +7 -0
- package/dist/services/queue/index.d.ts.map +1 -0
- package/dist/services/queue/index.js +19 -0
- package/dist/services/queue/index.js.map +1 -0
- package/dist/services/queue/types.d.ts +24 -0
- package/dist/services/queue/types.d.ts.map +1 -0
- package/dist/services/queue/types.js +2 -0
- package/dist/services/queue/types.js.map +1 -0
- package/dist/services/redis.d.ts +9 -0
- package/dist/services/redis.d.ts.map +1 -0
- package/dist/services/redis.js +15 -0
- package/dist/services/redis.js.map +1 -0
- package/dist/services/secrets/awsKms.d.ts +41 -0
- package/dist/services/secrets/awsKms.d.ts.map +1 -0
- package/dist/services/secrets/awsKms.js +81 -0
- package/dist/services/secrets/awsKms.js.map +1 -0
- package/dist/services/secrets/azureKeyVault.d.ts +44 -0
- package/dist/services/secrets/azureKeyVault.d.ts.map +1 -0
- package/dist/services/secrets/azureKeyVault.js +152 -0
- package/dist/services/secrets/azureKeyVault.js.map +1 -0
- package/dist/services/secrets/database.d.ts +29 -0
- package/dist/services/secrets/database.d.ts.map +1 -0
- package/dist/services/secrets/database.js +138 -0
- package/dist/services/secrets/database.js.map +1 -0
- package/dist/services/secrets/environment.d.ts +27 -0
- package/dist/services/secrets/environment.d.ts.map +1 -0
- package/dist/services/secrets/environment.js +102 -0
- package/dist/services/secrets/environment.js.map +1 -0
- package/dist/services/secrets/index.d.ts +30 -0
- package/dist/services/secrets/index.d.ts.map +1 -0
- package/dist/services/secrets/index.js +46 -0
- package/dist/services/secrets/index.js.map +1 -0
- package/dist/services/secrets/password.d.ts +10 -0
- package/dist/services/secrets/password.d.ts.map +1 -0
- package/dist/services/secrets/password.js +62 -0
- package/dist/services/secrets/password.js.map +1 -0
- package/dist/services/secrets/provider.d.ts +36 -0
- package/dist/services/secrets/provider.d.ts.map +1 -0
- package/dist/services/secrets/provider.js +2 -0
- package/dist/services/secrets/provider.js.map +1 -0
- package/dist/services/secrets/vault.d.ts +41 -0
- package/dist/services/secrets/vault.d.ts.map +1 -0
- package/dist/services/secrets/vault.js +133 -0
- package/dist/services/secrets/vault.js.map +1 -0
- package/dist/services/secrets.d.ts +2 -0
- package/dist/services/secrets.d.ts.map +1 -0
- package/dist/services/secrets.js +3 -0
- package/dist/services/secrets.js.map +1 -0
- package/dist/services/serviceAccounts.d.ts +24 -0
- package/dist/services/serviceAccounts.d.ts.map +1 -0
- package/dist/services/serviceAccounts.js +53 -0
- package/dist/services/serviceAccounts.js.map +1 -0
- package/dist/services/setup/configWriter.d.ts +18 -0
- package/dist/services/setup/configWriter.d.ts.map +1 -0
- package/dist/services/setup/configWriter.js +192 -0
- package/dist/services/setup/configWriter.js.map +1 -0
- package/dist/services/setup/diagnostics.d.ts +7 -0
- package/dist/services/setup/diagnostics.d.ts.map +1 -0
- package/dist/services/setup/diagnostics.js +73 -0
- package/dist/services/setup/diagnostics.js.map +1 -0
- package/dist/services/setup/token.d.ts +5 -0
- package/dist/services/setup/token.d.ts.map +1 -0
- package/dist/services/setup/token.js +37 -0
- package/dist/services/setup/token.js.map +1 -0
- package/dist/services/setup/types.d.ts +35 -0
- package/dist/services/setup/types.d.ts.map +1 -0
- package/dist/services/setup/types.js +2 -0
- package/dist/services/setup/types.js.map +1 -0
- package/dist/services/setup/validation.d.ts +7 -0
- package/dist/services/setup/validation.d.ts.map +1 -0
- package/dist/services/setup/validation.js +198 -0
- package/dist/services/setup/validation.js.map +1 -0
- package/dist/services/sms.d.ts +10 -0
- package/dist/services/sms.d.ts.map +1 -0
- package/dist/services/sms.js +62 -0
- package/dist/services/sms.js.map +1 -0
- package/dist/services/smsOtp.d.ts +7 -0
- package/dist/services/smsOtp.d.ts.map +1 -0
- package/dist/services/smsOtp.js +56 -0
- package/dist/services/smsOtp.js.map +1 -0
- package/dist/services/tokens.d.ts +66 -0
- package/dist/services/tokens.d.ts.map +1 -0
- package/dist/services/tokens.js +205 -0
- package/dist/services/tokens.js.map +1 -0
- package/dist/services/totp.d.ts +16 -0
- package/dist/services/totp.d.ts.map +1 -0
- package/dist/services/totp.js +96 -0
- package/dist/services/totp.js.map +1 -0
- package/dist/services/users.d.ts +39 -0
- package/dist/services/users.d.ts.map +1 -0
- package/dist/services/users.js +181 -0
- package/dist/services/users.js.map +1 -0
- package/dist/services/webauthn.d.ts +45 -0
- package/dist/services/webauthn.d.ts.map +1 -0
- package/dist/services/webauthn.js +147 -0
- package/dist/services/webauthn.js.map +1 -0
- package/dist/services/webhooks.d.ts +86 -0
- package/dist/services/webhooks.d.ts.map +1 -0
- package/dist/services/webhooks.js +164 -0
- package/dist/services/webhooks.js.map +1 -0
- package/dist/services/workflows/engine.d.ts +18 -0
- package/dist/services/workflows/engine.d.ts.map +1 -0
- package/dist/services/workflows/engine.js +104 -0
- package/dist/services/workflows/engine.js.map +1 -0
- package/dist/services/workflows/steps.d.ts +17 -0
- package/dist/services/workflows/steps.d.ts.map +1 -0
- package/dist/services/workflows/steps.js +109 -0
- package/dist/services/workflows/steps.js.map +1 -0
- package/dist/services/zitadel.d.ts +21 -0
- package/dist/services/zitadel.d.ts.map +1 -0
- package/dist/services/zitadel.js +228 -0
- package/dist/services/zitadel.js.map +1 -0
- package/dist/setup-server.d.ts +2 -0
- package/dist/setup-server.d.ts.map +1 -0
- package/dist/setup-server.js +63 -0
- package/dist/setup-server.js.map +1 -0
- package/dist/tests/errors.test.d.ts +2 -0
- package/dist/tests/errors.test.d.ts.map +1 -0
- package/dist/tests/errors.test.js +64 -0
- package/dist/tests/errors.test.js.map +1 -0
- package/dist/tests/events.test.d.ts +2 -0
- package/dist/tests/events.test.d.ts.map +1 -0
- package/dist/tests/events.test.js +45 -0
- package/dist/tests/events.test.js.map +1 -0
- package/dist/tests/featureFlags.test.d.ts +2 -0
- package/dist/tests/featureFlags.test.d.ts.map +1 -0
- package/dist/tests/featureFlags.test.js +24 -0
- package/dist/tests/featureFlags.test.js.map +1 -0
- package/dist/tests/integration/queue.test.d.ts +2 -0
- package/dist/tests/integration/queue.test.d.ts.map +1 -0
- package/dist/tests/integration/queue.test.js +49 -0
- package/dist/tests/integration/queue.test.js.map +1 -0
- package/dist/tests/plugins.test.d.ts +2 -0
- package/dist/tests/plugins.test.d.ts.map +1 -0
- package/dist/tests/plugins.test.js +56 -0
- package/dist/tests/plugins.test.js.map +1 -0
- package/dist/tests/result.test.d.ts +2 -0
- package/dist/tests/result.test.d.ts.map +1 -0
- package/dist/tests/result.test.js +46 -0
- package/dist/tests/result.test.js.map +1 -0
- package/dist/tests/setup/configWriter.test.d.ts +2 -0
- package/dist/tests/setup/configWriter.test.d.ts.map +1 -0
- package/dist/tests/setup/configWriter.test.js +55 -0
- package/dist/tests/setup/configWriter.test.js.map +1 -0
- package/dist/tests/setup/validation.test.d.ts +2 -0
- package/dist/tests/setup/validation.test.d.ts.map +1 -0
- package/dist/tests/setup/validation.test.js +26 -0
- package/dist/tests/setup/validation.test.js.map +1 -0
- package/dist/tests/smoke.test.d.ts +2 -0
- package/dist/tests/smoke.test.d.ts.map +1 -0
- package/dist/tests/smoke.test.js +124 -0
- package/dist/tests/smoke.test.js.map +1 -0
- package/dist/types.d.ts +50 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +17 -0
- package/dist/types.js.map +1 -0
- package/package.json +69 -0
- package/src/cli.ts +172 -0
- package/src/config.ts +143 -0
- package/src/container.ts +48 -0
- package/src/db/index.ts +53 -0
- package/src/db/migrations/0000_skinny_ben_parker.sql +553 -0
- package/src/db/migrations/0001_brief_joseph.sql +10 -0
- package/src/db/migrations/0002_add_account_lockout.sql +3 -0
- package/src/db/migrations/0003_steep_rachel_grey.sql +1 -0
- package/src/db/migrations/0004_clever_bill_hollister.sql +20 -0
- package/src/db/migrations/0005_steep_the_call.sql +2 -0
- package/src/db/migrations/0006_ambitious_boomer.sql +17 -0
- package/src/db/migrations/0007_greedy_vindicator.sql +40 -0
- package/src/db/migrations/meta/0000_snapshot.json +2964 -0
- package/src/db/migrations/meta/0001_snapshot.json +3031 -0
- package/src/db/migrations/meta/0003_snapshot.json +3051 -0
- package/src/db/migrations/meta/0004_snapshot.json +3163 -0
- package/src/db/migrations/meta/0005_snapshot.json +3177 -0
- package/src/db/migrations/meta/0006_snapshot.json +3270 -0
- package/src/db/migrations/meta/0007_snapshot.json +3489 -0
- package/src/db/migrations/meta/_journal.json +62 -0
- package/src/db/schema.ts +676 -0
- package/src/db/seed.ts +146 -0
- package/src/di.ts +81 -0
- package/src/index.ts +326 -0
- package/src/lib/errors.ts +139 -0
- package/src/lib/result.ts +44 -0
- package/src/lib/webhookSignature.ts +41 -0
- package/src/plugins/appContext.ts +76 -0
- package/src/plugins/audit.ts +42 -0
- package/src/plugins/auth.ts +230 -0
- package/src/plugins/metrics.ts +41 -0
- package/src/plugins/mtls.ts +94 -0
- package/src/plugins/permissions.ts +29 -0
- package/src/plugins/rateLimit.ts +133 -0
- package/src/plugins/requestLogger.ts +25 -0
- package/src/plugins/tracing.ts +22 -0
- package/src/repositories/apiKey.ts +158 -0
- package/src/repositories/application.ts +70 -0
- package/src/repositories/audit.ts +32 -0
- package/src/repositories/index.ts +9 -0
- package/src/repositories/oidcConnection.ts +111 -0
- package/src/repositories/organization.ts +167 -0
- package/src/repositories/permission.ts +153 -0
- package/src/repositories/samlConnection.ts +96 -0
- package/src/repositories/session.ts +86 -0
- package/src/repositories/types.ts +134 -0
- package/src/repositories/user.ts +161 -0
- package/src/routes/admin/billing.ts +48 -0
- package/src/routes/admin/helpers.ts +50 -0
- package/src/routes/admin/index.ts +16 -0
- package/src/routes/admin/organizations.ts +299 -0
- package/src/routes/admin/permissions.ts +80 -0
- package/src/routes/admin/platform.ts +335 -0
- package/src/routes/admin/sso.ts +138 -0
- package/src/routes/admin/webhooks.ts +73 -0
- package/src/routes/admin.ts +1 -0
- package/src/routes/apiKeys.ts +60 -0
- package/src/routes/auth.ts +214 -0
- package/src/routes/authz.ts +38 -0
- package/src/routes/config.ts +67 -0
- package/src/routes/emailVerification.ts +73 -0
- package/src/routes/federation.ts +156 -0
- package/src/routes/helpers.ts +17 -0
- package/src/routes/magicLinks.ts +107 -0
- package/src/routes/oauth.ts +167 -0
- package/src/routes/oauth2.ts +284 -0
- package/src/routes/oidcEnterprise.ts +166 -0
- package/src/routes/password.ts +90 -0
- package/src/routes/profile.ts +44 -0
- package/src/routes/saml.ts +209 -0
- package/src/routes/scim.ts +199 -0
- package/src/routes/sdk.ts +141 -0
- package/src/routes/serviceAccounts.ts +124 -0
- package/src/routes/sessions.ts +62 -0
- package/src/routes/setup.ts +315 -0
- package/src/routes/smsOtp.ts +67 -0
- package/src/routes/totp.ts +122 -0
- package/src/routes/webauthn.ts +147 -0
- package/src/routes/workflows.ts +157 -0
- package/src/sdk/index.ts +152 -0
- package/src/sdk/types.ts +54 -0
- package/src/services/anomalyDetection.ts +73 -0
- package/src/services/application/authentication.ts +75 -0
- package/src/services/application/identity.ts +56 -0
- package/src/services/application/index.ts +3 -0
- package/src/services/application/organization.ts +77 -0
- package/src/services/applications.ts +89 -0
- package/src/services/audit.ts +41 -0
- package/src/services/auditExport.ts +59 -0
- package/src/services/billing.ts +87 -0
- package/src/services/cache.ts +131 -0
- package/src/services/configuration/profiles.ts +115 -0
- package/src/services/configuration.ts +120 -0
- package/src/services/connectors/google.ts +92 -0
- package/src/services/connectors/oidc.ts +111 -0
- package/src/services/connectors/registry.ts +124 -0
- package/src/services/connectors/types.ts +38 -0
- package/src/services/connectors/zitadel.ts +77 -0
- package/src/services/devices.ts +76 -0
- package/src/services/domain/authentication.ts +279 -0
- package/src/services/domain/authorization.ts +49 -0
- package/src/services/domain/identity.ts +108 -0
- package/src/services/domain/index.ts +4 -0
- package/src/services/domain/organization.ts +114 -0
- package/src/services/email.ts +167 -0
- package/src/services/emailVerification.ts +75 -0
- package/src/services/enterpriseSso.ts +58 -0
- package/src/services/events/bus.ts +43 -0
- package/src/services/events/subscribers/anomaly.ts +13 -0
- package/src/services/events/subscribers/auditLog.ts +21 -0
- package/src/services/events/subscribers/webhook.ts +39 -0
- package/src/services/events/subscribers/webhookDispatch.ts +14 -0
- package/src/services/events/types.ts +106 -0
- package/src/services/events/validate.ts +118 -0
- package/src/services/featureFlags.ts +90 -0
- package/src/services/features.ts +22 -0
- package/src/services/federation.ts +30 -0
- package/src/services/hibp.ts +28 -0
- package/src/services/ipControls.ts +99 -0
- package/src/services/magicLinks.ts +51 -0
- package/src/services/oauth2.ts +216 -0
- package/src/services/organizations.ts +171 -0
- package/src/services/permissions.ts +146 -0
- package/src/services/plugins/registry.ts +242 -0
- package/src/services/plugins/types.ts +98 -0
- package/src/services/queue/bullmq.ts +104 -0
- package/src/services/queue/inProcess.ts +75 -0
- package/src/services/queue/index.ts +19 -0
- package/src/services/queue/types.ts +26 -0
- package/src/services/redis.ts +16 -0
- package/src/services/secrets/awsKms.ts +97 -0
- package/src/services/secrets/azureKeyVault.ts +171 -0
- package/src/services/secrets/database.ts +166 -0
- package/src/services/secrets/environment.ts +117 -0
- package/src/services/secrets/index.ts +50 -0
- package/src/services/secrets/password.ts +73 -0
- package/src/services/secrets/provider.ts +38 -0
- package/src/services/secrets/vault.ts +149 -0
- package/src/services/secrets.ts +2 -0
- package/src/services/serviceAccounts.ts +74 -0
- package/src/services/setup/configWriter.ts +200 -0
- package/src/services/setup/diagnostics.ts +76 -0
- package/src/services/setup/token.ts +42 -0
- package/src/services/setup/types.ts +40 -0
- package/src/services/setup/validation.ts +205 -0
- package/src/services/sms.ts +81 -0
- package/src/services/smsOtp.ts +74 -0
- package/src/services/tokens.ts +288 -0
- package/src/services/totp.ts +113 -0
- package/src/services/users.ts +239 -0
- package/src/services/webauthn.ts +193 -0
- package/src/services/webhooks.ts +190 -0
- package/src/services/workflows/engine.ts +125 -0
- package/src/services/workflows/steps.ts +129 -0
- package/src/services/zitadel.ts +277 -0
- package/src/setup-server.ts +71 -0
- package/src/tests/errors.test.ts +74 -0
- package/src/tests/events.test.ts +52 -0
- package/src/tests/featureFlags.test.ts +26 -0
- package/src/tests/integration/queue.test.ts +54 -0
- package/src/tests/plugins.test.ts +73 -0
- package/src/tests/result.test.ts +52 -0
- package/src/tests/setup/configWriter.test.ts +69 -0
- package/src/tests/setup/validation.test.ts +29 -0
- package/src/tests/smoke.test.ts +136 -0
- package/src/types.ts +70 -0
package/README.md
ADDED
|
@@ -0,0 +1,691 @@
|
|
|
1
|
+
# Hilbras Keystone
|
|
2
|
+
|
|
3
|
+
> A provider-agnostic, API-first identity platform for Hilbras products and third-party applications.
|
|
4
|
+
|
|
5
|
+
Keystone is a **standalone identity platform**, not a wrapper around another identity system. It authenticates users, issues signed tokens, enforces authorization, audits every security decision, and federates identities from any OIDC provider.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## What Keystone becomes
|
|
10
|
+
|
|
11
|
+
- **Identity Provider (IdP)** — OIDC/OAuth2 provider with JWKS discovery.
|
|
12
|
+
- **Authentication Service** — email/password, social login, magic links, WebAuthn/Passkeys, TOTP, SMS OTP.
|
|
13
|
+
- **Authorization Engine** — RBAC/ABAC permissions with `/v1/authz/check`.
|
|
14
|
+
- **Token Authority** — short-lived JWT access tokens, rotating refresh tokens, opaque API keys.
|
|
15
|
+
- **Machine Identity Manager** — scoped, rotatable, auditable service credentials.
|
|
16
|
+
- **Federation Broker** — delegate login to Google, GitHub, Azure, Okta, Keycloak, Zitadel, or any OIDC provider and issue Keystone tokens.
|
|
17
|
+
- **Enterprise SSO** — SAML 2.0 and OIDC enterprise connectors with SCIM user provisioning.
|
|
18
|
+
- **Audit & Compliance** — immutable audit log, event bus, webhooks, and anomaly detection.
|
|
19
|
+
- **Workflow Platform** — configurable post-auth workflows (assign roles, create orgs, send email, fire webhooks).
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## What's new in v1.0.0
|
|
24
|
+
|
|
25
|
+
- **Simplified browser setup wizard** — choose a profile (Development, Docker Compose, Production), test PostgreSQL/Redis, create the owner account, and connect your first project without editing files.
|
|
26
|
+
- **Setup diagnostics & dry-run** — validate the full configuration before applying it, then run a health report after setup completes.
|
|
27
|
+
- **Mobile-first admin UI** — the dashboard and setup wizard are usable down to 375px widths, with touch-friendly controls and hash-routed tabs.
|
|
28
|
+
- **Security dashboard** — owners can view 24h logins, failed logins, active sessions, MFA adoption, and recent login activity.
|
|
29
|
+
- **Account lockout protection** — repeated failed logins temporarily lock accounts and emit security events.
|
|
30
|
+
- **Azure Key Vault secrets provider** — store JWT signing and encryption keys in Azure Key Vault in addition to the default database provider.
|
|
31
|
+
- **API key scopes & signed webhooks** — API keys carry granular scopes and audit webhook deliveries are signed with HMAC.
|
|
32
|
+
- **One-click project connection** — copy integration snippets for React, Next.js, Angular, Svelte, Vue, Django, Rails, Go, Python, and plain HTML.
|
|
33
|
+
- **End-to-end test suite** — Playwright tests cover the simple setup wizard and the post-setup security dashboard using an isolated `hilbras_test` database.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Architecture
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
┌─────────────────────────────────────────────────────────────────────────┐
|
|
41
|
+
│ Consumers │
|
|
42
|
+
│ Web App Mobile CLI Microservice External SaaS │
|
|
43
|
+
└──────┬───────┬─────────┬──────┬──────────────┬──────────────────────────┘
|
|
44
|
+
│ │ │ │ │
|
|
45
|
+
▼ ▼ ▼ ▼ ▼
|
|
46
|
+
┌─────────────────────────────────────────────────────────────────────────┐
|
|
47
|
+
│ Public SDK Layer │
|
|
48
|
+
│ JS / React / Next.js / Python / CLI │
|
|
49
|
+
└─────────────────────────────────────────────────────────────────────────┘
|
|
50
|
+
│
|
|
51
|
+
▼
|
|
52
|
+
┌─────────────────────────────────────────────────────────────────────────┐
|
|
53
|
+
│ Hilbras Keystone │
|
|
54
|
+
│ ┌─────────────────────────────────────────────────────────────────┐ │
|
|
55
|
+
│ │ API-First Admin & Public APIs │ │
|
|
56
|
+
│ └─────────────────────────────────────────────────────────────────┘ │
|
|
57
|
+
│ ┌─────────────────────────────────────────────────────────────────┐ │
|
|
58
|
+
│ │ Internal SDK (stable contracts) │ │
|
|
59
|
+
│ │ AuthenticationSdk │ IdentitySdk │ OrganizationSdk │ AuthzSdk │ │
|
|
60
|
+
│ └─────────────────────────────────────────────────────────────────┘ │
|
|
61
|
+
│ ┌─────────────────────────────────────────────────────────────────┐ │
|
|
62
|
+
│ │ Application Services (use cases / HTTP agnostic) │ │
|
|
63
|
+
│ │ AuthenticationApplicationService │ OrganizationApplication... │ │
|
|
64
|
+
│ └─────────────────────────────────────────────────────────────────┘ │
|
|
65
|
+
│ ┌─────────────────────────────────────────────────────────────────┐ │
|
|
66
|
+
│ │ Domain Services (business rules) │ │
|
|
67
|
+
│ │ AuthenticationDomainService │ AuthorizationDomainService │ │
|
|
68
|
+
│ │ IdentityDomainService │ OrganizationDomainService │ │
|
|
69
|
+
│ └─────────────────────────────────────────────────────────────────┘ │
|
|
70
|
+
│ ┌─────────────────────────────────────────────────────────────────┐ │
|
|
71
|
+
│ │ Repositories (persistence abstraction) │ │
|
|
72
|
+
│ │ UserRepository │ OrganizationRepository │ ApplicationRepository │ │
|
|
73
|
+
│ │ IdentityRepository │ AuditRepository │ ApiKeyRepository │ │
|
|
74
|
+
│ │ SamlConnectionRepository │ OidcConnectionRepository │ │
|
|
75
|
+
│ └─────────────────────────────────────────────────────────────────┘ │
|
|
76
|
+
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────────┐ │ │
|
|
77
|
+
│ │ Identity │ │ Token │ │ Authorization │ │ │
|
|
78
|
+
│ │ Connectors │ │ Service │ │ Engine │ │ │
|
|
79
|
+
│ └──────────────┘ ┌──────────────┘ └──────────────────────┘ │ │
|
|
80
|
+
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────────┐ │ │
|
|
81
|
+
│ │ Versioned │ │ Secrets │ │ Workflow Engine │ │ │
|
|
82
|
+
│ │ Event Bus │ │ Provider │ │ + Background Queue │ │ │
|
|
83
|
+
│ └──────────────┘ └──────────────┘ └──────────────────────┘ │ │
|
|
84
|
+
│ ┌────────────────────────────────────────────────────────────┐ │ │
|
|
85
|
+
│ │ DI Container │ Plugin Registry │ ConfigurationService │ │ │
|
|
86
|
+
│ └────────────────────────────────────────────────────────────┘ │ │
|
|
87
|
+
│ ┌────────────────────────────────────────────────────────────┐ │ │
|
|
88
|
+
│ │ Security: Rate Limiting │ mTLS │ SAML │ SCIM │ WebAuthn │ │ │
|
|
89
|
+
│ └────────────────────────────────────────────────────────────┘ │ │
|
|
90
|
+
└─────────────────────────────────────────────────────────────────────────┘
|
|
91
|
+
│
|
|
92
|
+
┌────────────────────┼────────────────────┐
|
|
93
|
+
▼ ▼ ▼
|
|
94
|
+
PostgreSQL Redis External providers
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Design principles
|
|
100
|
+
|
|
101
|
+
### 1. Connectors are pure provider adapters
|
|
102
|
+
|
|
103
|
+
Identity connectors know only how to talk to an external provider:
|
|
104
|
+
|
|
105
|
+
- Build authorization URLs
|
|
106
|
+
- Exchange codes for tokens
|
|
107
|
+
- Validate identity tokens
|
|
108
|
+
- Retrieve and normalize profile information
|
|
109
|
+
|
|
110
|
+
They do **not** create users, link identities, issue Keystone tokens, or manage sessions. Those responsibilities live in higher-level services such as `FederationService` and `AuthenticationService`. This keeps connectors small, reusable, and easy to test.
|
|
111
|
+
|
|
112
|
+
### 2. Layered architecture: Application → Domain → Repository
|
|
113
|
+
|
|
114
|
+
Routes delegate to an **Application Layer** that executes use cases, which in turn delegate to **Domain Services** that encode business rules. Domain services depend on **Repository interfaces**, not on SQL or ORM details.
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
Routes → Application Services → Domain Services → Repositories
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
This keeps business logic independent of HTTP and makes future transports (CLI, gRPC, workers, GraphQL) straightforward.
|
|
121
|
+
|
|
122
|
+
### 3. Everything important emits a versioned event
|
|
123
|
+
|
|
124
|
+
The audit event bus emits structured events such as `user_registered`, `user_login`, `oauth_callback`, `api_key_created`, and `authz_check`.
|
|
125
|
+
|
|
126
|
+
Every event carries a version:
|
|
127
|
+
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"type": "user.login",
|
|
131
|
+
"version": 1,
|
|
132
|
+
"timestamp": "2026-07-13T00:00:00Z",
|
|
133
|
+
"payload": {
|
|
134
|
+
"userId": "...",
|
|
135
|
+
"ip": "...",
|
|
136
|
+
"metadata": {}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Versioned events let subscribers evolve independently without breaking integrations.
|
|
142
|
+
|
|
143
|
+
### 4. Long-running work belongs in a background queue
|
|
144
|
+
|
|
145
|
+
The in-process event bus is a fast starting point, but actions such as sending emails, delivering webhooks, running analytics, and executing workflow steps should move to a background job queue. Keystone ships with a BullMQ-backed queue that is used automatically when Redis is available (`KEYSTONE_QUEUE_PROVIDER=""` or `bullmq`), falling back to an in-process queue for local development.
|
|
146
|
+
|
|
147
|
+
### 5. Secrets are pluggable
|
|
148
|
+
|
|
149
|
+
Secrets management is abstracted so Keystone can store and rotate keys in different backends:
|
|
150
|
+
|
|
151
|
+
- `DatabaseSecretsProvider` — default, stores keys in PostgreSQL
|
|
152
|
+
- `EnvironmentSecretsProvider` — read from env vars
|
|
153
|
+
- `AWS KMS Provider`, `HashiCorp Vault Provider`, `Azure Key Vault Provider` — enterprise options (via plugin or future built-in providers)
|
|
154
|
+
|
|
155
|
+
The default provider handles JWT signing keys, encryption keys, password hashes, API keys, and client secrets with rotation support. JWT keys are rotated with a 24-hour grace period so tokens signed with the previous key remain valid.
|
|
156
|
+
|
|
157
|
+
### 6. Built for a plugin architecture
|
|
158
|
+
|
|
159
|
+
Keystone is designed to be extended without touching core code. The plugin registry can register:
|
|
160
|
+
|
|
161
|
+
- Identity providers and authentication methods
|
|
162
|
+
- Email and SMS providers
|
|
163
|
+
- Custom workflow steps
|
|
164
|
+
- Analytics, billing, and custom authorization policies
|
|
165
|
+
|
|
166
|
+
Load plugins at startup via `KEYSTONE_PLUGINS=./plugins/my-plugin.js` or call `app.registerPlugin(plugin)` at runtime. Each plugin exports a `KeystonePlugin` object with optional `connectors`, `emailProvider`, `smsProvider`, and `workflowSteps`.
|
|
167
|
+
|
|
168
|
+
### 7. Internal SDK layer
|
|
169
|
+
|
|
170
|
+
Routes, CLI commands, workers, and scheduled jobs share a stable internal client layer instead of calling low-level services directly:
|
|
171
|
+
|
|
172
|
+
```ts
|
|
173
|
+
import { getSdk } from "./sdk/index.js";
|
|
174
|
+
|
|
175
|
+
const sdk = getSdk();
|
|
176
|
+
const session = await sdk.authentication.login({ email, password });
|
|
177
|
+
const user = await sdk.identity.findUser(session.user.id);
|
|
178
|
+
const allowed = await sdk.authorization.hasPermission(role, resource, action);
|
|
179
|
+
const org = await sdk.organization.createOrganization(userId, { name: "Acme" });
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
The SDK exposes stable TypeScript interfaces (`AuthenticationSdk`, `IdentitySdk`, `OrganizationSdk`, `AuthorizationSdk`) while hiding the concrete application and domain service implementations.
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Advanced architecture patterns
|
|
187
|
+
|
|
188
|
+
### Dependency injection
|
|
189
|
+
|
|
190
|
+
A lightweight DI container wires repositories, domain services, and application services. The container is initialized when the app boots:
|
|
191
|
+
|
|
192
|
+
```ts
|
|
193
|
+
import { initializeContainer, getContainer } from "./di.js";
|
|
194
|
+
|
|
195
|
+
initializeContainer();
|
|
196
|
+
const users = getContainer().userRepository;
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Services receive dependencies through constructors, making unit testing with mocked repositories straightforward.
|
|
200
|
+
|
|
201
|
+
### Repository abstraction
|
|
202
|
+
|
|
203
|
+
Domain services depend on repository interfaces such as `UserRepository`, `OrganizationRepository`, `ApplicationRepository`, `IdentityRepository`, `AuditRepository`, `PermissionRepository`, `ApiKeyRepository`, `SamlConnectionRepository`, and `OidcConnectionRepository`. Drizzle-based implementations live in `src/repositories/`, but the persistence layer can be swapped without touching business logic.
|
|
204
|
+
|
|
205
|
+
### Standardized results
|
|
206
|
+
|
|
207
|
+
Internal services return a uniform `Result<T>` type instead of throwing:
|
|
208
|
+
|
|
209
|
+
```ts
|
|
210
|
+
import { ok, err, type Result } from "./lib/result.js";
|
|
211
|
+
|
|
212
|
+
function findUser(id: string): Result<User> {
|
|
213
|
+
if (!user) return err({ code: "NOT_FOUND", message: "User not found", statusCode: 404 });
|
|
214
|
+
return ok(user);
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
This simplifies error handling and reduces duplicated try/catch logic.
|
|
219
|
+
|
|
220
|
+
### Configuration service
|
|
221
|
+
|
|
222
|
+
`ConfigurationService` centralizes loading, defaults, validation, and environment-specific overrides. Access runtime configuration through the container or via `config.get()`.
|
|
223
|
+
|
|
224
|
+
### Feature flags
|
|
225
|
+
|
|
226
|
+
Enable or disable functionality at runtime through `KEYSTONE_FEATURE_FLAGS`:
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
KEYSTONE_FEATURE_FLAGS=beta_oauth=true,experimental_workflows=false
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
Check flags in code:
|
|
233
|
+
|
|
234
|
+
```ts
|
|
235
|
+
const features = getContainer().features;
|
|
236
|
+
if (features.isEnabled("beta_oauth")) { /* ... */ }
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Stack
|
|
242
|
+
|
|
243
|
+
- **Runtime:** Fastify 5 + TypeScript
|
|
244
|
+
- **Database:** Drizzle ORM + `postgres`
|
|
245
|
+
- **Cache / rate limiting:** Redis (ioredis)
|
|
246
|
+
- **Tokens & JWKS:** `jose`
|
|
247
|
+
- **Validation:** `zod`
|
|
248
|
+
- **Password hashing:** `argon2id` with legacy `scrypt` verification
|
|
249
|
+
- **WebAuthn:** `@simplewebauthn/server`
|
|
250
|
+
- **Tracing:** OpenTelemetry
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## Local development
|
|
255
|
+
|
|
256
|
+
### One-command setup (recommended)
|
|
257
|
+
|
|
258
|
+
From `Hilbras/Keystone`:
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
./install.sh # installs backend + frontend deps + Playwright Chromium
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
Launch Keystone. `start.sh` will automatically start PostgreSQL and Redis via Docker if they are not already running. If no `.env` exists (or `DATABASE_URL` is missing), Keystone starts in **setup mode** and opens the browser wizard instead of the main API:
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
./start.sh # starts backend/setup server + frontend together
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
The wizard guides you through:
|
|
271
|
+
|
|
272
|
+
1. Pasting the setup token printed in the server logs.
|
|
273
|
+
2. Choosing an environment profile (Development, Docker Compose, Production).
|
|
274
|
+
3. Configuring and testing PostgreSQL and Redis.
|
|
275
|
+
4. Setting public URLs and allowed origins (advanced mode).
|
|
276
|
+
5. Generating platform secrets (internal API key, encryption key).
|
|
277
|
+
6. Choosing and testing email and SMS providers (advanced mode).
|
|
278
|
+
7. Enabling optional identity connectors (advanced mode).
|
|
279
|
+
8. Creating the first owner account and connecting your first project.
|
|
280
|
+
9. Reviewing diagnostics and completing setup.
|
|
281
|
+
|
|
282
|
+
When finished, the wizard writes `.env`, runs migrations, creates the owner, and optionally restarts the server in normal API mode.
|
|
283
|
+
|
|
284
|
+
### Admin dashboard
|
|
285
|
+
|
|
286
|
+
After setup, the same UI at http://localhost:5173 becomes the **admin dashboard**. Log in with the owner email and password to view:
|
|
287
|
+
|
|
288
|
+
- **Overview** — API health and OIDC discovery endpoints.
|
|
289
|
+
- **Organizations** — all platform organizations.
|
|
290
|
+
- **Applications** — all registered OAuth/OIDC applications.
|
|
291
|
+
- **Connect Project** — copy integration snippets for React, Next.js, Angular, Svelte, Vue, Django, Rails, Go, Python, and HTML.
|
|
292
|
+
- **Users** — all platform users.
|
|
293
|
+
- **Security** — 24h logins, failed logins, active sessions, MFA adoption, and recent activity.
|
|
294
|
+
- **Audit Logs** — recent security events.
|
|
295
|
+
- **Workflows** — configurable post-automation flows.
|
|
296
|
+
- **Settings** — platform configuration and feature flags.
|
|
297
|
+
|
|
298
|
+
### Manual setup
|
|
299
|
+
|
|
300
|
+
If you prefer to manage each part separately:
|
|
301
|
+
|
|
302
|
+
1. Install backend dependencies: `npm install`
|
|
303
|
+
2. Install frontend dependencies: `cd frontend && npm install`
|
|
304
|
+
3. Start Postgres and Redis.
|
|
305
|
+
4. Copy `.env.example` to `.env` and fill in the required values:
|
|
306
|
+
- `DATABASE_URL`
|
|
307
|
+
- `REDIS_URL`
|
|
308
|
+
- `AUTH_API_PUBLIC_URL`
|
|
309
|
+
- `CLIENT_APP_URL`
|
|
310
|
+
- `ALLOWED_ORIGINS`
|
|
311
|
+
- `KEYSTONE_INTERNAL_API_KEY`
|
|
312
|
+
- `KEYSTONE_ENCRYPTION_KEY` (optional in dev)
|
|
313
|
+
- **Zitadel is optional.** If you want to use it, set `ZITADEL_DOMAIN`, `ZITADEL_CLIENT_ID`, and `ZITADEL_CLIENT_SECRET`.
|
|
314
|
+
- To enable Google/GitHub/Azure/Okta/Keycloak federation, set their `*_CLIENT_ID` and `*_CLIENT_SECRET` variables.
|
|
315
|
+
5. Run migrations: `npm run db:migrate`
|
|
316
|
+
6. Start the backend: `npm run dev`
|
|
317
|
+
7. In another terminal, start the frontend: `cd frontend && npm run dev`
|
|
318
|
+
|
|
319
|
+
### Running integration tests locally
|
|
320
|
+
|
|
321
|
+
Start test services with Docker Compose:
|
|
322
|
+
|
|
323
|
+
```bash
|
|
324
|
+
docker compose -f docker-compose.test.yml up -d
|
|
325
|
+
npm test
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### Build verification
|
|
329
|
+
|
|
330
|
+
Before committing or releasing, run the full build and type check:
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
npm run build:all
|
|
334
|
+
npm run typecheck:all
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### Setup frontend E2E tests
|
|
338
|
+
|
|
339
|
+
The setup wizard and post-setup dashboard are tested with Playwright. The E2E suite uses an isolated `hilbras_test` database that is reset automatically before each run. From the project root:
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
npm run test:all
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
Or run only the backend tests or only the E2E tests:
|
|
346
|
+
|
|
347
|
+
```bash
|
|
348
|
+
npm test # backend tests
|
|
349
|
+
cd frontend && npm run test:e2e # Playwright E2E tests
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
## Building for production
|
|
355
|
+
|
|
356
|
+
```bash
|
|
357
|
+
npm ci
|
|
358
|
+
npm run build
|
|
359
|
+
npm start
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
`npm run build` compiles TypeScript and copies migration SQL files into `dist/db/migrations` so they are available at runtime.
|
|
363
|
+
|
|
364
|
+
---
|
|
365
|
+
|
|
366
|
+
## Production deployment
|
|
367
|
+
|
|
368
|
+
### Docker Compose (recommended)
|
|
369
|
+
|
|
370
|
+
1. Copy and customize the environment file:
|
|
371
|
+
|
|
372
|
+
```bash
|
|
373
|
+
cp .env.example .env
|
|
374
|
+
# Edit .env with production secrets, URLs, and provider credentials.
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
2. Start the stack:
|
|
378
|
+
|
|
379
|
+
```bash
|
|
380
|
+
docker compose up -d
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
This launches PostgreSQL, Redis, and the Keystone API container with health checks and restart policies. On first run, set `KEYSTONE_SETUP_MODE=true` in `.env` and visit `http://localhost:4001/setup` to complete the browser wizard.
|
|
384
|
+
|
|
385
|
+
3. View logs:
|
|
386
|
+
|
|
387
|
+
```bash
|
|
388
|
+
docker compose logs -f keystone
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
4. Restart after configuration changes:
|
|
392
|
+
|
|
393
|
+
```bash
|
|
394
|
+
docker compose down && docker compose up -d
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
### systemd service
|
|
398
|
+
|
|
399
|
+
For hosts running Docker with systemd, install the provided unit file:
|
|
400
|
+
|
|
401
|
+
```bash
|
|
402
|
+
sudo cp scripts/keystone.service /etc/systemd/system/hilbras-keystone.service
|
|
403
|
+
sudo systemctl daemon-reload
|
|
404
|
+
sudo systemctl enable --now hilbras-keystone
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
Place the project files in `/opt/hilbras-keystone` and ensure `.env` is present there.
|
|
408
|
+
|
|
409
|
+
### Managed PostgreSQL / Redis
|
|
410
|
+
|
|
411
|
+
For high-availability deployments, replace the bundled `postgres` and `redis` services with managed instances and update `DATABASE_URL` and `REDIS_URL` accordingly. You can then run Keystone with a minimal compose file:
|
|
412
|
+
|
|
413
|
+
```yaml
|
|
414
|
+
services:
|
|
415
|
+
keystone:
|
|
416
|
+
build: .
|
|
417
|
+
ports:
|
|
418
|
+
- "4001:4001"
|
|
419
|
+
env_file: .env
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
---
|
|
423
|
+
|
|
424
|
+
## Key environment variables
|
|
425
|
+
|
|
426
|
+
| Variable | Purpose |
|
|
427
|
+
|----------|---------|
|
|
428
|
+
| `DATABASE_URL` | PostgreSQL connection string |
|
|
429
|
+
| `REDIS_URL` | Redis connection string |
|
|
430
|
+
| `AUTH_API_PUBLIC_URL` | Public URL used for discovery and redirects |
|
|
431
|
+
| `CLIENT_APP_URL` | Default redirect URL after login |
|
|
432
|
+
| `ALLOWED_ORIGINS` | Comma-separated CORS origins |
|
|
433
|
+
| `KEYSTONE_INTERNAL_API_KEY` | Secret for service-to-service calls |
|
|
434
|
+
| `KEYSTONE_ENCRYPTION_KEY` | Master key for encrypted secrets (optional in dev) |
|
|
435
|
+
| `JWT_PRIVATE_KEY` / `JWT_PUBLIC_KEY` | RSA key pair for signing tokens (optional in dev) |
|
|
436
|
+
| `ZITADEL_DOMAIN` | Zitadel instance domain (optional connector) |
|
|
437
|
+
| `ZITADEL_CLIENT_ID` / `ZITADEL_CLIENT_SECRET` | Zitadel OIDC app credentials |
|
|
438
|
+
| `GOOGLE_CLIENT_ID` / `GOOGLE_CLIENT_SECRET` | Google connector credentials |
|
|
439
|
+
| `GITHUB_CLIENT_ID` / `GITHUB_CLIENT_SECRET` | GitHub connector credentials |
|
|
440
|
+
| `AZURE_CLIENT_ID` / `AZURE_CLIENT_SECRET` | Azure connector credentials |
|
|
441
|
+
| `OKTA_ISSUER` / `OKTA_CLIENT_ID` / `OKTA_CLIENT_SECRET` | Okta connector credentials |
|
|
442
|
+
| `KEYCLOAK_ISSUER` / `KEYCLOAK_CLIENT_ID` / `KEYCLOAK_CLIENT_SECRET` | Keycloak connector credentials |
|
|
443
|
+
| `EMAIL_PROVIDER` | `none`, `console`, `smtp`, `sendgrid`, or `mailgun` |
|
|
444
|
+
| `EMAIL_FROM` | Default sender address |
|
|
445
|
+
| `SMTP_HOST` / `SMTP_PORT` / `SMTP_USER` / `SMTP_PASS` / `SMTP_SECURE` | SMTP settings |
|
|
446
|
+
| `SENDGRID_API_KEY` | SendGrid API key |
|
|
447
|
+
| `MAILGUN_API_KEY` / `MAILGUN_DOMAIN` | Mailgun settings |
|
|
448
|
+
| `SMS_PROVIDER` | `none`, `console`, or `twilio` |
|
|
449
|
+
| `TWILIO_ACCOUNT_SID` / `TWILIO_AUTH_TOKEN` / `TWILIO_FROM_NUMBER` / `TWILIO_MESSAGING_SERVICE_SID` | Twilio settings |
|
|
450
|
+
| `AUDIT_WEBHOOK_URL` | Webhook destination for audit events |
|
|
451
|
+
| `AUDIT_CONSOLE_EXPORT` | `true` to log audit events to console |
|
|
452
|
+
| `KEYSTONE_SEED_OWNER_EMAIL` | Default owner email for seeded organization |
|
|
453
|
+
| `KEYSTONE_SEED_OWNER_PASSWORD` | Password for the seed owner |
|
|
454
|
+
| `KEYSTONE_SECRETS_PROVIDER` | `database` (default) or `environment` |
|
|
455
|
+
| `AZURE_KEY_VAULT_URL` | Azure Key Vault URL for the `azure-key-vault` secrets provider |
|
|
456
|
+
| `AZURE_KEY_VAULT_TENANT_ID` / `AZURE_KEY_VAULT_CLIENT_ID` / `AZURE_KEY_VAULT_CLIENT_SECRET` | Azure service principal credentials |
|
|
457
|
+
| `KEYSTONE_QUEUE_PROVIDER` | `in-process`, `bullmq`, or empty to auto-select when Redis is available |
|
|
458
|
+
| `KEYSTONE_PLUGINS` | Comma-separated module paths of plugins to load at startup |
|
|
459
|
+
| `KEYSTONE_FEATURE_FLAGS` | Comma-separated `flag=true|false` runtime feature toggles |
|
|
460
|
+
|
|
461
|
+
---
|
|
462
|
+
|
|
463
|
+
## Integrating with your projects
|
|
464
|
+
|
|
465
|
+
See [`docs/INTEGRATION.md`](docs/INTEGRATION.md) for complete examples covering:
|
|
466
|
+
|
|
467
|
+
- React / Next.js / SPAs (OIDC + PKCE)
|
|
468
|
+
- Backend services and microservices (API keys)
|
|
469
|
+
- Python / FastAPI token verification
|
|
470
|
+
- Mobile apps (system browser + custom URL scheme)
|
|
471
|
+
- CLI scripts
|
|
472
|
+
- Federation through external IdPs
|
|
473
|
+
|
|
474
|
+
If you already have a login/signup page with email/password and Google login and just want to wire it up, start with [`docs/LOGIN_FORM_INTEGRATION.md`](docs/LOGIN_FORM_INTEGRATION.md) or load the one-line CDN script from `http://localhost:4001/sdk/keystone-dropin.js`.
|
|
475
|
+
|
|
476
|
+
For production deployment with HTTPS and a custom domain, see [`docs/DEPLOYMENT.md`](docs/DEPLOYMENT.md).
|
|
477
|
+
|
|
478
|
+
If Keystone feels slow or uses a lot of memory during development, see [`docs/PERFORMANCE.md`](docs/PERFORMANCE.md).
|
|
479
|
+
|
|
480
|
+
## Endpoints
|
|
481
|
+
|
|
482
|
+
### Authentication
|
|
483
|
+
|
|
484
|
+
| Method | Path | Description |
|
|
485
|
+
|--------|------|-------------|
|
|
486
|
+
| POST | `/auth/register` | Email/password signup (local password hashing) |
|
|
487
|
+
| POST | `/auth/login` | Email/password login (sets session cookies) |
|
|
488
|
+
| POST | `/auth/token-login` | Email/password login for SPA/dashboard (returns bearer token) |
|
|
489
|
+
| POST | `/auth/logout` | Revoke session |
|
|
490
|
+
| GET | `/auth/me` | Current user |
|
|
491
|
+
| POST | `/auth/refresh` | Rotate refresh token |
|
|
492
|
+
| GET | `/auth/oauth/:provider` | Start OAuth login (google, github, azure, okta, keycloak, zitadel) |
|
|
493
|
+
| GET | `/auth/callback/:provider` | OAuth callback |
|
|
494
|
+
| POST | `/auth/forgot-password` | Request password reset |
|
|
495
|
+
| POST | `/auth/reset-password` | Complete password reset |
|
|
496
|
+
| POST/GET/DELETE | `/auth/api-keys` | Personal API keys |
|
|
497
|
+
| GET | `/auth/validate` | Internal token/API-key validation |
|
|
498
|
+
|
|
499
|
+
### Federation
|
|
500
|
+
|
|
501
|
+
| Method | Path | Description |
|
|
502
|
+
|--------|------|-------------|
|
|
503
|
+
| GET | `/federation/providers` | List supported federation providers |
|
|
504
|
+
| GET | `/federation/:provider/start` | Start broker login through an external IdP |
|
|
505
|
+
| GET | `/federation/:provider/callback` | Broker callback; issues Keystone tokens |
|
|
506
|
+
| POST | `/federation/link` | Link an external identity to the current user |
|
|
507
|
+
| GET | `/federation/identities` | List linked external identities |
|
|
508
|
+
|
|
509
|
+
### OAuth2 / OIDC
|
|
510
|
+
|
|
511
|
+
| Method | Path | Description |
|
|
512
|
+
|--------|------|-------------|
|
|
513
|
+
| GET | `/oauth2/authorize` | Authorization endpoint (PKCE required) |
|
|
514
|
+
| POST | `/oauth2/token` | Token endpoint |
|
|
515
|
+
| GET | `/oauth2/userinfo` | UserInfo endpoint |
|
|
516
|
+
| POST | `/oauth2/revoke` | Token revocation |
|
|
517
|
+
| POST | `/oauth2/consent` | Grant or revoke consent |
|
|
518
|
+
|
|
519
|
+
### Admin (API-first)
|
|
520
|
+
|
|
521
|
+
| Method | Path | Description |
|
|
522
|
+
|--------|------|-------------|
|
|
523
|
+
| POST/GET | `/v1/admin/organizations` | Create / list organizations for the current user |
|
|
524
|
+
| GET | `/v1/admin/organizations/:id` | Organization details |
|
|
525
|
+
| POST/GET | `/v1/admin/organizations/:id/applications` | Create / list apps |
|
|
526
|
+
| PATCH | `/v1/admin/organizations/:id/applications/:appId` | Update app |
|
|
527
|
+
| POST/GET | `/v1/admin/organizations/:id/invites` | Invite / list invites |
|
|
528
|
+
| GET | `/v1/admin/organizations/:id/members` | List members |
|
|
529
|
+
| PATCH/DELETE | `/v1/admin/organizations/:id/members/:userId` | Update / remove member |
|
|
530
|
+
| GET | `/v1/admin/organizations/:id/users` | List users in org |
|
|
531
|
+
| GET/PATCH/DELETE | `/v1/admin/organizations/:id/users/:userId` | Manage user |
|
|
532
|
+
| GET | `/v1/admin/permissions` | **Owner only** — list all permissions |
|
|
533
|
+
| GET/POST/DELETE | `/v1/admin/roles/:role/permissions` | **Owner only** — manage role permissions |
|
|
534
|
+
| GET/DELETE | `/v1/admin/organizations/:id/api-keys` | Org-scoped API keys |
|
|
535
|
+
| GET | `/v1/admin/organizations/:id/audit-logs` | Paginated audit logs |
|
|
536
|
+
| GET | `/v1/admin/platform/users` | **Owner only** — list all users |
|
|
537
|
+
| GET | `/v1/admin/platform/organizations` | **Owner only** — list all organizations |
|
|
538
|
+
| GET | `/v1/admin/platform/applications` | **Owner only** — list all applications |
|
|
539
|
+
| GET | `/v1/admin/platform/audit-logs` | **Owner only** — list recent audit logs |
|
|
540
|
+
| GET | `/v1/admin/platform/audit-logs/export` | **Owner only** — export audit logs |
|
|
541
|
+
| GET | `/v1/admin/platform/metrics/usage` | **Owner only** — platform usage metrics |
|
|
542
|
+
| GET | `/v1/admin/platform/queue` | **Owner only** — queue stats |
|
|
543
|
+
| GET | `/v1/admin/platform/queue/failed` | **Owner only** — failed jobs |
|
|
544
|
+
| POST | `/v1/admin/platform/queue/failed/:id/retry` | **Owner only** — retry failed job |
|
|
545
|
+
| POST | `/v1/admin/platform/queue/retry-all` | **Owner only** — retry all failed jobs |
|
|
546
|
+
| GET/POST/PATCH/DELETE | `/v1/admin/platform/webhooks` | **Owner only** — webhook management |
|
|
547
|
+
| POST | `/v1/admin/platform/webhooks/:id/rotate-secret` | **Owner only** — rotate webhook secret |
|
|
548
|
+
| GET/POST/DELETE | `/v1/admin/organizations/:id/saml-connections` | SAML connection management |
|
|
549
|
+
| GET | `/v1/admin/organizations/:id/saml-connections/:connectionId/metadata` | SAML SP metadata |
|
|
550
|
+
| GET/POST/DELETE | `/v1/admin/organizations/:id/oidc-connections` | OIDC connection management |
|
|
551
|
+
|
|
552
|
+
### Enterprise SSO
|
|
553
|
+
|
|
554
|
+
| Method | Path | Description |
|
|
555
|
+
|--------|------|-------------|
|
|
556
|
+
| GET | `/saml/:connectionId` | Start SAML SSO login |
|
|
557
|
+
| POST | `/saml/acs` | SAML assertion consumer service |
|
|
558
|
+
| GET | `/saml/:connectionId/metadata` | SAML SP metadata |
|
|
559
|
+
| GET | `/sso/oidc/:connectionId` | Start enterprise OIDC SSO login |
|
|
560
|
+
| GET | `/sso/oidc/:connectionId/callback` | Enterprise OIDC callback |
|
|
561
|
+
|
|
562
|
+
### SCIM Provisioning
|
|
563
|
+
|
|
564
|
+
| Method | Path | Description |
|
|
565
|
+
|--------|------|-------------|
|
|
566
|
+
| GET | `/scim/v2/Users` | List all users (SCIM) |
|
|
567
|
+
| GET | `/scim/v2/Users/:userId` | Get user by ID (SCIM) |
|
|
568
|
+
| POST | `/scim/v2/Users` | Create user (SCIM) |
|
|
569
|
+
| PUT | `/scim/v2/Users/:userId` | Update user (SCIM) |
|
|
570
|
+
| DELETE | `/scim/v2/Users/:userId` | Delete user (SCIM) |
|
|
571
|
+
| GET | `/scim/v2/Groups` | List groups (SCIM) |
|
|
572
|
+
| GET | `/scim/v2/Groups/:groupId` | Get group by ID (SCIM) |
|
|
573
|
+
|
|
574
|
+
### MFA & Security
|
|
575
|
+
|
|
576
|
+
| Method | Path | Description |
|
|
577
|
+
|--------|------|-------------|
|
|
578
|
+
| POST | `/totp/enroll` | Enroll TOTP MFA |
|
|
579
|
+
| POST | `/totp/verify` | Verify TOTP code |
|
|
580
|
+
| POST | `/totp/disable` | Disable TOTP MFA |
|
|
581
|
+
| POST | `/totp/backup` | Verify backup code |
|
|
582
|
+
| POST | `/sms-otp/send` | Send SMS OTP |
|
|
583
|
+
| POST | `/sms-otp/verify` | Verify SMS OTP |
|
|
584
|
+
| POST | `/magic-link/send` | Send magic link |
|
|
585
|
+
| GET | `/magic-link/verify` | Verify magic link |
|
|
586
|
+
| POST | `/email-verification/send` | Send verification email |
|
|
587
|
+
| POST | `/email-verification/request` | Request verification email |
|
|
588
|
+
| GET | `/email-verification/verify` | Verify email token |
|
|
589
|
+
| POST | `/webauthn/register` | Register WebAuthn credential |
|
|
590
|
+
| POST | `/webauthn/authenticate` | Authenticate with WebAuthn |
|
|
591
|
+
|
|
592
|
+
### Sessions
|
|
593
|
+
|
|
594
|
+
| Method | Path | Description |
|
|
595
|
+
|--------|------|-------------|
|
|
596
|
+
| GET | `/sessions` | List active sessions |
|
|
597
|
+
| DELETE | `/sessions/:id` | Revoke session |
|
|
598
|
+
| POST | `/sessions/revoke-all` | Revoke all sessions |
|
|
599
|
+
|
|
600
|
+
### Workflows
|
|
601
|
+
|
|
602
|
+
| Method | Path | Description |
|
|
603
|
+
|--------|------|-------------|
|
|
604
|
+
| GET | `/workflows` | List workflows (requires orgId) |
|
|
605
|
+
| POST | `/workflows` | Create workflow |
|
|
606
|
+
| GET | `/workflows/:id` | Get workflow |
|
|
607
|
+
| DELETE | `/workflows/:id` | Delete workflow |
|
|
608
|
+
| GET | `/workflows/:id/runs` | List workflow runs |
|
|
609
|
+
|
|
610
|
+
### Discovery
|
|
611
|
+
|
|
612
|
+
| Method | Path | Description |
|
|
613
|
+
|--------|------|-------------|
|
|
614
|
+
| GET | `/.well-known/openid-configuration` | OIDC discovery document |
|
|
615
|
+
| GET | `/.well-known/jwks.json` | Public keys for token verification |
|
|
616
|
+
| GET | `/health` | Health check |
|
|
617
|
+
| GET | `/metrics` | Prometheus metrics |
|
|
618
|
+
| GET | `/documentation` | OpenAPI/Swagger UI |
|
|
619
|
+
|
|
620
|
+
---
|
|
621
|
+
|
|
622
|
+
## CLI
|
|
623
|
+
|
|
624
|
+
```bash
|
|
625
|
+
# Rotate the active JWT signing key
|
|
626
|
+
npx keystone secrets:rotate
|
|
627
|
+
|
|
628
|
+
# Generate a JWT key pair for env vars
|
|
629
|
+
npx keystone keys:create
|
|
630
|
+
|
|
631
|
+
# List active JWT signing keys
|
|
632
|
+
npx keystone keys:list
|
|
633
|
+
|
|
634
|
+
# Run migrations
|
|
635
|
+
npx keystone migrate
|
|
636
|
+
|
|
637
|
+
# Validate required configuration
|
|
638
|
+
npx keystone config:validate
|
|
639
|
+
|
|
640
|
+
# Create the first platform owner
|
|
641
|
+
npx keystone user:create --email admin@example.com --password 'Str0ngP@ss!' --role owner
|
|
642
|
+
|
|
643
|
+
# Create an organization from the command line
|
|
644
|
+
npx keystone org:create --name "Acme" --owner-email admin@example.com
|
|
645
|
+
```
|
|
646
|
+
|
|
647
|
+
---
|
|
648
|
+
|
|
649
|
+
## Security non-negotiables
|
|
650
|
+
|
|
651
|
+
- Passwords are never stored in plaintext (argon2id with OWASP parameters).
|
|
652
|
+
- Tokens and secrets are hashed at rest (SHA-256).
|
|
653
|
+
- JWTs are signed with RS256 and keys are rotatable with 24-hour grace period.
|
|
654
|
+
- Rate limiting is applied to all sensitive endpoints (login, register, password reset, magic links, SMS OTP, email verification, org creation).
|
|
655
|
+
- Every authentication decision is audited.
|
|
656
|
+
- Cookies use `HttpOnly`, `Secure`, and `SameSite`.
|
|
657
|
+
- OAuth2 public clients must use PKCE.
|
|
658
|
+
- All admin endpoints require owner or role-based authorization.
|
|
659
|
+
- All workflow operations require organization membership.
|
|
660
|
+
- XML output (SAML metadata) is escaped to prevent injection.
|
|
661
|
+
- Rate limit nonces use cryptographically secure random bytes.
|
|
662
|
+
- Internal implementation details are not exposed in API responses.
|
|
663
|
+
- Input validation uses Zod schemas on all routes.
|
|
664
|
+
- Error messages are sanitized in production mode.
|
|
665
|
+
|
|
666
|
+
---
|
|
667
|
+
|
|
668
|
+
## Documentation
|
|
669
|
+
|
|
670
|
+
Full documentation lives in [`docs/`](docs/README.md):
|
|
671
|
+
|
|
672
|
+
| Document | Purpose |
|
|
673
|
+
| --- | --- |
|
|
674
|
+
| [API reference](docs/API.md) | Every HTTP endpoint with auth requirements |
|
|
675
|
+
| [Architecture](docs/ARCHITECTURE.md) | Layered design, services, events, plugins |
|
|
676
|
+
| [Deployment](docs/DEPLOYMENT.md) | Docker Compose, Kubernetes, systemd, hardening |
|
|
677
|
+
| [Integration guide](docs/INTEGRATION.md) | Connect your apps to Keystone |
|
|
678
|
+
| [Security model](docs/SECURITY.md) | Threat model and hardening checklist |
|
|
679
|
+
| [Performance](docs/PERFORMANCE.md) | Tuning and load-testing notes |
|
|
680
|
+
| [Contributing](docs/CONTRIBUTING.md) | Dev environment and PR process |
|
|
681
|
+
| [Roadmap](docs/ROADMAP.md) | Planned work |
|
|
682
|
+
| [ADRs](docs/adrs/) | Architecture decision records |
|
|
683
|
+
| [Changelog](CHANGELOG.md) | Release history |
|
|
684
|
+
|
|
685
|
+
The running API also serves interactive docs at `/documentation` (Swagger UI).
|
|
686
|
+
|
|
687
|
+
---
|
|
688
|
+
|
|
689
|
+
## License
|
|
690
|
+
|
|
691
|
+
MIT — Hilbras engineering. See [LICENSE](LICENSE).
|