@frontmcp/sdk 0.6.0 → 0.6.2
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/{src/auth → auth}/instances/instance.local-primary-auth.d.ts +1 -1
- package/{src/auth → auth}/instances/instance.remote-primary-auth.d.ts +1 -1
- package/{src/auth → auth}/session/index.d.ts +1 -0
- package/auth/session/vercel-kv-session.store.d.ts +96 -0
- package/{src/common → common}/interfaces/internal/primary-auth-provider.interface.d.ts +1 -4
- package/{src/common → common}/metadata/front-mcp.metadata.d.ts +1779 -67
- package/{src/common → common}/metadata/prompt.metadata.d.ts +4 -0
- package/{src/common → common}/metadata/resource.metadata.d.ts +8 -0
- package/{src/common → common}/metadata/tool-ui.metadata.d.ts +2 -2
- package/{src/common → common}/metadata/tool.metadata.d.ts +4 -0
- package/{src/common → common}/schemas/http-output.schema.d.ts +24 -6
- package/common/types/options/auth/app-auth.schema.d.ts +275 -0
- package/common/types/options/auth/auth.interfaces.d.ts +461 -0
- package/common/types/options/auth/auth.schema.d.ts +284 -0
- package/common/types/options/auth/auth.utils.d.ts +32 -0
- package/common/types/options/auth/index.d.ts +16 -0
- package/common/types/options/auth/orchestrated.schema.d.ts +381 -0
- package/common/types/options/auth/public.schema.d.ts +42 -0
- package/common/types/options/auth/shared.schemas.d.ts +120 -0
- package/common/types/options/auth/transparent.schema.d.ts +56 -0
- package/common/types/options/auth/transport.deprecated.d.ts +63 -0
- package/{src/common → common}/types/options/index.d.ts +1 -1
- package/common/types/options/redis.options.d.ts +190 -0
- package/{src/common → common}/types/options/server-info.options.d.ts +4 -0
- package/{src/common → common}/types/options/transport.options.d.ts +74 -5
- package/{src/common → common}/utils/decide-request-intent.utils.d.ts +6 -7
- package/common/utils/global-config.utils.d.ts +36 -0
- package/{src/common → common}/utils/index.d.ts +1 -0
- package/{src/completion → completion}/flows/complete.flow.d.ts +6 -8
- package/{src/errors → errors}/index.d.ts +1 -1
- package/{src/errors → errors}/mcp.error.d.ts +9 -0
- package/esm/index.mjs +22664 -0
- package/esm/mcp-apps/index.mjs +723 -0
- package/esm/package.json +81 -0
- package/{src/front-mcp → front-mcp}/front-mcp.providers.d.ts +246 -38
- package/front-mcp/index.d.ts +2 -0
- package/{src/index.d.ts → index.d.ts} +1 -1
- package/index.js +22957 -0
- package/logger/logger.tokens.d.ts +1 -0
- package/{src/logging → logging}/flows/set-level.flow.d.ts +6 -8
- package/mcp-apps/index.js +799 -0
- package/package.json +37 -17
- package/{src/prompt → prompt}/flows/get-prompt.flow.d.ts +14 -8
- package/{src/prompt → prompt}/flows/prompts-list.flow.d.ts +8 -7
- package/{src/resource → resource}/flows/read-resource.flow.d.ts +8 -9
- package/{src/resource → resource}/flows/resource-templates-list.flow.d.ts +8 -7
- package/{src/resource → resource}/flows/resources-list.flow.d.ts +8 -7
- package/{src/resource → resource}/flows/subscribe-resource.flow.d.ts +6 -8
- package/{src/resource → resource}/flows/unsubscribe-resource.flow.d.ts +6 -8
- package/store/adapters/store.vercel-kv.adapter.d.ts +86 -0
- package/{src/store → store}/index.d.ts +2 -0
- package/store/store.factory.d.ts +86 -0
- package/{src/tool → tool}/flows/call-tool.flow.d.ts +18 -9
- package/{src/tool → tool}/flows/tools-list.flow.d.ts +9 -8
- package/{src/tool → tool}/ui/index.d.ts +4 -4
- package/{src/tool → tool}/ui/platform-adapters.d.ts +2 -2
- package/{src/tool → tool}/ui/template-helpers.d.ts +5 -7
- package/{src/tool → tool}/ui/ui-resource.handler.d.ts +1 -1
- package/{src/transport → transport}/mcp-handlers/complete-request.handler.d.ts +4 -15
- package/{src/transport → transport}/mcp-handlers/get-prompt-request.handler.d.ts +5 -15
- package/{src/transport → transport}/mcp-handlers/index.d.ts +67 -195
- package/{src/transport → transport}/mcp-handlers/list-prompts-request.handler.d.ts +5 -15
- package/{src/transport → transport}/mcp-handlers/list-resource-templates-request.handler.d.ts +5 -15
- package/{src/transport → transport}/mcp-handlers/list-resources-request.handler.d.ts +5 -15
- package/{src/transport → transport}/mcp-handlers/list-tools-request.handler.d.ts +5 -15
- package/{src/transport → transport}/mcp-handlers/logging-set-level-request.handler.d.ts +3 -14
- package/{src/transport → transport}/mcp-handlers/read-resource-request.handler.d.ts +4 -15
- package/{src/transport → transport}/mcp-handlers/subscribe-request.handler.d.ts +3 -14
- package/{src/transport → transport}/mcp-handlers/unsubscribe-request.handler.d.ts +3 -14
- package/{src/transport → transport}/transport.registry.d.ts +5 -1
- package/README.md +0 -460
- package/src/adapter/adapter.instance.js +0 -70
- package/src/adapter/adapter.instance.js.map +0 -1
- package/src/adapter/adapter.regsitry.js +0 -54
- package/src/adapter/adapter.regsitry.js.map +0 -1
- package/src/adapter/adapter.utils.js +0 -83
- package/src/adapter/adapter.utils.js.map +0 -1
- package/src/app/app.registry.js +0 -66
- package/src/app/app.registry.js.map +0 -1
- package/src/app/app.utils.js +0 -58
- package/src/app/app.utils.js.map +0 -1
- package/src/app/instances/app.local.instance.js +0 -67
- package/src/app/instances/app.local.instance.js.map +0 -1
- package/src/app/instances/app.remote.instance.js +0 -36
- package/src/app/instances/app.remote.instance.js.map +0 -1
- package/src/app/instances/index.js +0 -6
- package/src/app/instances/index.js.map +0 -1
- package/src/auth/auth.registry.js +0 -219
- package/src/auth/auth.registry.js.map +0 -1
- package/src/auth/auth.utils.js +0 -84
- package/src/auth/auth.utils.js.map +0 -1
- package/src/auth/authorization/authorization.class.js +0 -217
- package/src/auth/authorization/authorization.class.js.map +0 -1
- package/src/auth/authorization/authorization.types.js +0 -79
- package/src/auth/authorization/authorization.types.js.map +0 -1
- package/src/auth/authorization/index.js +0 -19
- package/src/auth/authorization/index.js.map +0 -1
- package/src/auth/authorization/orchestrated.authorization.js +0 -306
- package/src/auth/authorization/orchestrated.authorization.js.map +0 -1
- package/src/auth/authorization/public.authorization.js +0 -132
- package/src/auth/authorization/public.authorization.js.map +0 -1
- package/src/auth/authorization/transparent.authorization.js +0 -147
- package/src/auth/authorization/transparent.authorization.js.map +0 -1
- package/src/auth/consent/consent.types.js +0 -119
- package/src/auth/consent/consent.types.js.map +0 -1
- package/src/auth/consent/index.js +0 -13
- package/src/auth/consent/index.js.map +0 -1
- package/src/auth/detection/auth-provider-detection.js +0 -230
- package/src/auth/detection/auth-provider-detection.js.map +0 -1
- package/src/auth/detection/index.js +0 -15
- package/src/auth/detection/index.js.map +0 -1
- package/src/auth/flows/auth.verify.flow.js +0 -379
- package/src/auth/flows/auth.verify.flow.js.map +0 -1
- package/src/auth/flows/oauth.authorize.flow.js +0 -822
- package/src/auth/flows/oauth.authorize.flow.js.map +0 -1
- package/src/auth/flows/oauth.callback.flow.js +0 -357
- package/src/auth/flows/oauth.callback.flow.js.map +0 -1
- package/src/auth/flows/oauth.register.flow.js +0 -201
- package/src/auth/flows/oauth.register.flow.js.map +0 -1
- package/src/auth/flows/oauth.token.flow.js +0 -319
- package/src/auth/flows/oauth.token.flow.js.map +0 -1
- package/src/auth/flows/session.verify.flow.js +0 -304
- package/src/auth/flows/session.verify.flow.js.map +0 -1
- package/src/auth/flows/well-known.jwks.flow.js +0 -89
- package/src/auth/flows/well-known.jwks.flow.js.map +0 -1
- package/src/auth/flows/well-known.oauth-authorization-server.flow.js +0 -122
- package/src/auth/flows/well-known.oauth-authorization-server.flow.js.map +0 -1
- package/src/auth/flows/well-known.prm.flow.js +0 -106
- package/src/auth/flows/well-known.prm.flow.js.map +0 -1
- package/src/auth/instances/instance.local-primary-auth.js +0 -308
- package/src/auth/instances/instance.local-primary-auth.js.map +0 -1
- package/src/auth/instances/instance.remote-primary-auth.js +0 -49
- package/src/auth/instances/instance.remote-primary-auth.js.map +0 -1
- package/src/auth/jwks/dev-key-persistence.js +0 -219
- package/src/auth/jwks/dev-key-persistence.js.map +0 -1
- package/src/auth/jwks/index.js +0 -7
- package/src/auth/jwks/index.js.map +0 -1
- package/src/auth/jwks/jwks.service.js +0 -303
- package/src/auth/jwks/jwks.service.js.map +0 -1
- package/src/auth/jwks/jwks.types.js +0 -3
- package/src/auth/jwks/jwks.types.js.map +0 -1
- package/src/auth/jwks/jwks.utils.js +0 -32
- package/src/auth/jwks/jwks.utils.js.map +0 -1
- package/src/auth/machine-id.js +0 -32
- package/src/auth/machine-id.js.map +0 -1
- package/src/auth/oauth/flows/oauth.authorize.flow.js +0 -33
- package/src/auth/oauth/flows/oauth.authorize.flow.js.map +0 -1
- package/src/auth/oauth/flows/oauth.device-authorization.flow.js +0 -48
- package/src/auth/oauth/flows/oauth.device-authorization.flow.js.map +0 -1
- package/src/auth/oauth/flows/oauth.introspect.flow.js +0 -28
- package/src/auth/oauth/flows/oauth.introspect.flow.js.map +0 -1
- package/src/auth/oauth/flows/oauth.par.flow.js +0 -29
- package/src/auth/oauth/flows/oauth.par.flow.js.map +0 -1
- package/src/auth/oauth/flows/oauth.revoke.flow.js +0 -27
- package/src/auth/oauth/flows/oauth.revoke.flow.js.map +0 -1
- package/src/auth/oauth/flows/oauth.token.flow.js +0 -59
- package/src/auth/oauth/flows/oauth.token.flow.js.map +0 -1
- package/src/auth/oauth/flows/oauth.userinfo.flow.js +0 -24
- package/src/auth/oauth/flows/oauth.userinfo.flow.js.map +0 -1
- package/src/auth/oauth/flows/oidc.logout.flow.js +0 -20
- package/src/auth/oauth/flows/oidc.logout.flow.js.map +0 -1
- package/src/auth/session/authorization-vault.js +0 -817
- package/src/auth/session/authorization-vault.js.map +0 -1
- package/src/auth/session/authorization.store.js +0 -323
- package/src/auth/session/authorization.store.js.map +0 -1
- package/src/auth/session/encrypted-authorization-vault.js +0 -493
- package/src/auth/session/encrypted-authorization-vault.js.map +0 -1
- package/src/auth/session/index.js +0 -16
- package/src/auth/session/index.js.map +0 -1
- package/src/auth/session/record/session.base.js +0 -125
- package/src/auth/session/record/session.base.js.map +0 -1
- package/src/auth/session/record/session.stateful.js +0 -55
- package/src/auth/session/record/session.stateful.js.map +0 -1
- package/src/auth/session/record/session.stateless.js +0 -32
- package/src/auth/session/record/session.stateless.js.map +0 -1
- package/src/auth/session/record/session.transparent.js +0 -22
- package/src/auth/session/record/session.transparent.js.map +0 -1
- package/src/auth/session/redis-session.store.js +0 -204
- package/src/auth/session/redis-session.store.js.map +0 -1
- package/src/auth/session/session.crypto.js +0 -47
- package/src/auth/session/session.crypto.js.map +0 -1
- package/src/auth/session/session.schema.js +0 -13
- package/src/auth/session/session.schema.js.map +0 -1
- package/src/auth/session/session.service.js +0 -105
- package/src/auth/session/session.service.js.map +0 -1
- package/src/auth/session/session.transport.js +0 -20
- package/src/auth/session/session.transport.js.map +0 -1
- package/src/auth/session/session.types.js +0 -4
- package/src/auth/session/session.types.js.map +0 -1
- package/src/auth/session/token.refresh.js +0 -63
- package/src/auth/session/token.refresh.js.map +0 -1
- package/src/auth/session/token.store.js +0 -53
- package/src/auth/session/token.store.js.map +0 -1
- package/src/auth/session/token.vault.js +0 -54
- package/src/auth/session/token.vault.js.map +0 -1
- package/src/auth/session/transport-session.manager.js +0 -298
- package/src/auth/session/transport-session.manager.js.map +0 -1
- package/src/auth/session/transport-session.types.js +0 -111
- package/src/auth/session/transport-session.types.js.map +0 -1
- package/src/auth/session/utils/auth-token.utils.js +0 -57
- package/src/auth/session/utils/auth-token.utils.js.map +0 -1
- package/src/auth/session/utils/session-id.utils.js +0 -217
- package/src/auth/session/utils/session-id.utils.js.map +0 -1
- package/src/auth/session/utils/tiny-ttl-cache.js +0 -26
- package/src/auth/session/utils/tiny-ttl-cache.js.map +0 -1
- package/src/auth/session/vault-encryption.js +0 -263
- package/src/auth/session/vault-encryption.js.map +0 -1
- package/src/auth/ui/base-layout.js +0 -279
- package/src/auth/ui/base-layout.js.map +0 -1
- package/src/auth/ui/index.js +0 -34
- package/src/auth/ui/index.js.map +0 -1
- package/src/auth/ui/templates.js +0 -426
- package/src/auth/ui/templates.js.map +0 -1
- package/src/auth/utils/audience.validator.js +0 -196
- package/src/auth/utils/audience.validator.js.map +0 -1
- package/src/auth/utils/index.js +0 -7
- package/src/auth/utils/index.js.map +0 -1
- package/src/auth/utils/www-authenticate.utils.js +0 -183
- package/src/auth/utils/www-authenticate.utils.js.map +0 -1
- package/src/common/common.schema.js +0 -35
- package/src/common/common.schema.js.map +0 -1
- package/src/common/constants.js +0 -13
- package/src/common/constants.js.map +0 -1
- package/src/common/decorators/adapter.decorator.js +0 -20
- package/src/common/decorators/adapter.decorator.js.map +0 -1
- package/src/common/decorators/app.decorator.js +0 -44
- package/src/common/decorators/app.decorator.js.map +0 -1
- package/src/common/decorators/auth-provider.decorator.js +0 -20
- package/src/common/decorators/auth-provider.decorator.js.map +0 -1
- package/src/common/decorators/decorator-utils.js +0 -195
- package/src/common/decorators/decorator-utils.js.map +0 -1
- package/src/common/decorators/flow.decorator.js +0 -19
- package/src/common/decorators/flow.decorator.js.map +0 -1
- package/src/common/decorators/front-mcp.decorator.js +0 -67
- package/src/common/decorators/front-mcp.decorator.js.map +0 -1
- package/src/common/decorators/hook.decorator.js +0 -178
- package/src/common/decorators/hook.decorator.js.map +0 -1
- package/src/common/decorators/index.js +0 -16
- package/src/common/decorators/index.js.map +0 -1
- package/src/common/decorators/logger.decorator.js +0 -20
- package/src/common/decorators/logger.decorator.js.map +0 -1
- package/src/common/decorators/plugin.decorator.js +0 -39
- package/src/common/decorators/plugin.decorator.js.map +0 -1
- package/src/common/decorators/prompt.decorator.js +0 -38
- package/src/common/decorators/prompt.decorator.js.map +0 -1
- package/src/common/decorators/provider.decorator.js +0 -20
- package/src/common/decorators/provider.decorator.js.map +0 -1
- package/src/common/decorators/resource.decorator.js +0 -94
- package/src/common/decorators/resource.decorator.js.map +0 -1
- package/src/common/decorators/tool.decorator.js +0 -45
- package/src/common/decorators/tool.decorator.js.map +0 -1
- package/src/common/dynamic/dynamic.adapter.js +0 -28
- package/src/common/dynamic/dynamic.adapter.js.map +0 -1
- package/src/common/dynamic/dynamic.plugin.js +0 -42
- package/src/common/dynamic/dynamic.plugin.js.map +0 -1
- package/src/common/dynamic/dynamic.utils.js +0 -27
- package/src/common/dynamic/dynamic.utils.js.map +0 -1
- package/src/common/dynamic/index.js +0 -6
- package/src/common/dynamic/index.js.map +0 -1
- package/src/common/entries/adapter.entry.js +0 -8
- package/src/common/entries/adapter.entry.js.map +0 -1
- package/src/common/entries/app.entry.js +0 -9
- package/src/common/entries/app.entry.js.map +0 -1
- package/src/common/entries/auth-provider.entry.js +0 -8
- package/src/common/entries/auth-provider.entry.js.map +0 -1
- package/src/common/entries/base.entry.js +0 -17
- package/src/common/entries/base.entry.js.map +0 -1
- package/src/common/entries/flow.entry.js +0 -21
- package/src/common/entries/flow.entry.js.map +0 -1
- package/src/common/entries/hook.entry.js +0 -20
- package/src/common/entries/hook.entry.js.map +0 -1
- package/src/common/entries/index.js +0 -17
- package/src/common/entries/index.js.map +0 -1
- package/src/common/entries/logger.entry.js +0 -8
- package/src/common/entries/logger.entry.js.map +0 -1
- package/src/common/entries/plugin.entry.js +0 -8
- package/src/common/entries/plugin.entry.js.map +0 -1
- package/src/common/entries/prompt.entry.js +0 -18
- package/src/common/entries/prompt.entry.js.map +0 -1
- package/src/common/entries/provider.entry.js +0 -8
- package/src/common/entries/provider.entry.js.map +0 -1
- package/src/common/entries/resource.entry.js +0 -35
- package/src/common/entries/resource.entry.js.map +0 -1
- package/src/common/entries/scope.entry.js +0 -14
- package/src/common/entries/scope.entry.js.map +0 -1
- package/src/common/entries/tool.entry.js +0 -31
- package/src/common/entries/tool.entry.js.map +0 -1
- package/src/common/flow/flow.utils.js +0 -96
- package/src/common/flow/flow.utils.js.map +0 -1
- package/src/common/index.js +0 -20
- package/src/common/index.js.map +0 -1
- package/src/common/interfaces/adapter.interface.js +0 -3
- package/src/common/interfaces/adapter.interface.js.map +0 -1
- package/src/common/interfaces/app.interface.js +0 -3
- package/src/common/interfaces/app.interface.js.map +0 -1
- package/src/common/interfaces/auth-hook.interface.js +0 -135
- package/src/common/interfaces/auth-hook.interface.js.map +0 -1
- package/src/common/interfaces/auth-provider.interface.js +0 -18
- package/src/common/interfaces/auth-provider.interface.js.map +0 -1
- package/src/common/interfaces/base.interface.js +0 -3
- package/src/common/interfaces/base.interface.js.map +0 -1
- package/src/common/interfaces/execution-context.interface.js +0 -166
- package/src/common/interfaces/execution-context.interface.js.map +0 -1
- package/src/common/interfaces/flow.interface.js +0 -95
- package/src/common/interfaces/flow.interface.js.map +0 -1
- package/src/common/interfaces/front-mcp.interface.js +0 -3
- package/src/common/interfaces/front-mcp.interface.js.map +0 -1
- package/src/common/interfaces/hook.interface.js +0 -3
- package/src/common/interfaces/hook.interface.js.map +0 -1
- package/src/common/interfaces/index.js +0 -21
- package/src/common/interfaces/index.js.map +0 -1
- package/src/common/interfaces/internal/flow.utils.js +0 -83
- package/src/common/interfaces/internal/flow.utils.js.map +0 -1
- package/src/common/interfaces/internal/index.js +0 -7
- package/src/common/interfaces/internal/index.js.map +0 -1
- package/src/common/interfaces/internal/primary-auth-provider.interface.js +0 -81
- package/src/common/interfaces/internal/primary-auth-provider.interface.js.map +0 -1
- package/src/common/interfaces/internal/registry.interface.js +0 -3
- package/src/common/interfaces/internal/registry.interface.js.map +0 -1
- package/src/common/interfaces/logger.interface.js +0 -10
- package/src/common/interfaces/logger.interface.js.map +0 -1
- package/src/common/interfaces/plugin.interface.js +0 -3
- package/src/common/interfaces/plugin.interface.js.map +0 -1
- package/src/common/interfaces/prompt.interface.js +0 -81
- package/src/common/interfaces/prompt.interface.js.map +0 -1
- package/src/common/interfaces/provider.interface.js +0 -18
- package/src/common/interfaces/provider.interface.js.map +0 -1
- package/src/common/interfaces/resource.interface.js +0 -56
- package/src/common/interfaces/resource.interface.js.map +0 -1
- package/src/common/interfaces/scope.interface.js +0 -3
- package/src/common/interfaces/scope.interface.js.map +0 -1
- package/src/common/interfaces/server.interface.js +0 -18
- package/src/common/interfaces/server.interface.js.map +0 -1
- package/src/common/interfaces/session-hook.interface.js +0 -140
- package/src/common/interfaces/session-hook.interface.js.map +0 -1
- package/src/common/interfaces/tool-hook.interface.js +0 -92
- package/src/common/interfaces/tool-hook.interface.js.map +0 -1
- package/src/common/interfaces/tool.interface.js +0 -117
- package/src/common/interfaces/tool.interface.js.map +0 -1
- package/src/common/metadata/adapter.metadata.js +0 -10
- package/src/common/metadata/adapter.metadata.js.map +0 -1
- package/src/common/metadata/app.metadata.js +0 -30
- package/src/common/metadata/app.metadata.js.map +0 -1
- package/src/common/metadata/auth-provider.metadata.js +0 -19
- package/src/common/metadata/auth-provider.metadata.js.map +0 -1
- package/src/common/metadata/flow.metadata.js +0 -15
- package/src/common/metadata/flow.metadata.js.map +0 -1
- package/src/common/metadata/front-mcp.metadata.js +0 -29
- package/src/common/metadata/front-mcp.metadata.js.map +0 -1
- package/src/common/metadata/hook.metadata.js +0 -3
- package/src/common/metadata/hook.metadata.js.map +0 -1
- package/src/common/metadata/index.js +0 -17
- package/src/common/metadata/index.js.map +0 -1
- package/src/common/metadata/logger.metadata.js +0 -10
- package/src/common/metadata/logger.metadata.js.map +0 -1
- package/src/common/metadata/plugin.metadata.js +0 -18
- package/src/common/metadata/plugin.metadata.js.map +0 -1
- package/src/common/metadata/prompt.metadata.js +0 -27
- package/src/common/metadata/prompt.metadata.js.map +0 -1
- package/src/common/metadata/provider.metadata.js +0 -36
- package/src/common/metadata/provider.metadata.js.map +0 -1
- package/src/common/metadata/resource.metadata.js +0 -31
- package/src/common/metadata/resource.metadata.js.map +0 -1
- package/src/common/metadata/tool-ui.metadata.js +0 -12
- package/src/common/metadata/tool-ui.metadata.js.map +0 -1
- package/src/common/metadata/tool.metadata.js +0 -55
- package/src/common/metadata/tool.metadata.js.map +0 -1
- package/src/common/migrate/auth-transport.migrate.js +0 -140
- package/src/common/migrate/auth-transport.migrate.js.map +0 -1
- package/src/common/migrate/index.js +0 -6
- package/src/common/migrate/index.js.map +0 -1
- package/src/common/providers/base-config.provider.js +0 -128
- package/src/common/providers/base-config.provider.js.map +0 -1
- package/src/common/records/adapter.record.js +0 -11
- package/src/common/records/adapter.record.js.map +0 -1
- package/src/common/records/app.record.js +0 -9
- package/src/common/records/app.record.js.map +0 -1
- package/src/common/records/auth-provider.record.js +0 -12
- package/src/common/records/auth-provider.record.js.map +0 -1
- package/src/common/records/flow.record.js +0 -8
- package/src/common/records/flow.record.js.map +0 -1
- package/src/common/records/hook.record.js +0 -8
- package/src/common/records/hook.record.js.map +0 -1
- package/src/common/records/index.js +0 -16
- package/src/common/records/index.js.map +0 -1
- package/src/common/records/logger.record.js +0 -8
- package/src/common/records/logger.record.js.map +0 -1
- package/src/common/records/plugin.record.js +0 -11
- package/src/common/records/plugin.record.js.map +0 -1
- package/src/common/records/prompt.record.js +0 -9
- package/src/common/records/prompt.record.js.map +0 -1
- package/src/common/records/provider.record.js +0 -14
- package/src/common/records/provider.record.js.map +0 -1
- package/src/common/records/resource.record.js +0 -20
- package/src/common/records/resource.record.js.map +0 -1
- package/src/common/records/scope.record.js +0 -9
- package/src/common/records/scope.record.js.map +0 -1
- package/src/common/records/tool.record.js +0 -9
- package/src/common/records/tool.record.js.map +0 -1
- package/src/common/schemas/annotated-class.schema.js +0 -109
- package/src/common/schemas/annotated-class.schema.js.map +0 -1
- package/src/common/schemas/http-input.schema.js +0 -13
- package/src/common/schemas/http-input.schema.js.map +0 -1
- package/src/common/schemas/http-output.schema.js +0 -321
- package/src/common/schemas/http-output.schema.js.map +0 -1
- package/src/common/schemas/index.js +0 -8
- package/src/common/schemas/index.js.map +0 -1
- package/src/common/schemas/session-header.schema.js +0 -42
- package/src/common/schemas/session-header.schema.js.map +0 -1
- package/src/common/tokens/adapter.tokens.js +0 -11
- package/src/common/tokens/adapter.tokens.js.map +0 -1
- package/src/common/tokens/app.tokens.js +0 -30
- package/src/common/tokens/app.tokens.js.map +0 -1
- package/src/common/tokens/auth-provider.tokens.js +0 -12
- package/src/common/tokens/auth-provider.tokens.js.map +0 -1
- package/src/common/tokens/base.tokens.js +0 -9
- package/src/common/tokens/base.tokens.js.map +0 -1
- package/src/common/tokens/flow-hook.tokens.js +0 -9
- package/src/common/tokens/flow-hook.tokens.js.map +0 -1
- package/src/common/tokens/flow.tokens.js +0 -16
- package/src/common/tokens/flow.tokens.js.map +0 -1
- package/src/common/tokens/front-mcp.tokens.js +0 -24
- package/src/common/tokens/front-mcp.tokens.js.map +0 -1
- package/src/common/tokens/index.js +0 -17
- package/src/common/tokens/index.js.map +0 -1
- package/src/common/tokens/logger.tokens.js +0 -11
- package/src/common/tokens/logger.tokens.js.map +0 -1
- package/src/common/tokens/plugin.tokens.js +0 -18
- package/src/common/tokens/plugin.tokens.js.map +0 -1
- package/src/common/tokens/prompt.tokens.js +0 -14
- package/src/common/tokens/prompt.tokens.js.map +0 -1
- package/src/common/tokens/provider.tokens.js +0 -12
- package/src/common/tokens/provider.tokens.js.map +0 -1
- package/src/common/tokens/resource.tokens.js +0 -28
- package/src/common/tokens/resource.tokens.js.map +0 -1
- package/src/common/tokens/server.tokens.js +0 -11
- package/src/common/tokens/server.tokens.js.map +0 -1
- package/src/common/tokens/tool.tokens.js +0 -21
- package/src/common/tokens/tool.tokens.js.map +0 -1
- package/src/common/types/auth/index.js +0 -6
- package/src/common/types/auth/index.js.map +0 -1
- package/src/common/types/auth/jwt.types.js +0 -36
- package/src/common/types/auth/jwt.types.js.map +0 -1
- package/src/common/types/auth/session.types.js +0 -53
- package/src/common/types/auth/session.types.js.map +0 -1
- package/src/common/types/common.types.js +0 -3
- package/src/common/types/common.types.js.map +0 -1
- package/src/common/types/index.js +0 -7
- package/src/common/types/index.js.map +0 -1
- package/src/common/types/options/auth.options.d.ts +0 -1266
- package/src/common/types/options/auth.options.js +0 -560
- package/src/common/types/options/auth.options.js.map +0 -1
- package/src/common/types/options/http.options.js +0 -10
- package/src/common/types/options/http.options.js.map +0 -1
- package/src/common/types/options/index.js +0 -11
- package/src/common/types/options/index.js.map +0 -1
- package/src/common/types/options/logging.options.js +0 -33
- package/src/common/types/options/logging.options.js.map +0 -1
- package/src/common/types/options/redis.options.d.ts +0 -22
- package/src/common/types/options/redis.options.js +0 -45
- package/src/common/types/options/redis.options.js.map +0 -1
- package/src/common/types/options/server-info.options.js +0 -13
- package/src/common/types/options/server-info.options.js.map +0 -1
- package/src/common/types/options/session.options.js +0 -32
- package/src/common/types/options/session.options.js.map +0 -1
- package/src/common/types/options/transport.options.js +0 -121
- package/src/common/types/options/transport.options.js.map +0 -1
- package/src/common/utils/decide-request-intent.utils.js +0 -391
- package/src/common/utils/decide-request-intent.utils.js.map +0 -1
- package/src/common/utils/index.js +0 -6
- package/src/common/utils/index.js.map +0 -1
- package/src/common/utils/path.utils.js +0 -66
- package/src/common/utils/path.utils.js.map +0 -1
- package/src/completion/flows/complete.flow.js +0 -199
- package/src/completion/flows/complete.flow.js.map +0 -1
- package/src/context/frontmcp-context-storage.js +0 -183
- package/src/context/frontmcp-context-storage.js.map +0 -1
- package/src/context/frontmcp-context.js +0 -360
- package/src/context/frontmcp-context.js.map +0 -1
- package/src/context/frontmcp-context.provider.js +0 -61
- package/src/context/frontmcp-context.provider.js.map +0 -1
- package/src/context/index.js +0 -64
- package/src/context/index.js.map +0 -1
- package/src/context/request-context-storage.js +0 -183
- package/src/context/request-context-storage.js.map +0 -1
- package/src/context/request-context.js +0 -209
- package/src/context/request-context.js.map +0 -1
- package/src/context/request-context.provider.js +0 -51
- package/src/context/request-context.provider.js.map +0 -1
- package/src/context/session-key.provider.js +0 -65
- package/src/context/session-key.provider.js.map +0 -1
- package/src/context/trace-context.js +0 -142
- package/src/context/trace-context.js.map +0 -1
- package/src/errors/authorization-required.error.js +0 -274
- package/src/errors/authorization-required.error.js.map +0 -1
- package/src/errors/error-handler.js +0 -107
- package/src/errors/error-handler.js.map +0 -1
- package/src/errors/index.js +0 -44
- package/src/errors/index.js.map +0 -1
- package/src/errors/mcp.error.js +0 -398
- package/src/errors/mcp.error.js.map +0 -1
- package/src/exceptions/mcp-exceptions/session-missing.exception.js +0 -11
- package/src/exceptions/mcp-exceptions/session-missing.exception.js.map +0 -1
- package/src/exceptions/mcp-exceptions/unsupported-client-version.exception.js +0 -15
- package/src/exceptions/mcp-exceptions/unsupported-client-version.exception.js.map +0 -1
- package/src/flows/flow.instance.js +0 -420
- package/src/flows/flow.instance.js.map +0 -1
- package/src/flows/flow.registry.js +0 -121
- package/src/flows/flow.registry.js.map +0 -1
- package/src/flows/flow.stages.js +0 -113
- package/src/flows/flow.stages.js.map +0 -1
- package/src/flows/flow.utils.js +0 -36
- package/src/flows/flow.utils.js.map +0 -1
- package/src/front-mcp/front-mcp.js +0 -63
- package/src/front-mcp/front-mcp.js.map +0 -1
- package/src/front-mcp/front-mcp.providers.js +0 -29
- package/src/front-mcp/front-mcp.providers.js.map +0 -1
- package/src/front-mcp/front-mcp.tokens.js +0 -5
- package/src/front-mcp/front-mcp.tokens.js.map +0 -1
- package/src/front-mcp/index.d.ts +0 -1
- package/src/front-mcp/index.js +0 -5
- package/src/front-mcp/index.js.map +0 -1
- package/src/front-mcp/serverless-handler.js +0 -61
- package/src/front-mcp/serverless-handler.js.map +0 -1
- package/src/hooks/hook.instance.js +0 -26
- package/src/hooks/hook.instance.js.map +0 -1
- package/src/hooks/hook.registry.js +0 -152
- package/src/hooks/hook.registry.js.map +0 -1
- package/src/hooks/hooks.utils.js +0 -34
- package/src/hooks/hooks.utils.js.map +0 -1
- package/src/index.js +0 -36
- package/src/index.js.map +0 -1
- package/src/logger/instances/instance.console-logger.js +0 -75
- package/src/logger/instances/instance.console-logger.js.map +0 -1
- package/src/logger/instances/instance.logger.js +0 -77
- package/src/logger/instances/instance.logger.js.map +0 -1
- package/src/logger/logger.registry.js +0 -96
- package/src/logger/logger.registry.js.map +0 -1
- package/src/logger/logger.tokens.js +0 -3
- package/src/logger/logger.tokens.js.map +0 -1
- package/src/logger/logger.types.js +0 -8
- package/src/logger/logger.types.js.map +0 -1
- package/src/logger/logger.utils.js +0 -42
- package/src/logger/logger.utils.js.map +0 -1
- package/src/logging/flows/set-level.flow.js +0 -108
- package/src/logging/flows/set-level.flow.js.map +0 -1
- package/src/mcp-apps/csp.js +0 -267
- package/src/mcp-apps/csp.js.map +0 -1
- package/src/mcp-apps/index.js +0 -91
- package/src/mcp-apps/index.js.map +0 -1
- package/src/mcp-apps/schemas.js +0 -345
- package/src/mcp-apps/schemas.js.map +0 -1
- package/src/mcp-apps/template.js +0 -419
- package/src/mcp-apps/template.js.map +0 -1
- package/src/mcp-apps/types.js +0 -59
- package/src/mcp-apps/types.js.map +0 -1
- package/src/notification/index.js +0 -13
- package/src/notification/index.js.map +0 -1
- package/src/notification/notification.service.js +0 -731
- package/src/notification/notification.service.js.map +0 -1
- package/src/plugin/plugin.registry.js +0 -152
- package/src/plugin/plugin.registry.js.map +0 -1
- package/src/plugin/plugin.utils.js +0 -88
- package/src/plugin/plugin.utils.js.map +0 -1
- package/src/prompt/flows/get-prompt.flow.js +0 -214
- package/src/prompt/flows/get-prompt.flow.js.map +0 -1
- package/src/prompt/flows/prompts-list.flow.js +0 -176
- package/src/prompt/flows/prompts-list.flow.js.map +0 -1
- package/src/prompt/index.js +0 -17
- package/src/prompt/index.js.map +0 -1
- package/src/prompt/prompt.events.js +0 -25
- package/src/prompt/prompt.events.js.map +0 -1
- package/src/prompt/prompt.instance.js +0 -120
- package/src/prompt/prompt.instance.js.map +0 -1
- package/src/prompt/prompt.registry.js +0 -380
- package/src/prompt/prompt.registry.js.map +0 -1
- package/src/prompt/prompt.types.js +0 -11
- package/src/prompt/prompt.types.js.map +0 -1
- package/src/prompt/prompt.utils.js +0 -136
- package/src/prompt/prompt.utils.js.map +0 -1
- package/src/provider/provider.registry.js +0 -868
- package/src/provider/provider.registry.js.map +0 -1
- package/src/provider/provider.types.js +0 -3
- package/src/provider/provider.types.js.map +0 -1
- package/src/provider/provider.utils.js +0 -103
- package/src/provider/provider.utils.js.map +0 -1
- package/src/regsitry/index.js +0 -5
- package/src/regsitry/index.js.map +0 -1
- package/src/regsitry/registry.base.js +0 -32
- package/src/regsitry/registry.base.js.map +0 -1
- package/src/resource/flows/read-resource.flow.js +0 -270
- package/src/resource/flows/read-resource.flow.js.map +0 -1
- package/src/resource/flows/resource-templates-list.flow.js +0 -191
- package/src/resource/flows/resource-templates-list.flow.js.map +0 -1
- package/src/resource/flows/resources-list.flow.js +0 -196
- package/src/resource/flows/resources-list.flow.js.map +0 -1
- package/src/resource/flows/subscribe-resource.flow.js +0 -123
- package/src/resource/flows/subscribe-resource.flow.js.map +0 -1
- package/src/resource/flows/unsubscribe-resource.flow.js +0 -107
- package/src/resource/flows/unsubscribe-resource.flow.js.map +0 -1
- package/src/resource/index.js +0 -20
- package/src/resource/index.js.map +0 -1
- package/src/resource/resource.events.js +0 -17
- package/src/resource/resource.events.js.map +0 -1
- package/src/resource/resource.instance.js +0 -163
- package/src/resource/resource.instance.js.map +0 -1
- package/src/resource/resource.registry.js +0 -468
- package/src/resource/resource.registry.js.map +0 -1
- package/src/resource/resource.types.js +0 -11
- package/src/resource/resource.types.js.map +0 -1
- package/src/resource/resource.utils.js +0 -151
- package/src/resource/resource.utils.js.map +0 -1
- package/src/scope/flows/http.request.flow.js +0 -474
- package/src/scope/flows/http.request.flow.js.map +0 -1
- package/src/scope/index.js +0 -6
- package/src/scope/index.js.map +0 -1
- package/src/scope/scope.instance.js +0 -263
- package/src/scope/scope.instance.js.map +0 -1
- package/src/scope/scope.registry.js +0 -94
- package/src/scope/scope.registry.js.map +0 -1
- package/src/scope/scope.utils.js +0 -61
- package/src/scope/scope.utils.js.map +0 -1
- package/src/server/adapters/base.host.adapter.js +0 -8
- package/src/server/adapters/base.host.adapter.js.map +0 -1
- package/src/server/adapters/express.host.adapter.js +0 -70
- package/src/server/adapters/express.host.adapter.js.map +0 -1
- package/src/server/server.instance.js +0 -54
- package/src/server/server.instance.js.map +0 -1
- package/src/server/server.types.js +0 -3
- package/src/server/server.types.js.map +0 -1
- package/src/server/server.validation.js +0 -192
- package/src/server/server.validation.js.map +0 -1
- package/src/store/adapters/store.base.adapter.js +0 -16
- package/src/store/adapters/store.base.adapter.js.map +0 -1
- package/src/store/adapters/store.memory.adapter.js +0 -89
- package/src/store/adapters/store.memory.adapter.js.map +0 -1
- package/src/store/adapters/store.redis.adapter.js +0 -104
- package/src/store/adapters/store.redis.adapter.js.map +0 -1
- package/src/store/index.js +0 -12
- package/src/store/index.js.map +0 -1
- package/src/store/store.helpers.js +0 -67
- package/src/store/store.helpers.js.map +0 -1
- package/src/store/store.registry.js +0 -37
- package/src/store/store.registry.js.map +0 -1
- package/src/store/store.tokens.js +0 -7
- package/src/store/store.tokens.js.map +0 -1
- package/src/store/store.types.js +0 -11
- package/src/store/store.types.js.map +0 -1
- package/src/store/store.utils.js +0 -18
- package/src/store/store.utils.js.map +0 -1
- package/src/tool/flows/call-tool.flow.js +0 -616
- package/src/tool/flows/call-tool.flow.js.map +0 -1
- package/src/tool/flows/tools-list.flow.js +0 -328
- package/src/tool/flows/tools-list.flow.js.map +0 -1
- package/src/tool/tool.events.js +0 -16
- package/src/tool/tool.events.js.map +0 -1
- package/src/tool/tool.instance.js +0 -117
- package/src/tool/tool.instance.js.map +0 -1
- package/src/tool/tool.registry.js +0 -353
- package/src/tool/tool.registry.js.map +0 -1
- package/src/tool/tool.types.js +0 -10
- package/src/tool/tool.types.js.map +0 -1
- package/src/tool/tool.utils.js +0 -366
- package/src/tool/tool.utils.js.map +0 -1
- package/src/tool/ui/index.js +0 -63
- package/src/tool/ui/index.js.map +0 -1
- package/src/tool/ui/platform-adapters.js +0 -18
- package/src/tool/ui/platform-adapters.js.map +0 -1
- package/src/tool/ui/template-helpers.js +0 -112
- package/src/tool/ui/template-helpers.js.map +0 -1
- package/src/tool/ui/ui-resource-template.js +0 -64
- package/src/tool/ui/ui-resource-template.js.map +0 -1
- package/src/tool/ui/ui-resource.handler.js +0 -129
- package/src/tool/ui/ui-resource.handler.js.map +0 -1
- package/src/transport/adapters/transport.local.adapter.js +0 -148
- package/src/transport/adapters/transport.local.adapter.js.map +0 -1
- package/src/transport/adapters/transport.sse.adapter.js +0 -65
- package/src/transport/adapters/transport.sse.adapter.js.map +0 -1
- package/src/transport/adapters/transport.streamable-http.adapter.js +0 -112
- package/src/transport/adapters/transport.streamable-http.adapter.js.map +0 -1
- package/src/transport/flows/handle.sse.flow.js +0 -197
- package/src/transport/flows/handle.sse.flow.js.map +0 -1
- package/src/transport/flows/handle.stateless-http.flow.js +0 -102
- package/src/transport/flows/handle.stateless-http.flow.js.map +0 -1
- package/src/transport/flows/handle.streamable-http.flow.js +0 -315
- package/src/transport/flows/handle.streamable-http.flow.js.map +0 -1
- package/src/transport/legacy/legacy.sse.tranporter.js +0 -185
- package/src/transport/legacy/legacy.sse.tranporter.js.map +0 -1
- package/src/transport/mcp-handlers/Initialized-notification.hanlder.js +0 -14
- package/src/transport/mcp-handlers/Initialized-notification.hanlder.js.map +0 -1
- package/src/transport/mcp-handlers/call-tool-request.handler.js +0 -46
- package/src/transport/mcp-handlers/call-tool-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/complete-request.handler.js +0 -11
- package/src/transport/mcp-handlers/complete-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/get-prompt-request.handler.js +0 -11
- package/src/transport/mcp-handlers/get-prompt-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/index.js +0 -57
- package/src/transport/mcp-handlers/index.js.map +0 -1
- package/src/transport/mcp-handlers/initialize-request.handler.js +0 -109
- package/src/transport/mcp-handlers/initialize-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/list-prompts-request.handler.js +0 -11
- package/src/transport/mcp-handlers/list-prompts-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/list-resource-templates-request.handler.js +0 -12
- package/src/transport/mcp-handlers/list-resource-templates-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/list-resources-request.handler.js +0 -12
- package/src/transport/mcp-handlers/list-resources-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/list-tools-request.handler.js +0 -11
- package/src/transport/mcp-handlers/list-tools-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/logging-set-level-request.handler.js +0 -34
- package/src/transport/mcp-handlers/logging-set-level-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/mcp-handlers.types.js +0 -3
- package/src/transport/mcp-handlers/mcp-handlers.types.js.map +0 -1
- package/src/transport/mcp-handlers/read-resource-request.handler.js +0 -12
- package/src/transport/mcp-handlers/read-resource-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/roots-list-changed-notification.handler.js +0 -26
- package/src/transport/mcp-handlers/roots-list-changed-notification.handler.js.map +0 -1
- package/src/transport/mcp-handlers/subscribe-request.handler.js +0 -34
- package/src/transport/mcp-handlers/subscribe-request.handler.js.map +0 -1
- package/src/transport/mcp-handlers/unsubscribe-request.handler.js +0 -34
- package/src/transport/mcp-handlers/unsubscribe-request.handler.js.map +0 -1
- package/src/transport/transport.error.js +0 -25
- package/src/transport/transport.error.js.map +0 -1
- package/src/transport/transport.event-store.js +0 -36
- package/src/transport/transport.event-store.js.map +0 -1
- package/src/transport/transport.local.js +0 -71
- package/src/transport/transport.local.js.map +0 -1
- package/src/transport/transport.registry.js +0 -523
- package/src/transport/transport.registry.js.map +0 -1
- package/src/transport/transport.remote.js +0 -31
- package/src/transport/transport.remote.js.map +0 -1
- package/src/transport/transport.types.js +0 -3
- package/src/transport/transport.types.js.map +0 -1
- package/src/types/drinen-hooks.types.js +0 -3
- package/src/types/drinen-hooks.types.js.map +0 -1
- package/src/types/invoke.type.js +0 -34
- package/src/types/invoke.type.js.map +0 -1
- package/src/types/token.types.js +0 -3
- package/src/types/token.types.js.map +0 -1
- package/src/utils/content.utils.js +0 -194
- package/src/utils/content.utils.js.map +0 -1
- package/src/utils/index.js +0 -55
- package/src/utils/index.js.map +0 -1
- package/src/utils/lineage.utils.js +0 -82
- package/src/utils/lineage.utils.js.map +0 -1
- package/src/utils/metadata.utils.js +0 -26
- package/src/utils/metadata.utils.js.map +0 -1
- package/src/utils/naming.utils.js +0 -136
- package/src/utils/naming.utils.js.map +0 -1
- package/src/utils/server.utils.js +0 -59
- package/src/utils/server.utils.js.map +0 -1
- package/src/utils/string.utils.js +0 -10
- package/src/utils/string.utils.js.map +0 -1
- package/src/utils/token.utils.js +0 -65
- package/src/utils/token.utils.js.map +0 -1
- package/src/utils/types.utils.js +0 -3
- package/src/utils/types.utils.js.map +0 -1
- package/src/utils/uri-template.utils.js +0 -113
- package/src/utils/uri-template.utils.js.map +0 -1
- package/src/utils/uri-validation.utils.js +0 -76
- package/src/utils/uri-validation.utils.js.map +0 -1
- package/{src/adapter → adapter}/adapter.instance.d.ts +0 -0
- package/{src/adapter → adapter}/adapter.regsitry.d.ts +0 -0
- package/{src/adapter → adapter}/adapter.utils.d.ts +0 -0
- package/{src/app → app}/app.registry.d.ts +0 -0
- package/{src/app → app}/app.utils.d.ts +0 -0
- package/{src/app → app}/instances/app.local.instance.d.ts +0 -0
- package/{src/app → app}/instances/app.remote.instance.d.ts +0 -0
- package/{src/app → app}/instances/index.d.ts +0 -0
- package/{src/auth → auth}/auth.registry.d.ts +0 -0
- package/{src/auth → auth}/auth.utils.d.ts +0 -0
- package/{src/auth → auth}/authorization/authorization.class.d.ts +0 -0
- package/{src/auth → auth}/authorization/authorization.types.d.ts +0 -0
- package/{src/auth → auth}/authorization/index.d.ts +0 -0
- package/{src/auth → auth}/authorization/orchestrated.authorization.d.ts +0 -0
- package/{src/auth → auth}/authorization/public.authorization.d.ts +0 -0
- package/{src/auth → auth}/authorization/transparent.authorization.d.ts +0 -0
- package/{src/auth → auth}/consent/consent.types.d.ts +0 -0
- package/{src/auth → auth}/consent/index.d.ts +0 -0
- package/{src/auth → auth}/detection/auth-provider-detection.d.ts +0 -0
- package/{src/auth → auth}/detection/index.d.ts +0 -0
- package/{src/auth → auth}/flows/auth.verify.flow.d.ts +0 -0
- package/{src/auth → auth}/flows/oauth.authorize.flow.d.ts +0 -0
- package/{src/auth → auth}/flows/oauth.callback.flow.d.ts +0 -0
- package/{src/auth → auth}/flows/oauth.register.flow.d.ts +0 -0
- package/{src/auth → auth}/flows/oauth.token.flow.d.ts +0 -0
- package/{src/auth → auth}/flows/session.verify.flow.d.ts +0 -0
- package/{src/auth → auth}/flows/well-known.jwks.flow.d.ts +0 -0
- package/{src/auth → auth}/flows/well-known.oauth-authorization-server.flow.d.ts +0 -0
- package/{src/auth → auth}/flows/well-known.prm.flow.d.ts +0 -0
- package/{src/auth → auth}/jwks/dev-key-persistence.d.ts +0 -0
- package/{src/auth → auth}/jwks/index.d.ts +0 -0
- package/{src/auth → auth}/jwks/jwks.service.d.ts +0 -0
- package/{src/auth → auth}/jwks/jwks.types.d.ts +0 -0
- package/{src/auth → auth}/jwks/jwks.utils.d.ts +0 -0
- package/{src/auth → auth}/machine-id.d.ts +0 -0
- package/{src/auth → auth}/oauth/flows/oauth.authorize.flow.d.ts +0 -0
- package/{src/auth → auth}/oauth/flows/oauth.device-authorization.flow.d.ts +0 -0
- package/{src/auth → auth}/oauth/flows/oauth.introspect.flow.d.ts +0 -0
- package/{src/auth → auth}/oauth/flows/oauth.par.flow.d.ts +0 -0
- package/{src/auth → auth}/oauth/flows/oauth.revoke.flow.d.ts +0 -0
- package/{src/auth → auth}/oauth/flows/oauth.token.flow.d.ts +0 -0
- package/{src/auth → auth}/oauth/flows/oauth.userinfo.flow.d.ts +0 -0
- package/{src/auth → auth}/oauth/flows/oidc.logout.flow.d.ts +0 -0
- package/{src/auth → auth}/session/authorization-vault.d.ts +0 -0
- package/{src/auth → auth}/session/authorization.store.d.ts +0 -0
- package/{src/auth → auth}/session/encrypted-authorization-vault.d.ts +0 -0
- package/{src/auth → auth}/session/record/session.base.d.ts +0 -0
- package/{src/auth → auth}/session/record/session.stateful.d.ts +0 -0
- package/{src/auth → auth}/session/record/session.stateless.d.ts +0 -0
- package/{src/auth → auth}/session/record/session.transparent.d.ts +0 -0
- package/{src/auth → auth}/session/redis-session.store.d.ts +0 -0
- package/{src/auth → auth}/session/session.crypto.d.ts +0 -0
- package/{src/auth → auth}/session/session.schema.d.ts +0 -0
- package/{src/auth → auth}/session/session.service.d.ts +0 -0
- package/{src/auth → auth}/session/session.transport.d.ts +0 -0
- package/{src/auth → auth}/session/session.types.d.ts +0 -0
- package/{src/auth → auth}/session/token.refresh.d.ts +0 -0
- package/{src/auth → auth}/session/token.store.d.ts +0 -0
- package/{src/auth → auth}/session/token.vault.d.ts +0 -0
- package/{src/auth → auth}/session/transport-session.manager.d.ts +0 -0
- package/{src/auth → auth}/session/transport-session.types.d.ts +0 -0
- package/{src/auth → auth}/session/utils/auth-token.utils.d.ts +0 -0
- package/{src/auth → auth}/session/utils/session-id.utils.d.ts +0 -0
- package/{src/auth → auth}/session/utils/tiny-ttl-cache.d.ts +0 -0
- package/{src/auth → auth}/session/vault-encryption.d.ts +0 -0
- package/{src/auth → auth}/ui/base-layout.d.ts +0 -0
- package/{src/auth → auth}/ui/index.d.ts +0 -0
- package/{src/auth → auth}/ui/templates.d.ts +0 -0
- package/{src/auth → auth}/utils/audience.validator.d.ts +0 -0
- package/{src/auth → auth}/utils/index.d.ts +0 -0
- package/{src/auth → auth}/utils/www-authenticate.utils.d.ts +0 -0
- package/{src/common → common}/common.schema.d.ts +0 -0
- package/{src/common → common}/constants.d.ts +0 -0
- package/{src/common → common}/decorators/adapter.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/app.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/auth-provider.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/decorator-utils.d.ts +0 -0
- package/{src/common → common}/decorators/flow.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/front-mcp.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/hook.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/index.d.ts +0 -0
- package/{src/common → common}/decorators/logger.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/plugin.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/prompt.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/provider.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/resource.decorator.d.ts +0 -0
- package/{src/common → common}/decorators/tool.decorator.d.ts +0 -0
- package/{src/common → common}/dynamic/dynamic.adapter.d.ts +0 -0
- package/{src/common → common}/dynamic/dynamic.plugin.d.ts +0 -0
- package/{src/common → common}/dynamic/dynamic.utils.d.ts +0 -0
- package/{src/common → common}/dynamic/index.d.ts +0 -0
- package/{src/common → common}/entries/adapter.entry.d.ts +0 -0
- package/{src/common → common}/entries/app.entry.d.ts +0 -0
- package/{src/common → common}/entries/auth-provider.entry.d.ts +0 -0
- package/{src/common → common}/entries/base.entry.d.ts +0 -0
- package/{src/common → common}/entries/flow.entry.d.ts +0 -0
- package/{src/common → common}/entries/hook.entry.d.ts +0 -0
- package/{src/common → common}/entries/index.d.ts +0 -0
- package/{src/common → common}/entries/logger.entry.d.ts +0 -0
- package/{src/common → common}/entries/plugin.entry.d.ts +0 -0
- package/{src/common → common}/entries/prompt.entry.d.ts +0 -0
- package/{src/common → common}/entries/provider.entry.d.ts +0 -0
- package/{src/common → common}/entries/resource.entry.d.ts +0 -0
- package/{src/common → common}/entries/scope.entry.d.ts +0 -0
- package/{src/common → common}/entries/tool.entry.d.ts +0 -0
- package/{src/common → common}/flow/flow.utils.d.ts +0 -0
- package/{src/common → common}/index.d.ts +0 -0
- package/{src/common → common}/interfaces/adapter.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/app.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/auth-hook.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/auth-provider.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/base.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/execution-context.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/flow.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/front-mcp.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/hook.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/index.d.ts +0 -0
- package/{src/common → common}/interfaces/internal/flow.utils.d.ts +0 -0
- package/{src/common → common}/interfaces/internal/index.d.ts +0 -0
- package/{src/common → common}/interfaces/internal/registry.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/logger.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/plugin.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/prompt.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/provider.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/resource.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/scope.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/server.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/session-hook.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/tool-hook.interface.d.ts +0 -0
- package/{src/common → common}/interfaces/tool.interface.d.ts +0 -0
- package/{src/common → common}/metadata/adapter.metadata.d.ts +0 -0
- package/{src/common → common}/metadata/app.metadata.d.ts +42 -42
- /package/{src/common → common}/metadata/auth-provider.metadata.d.ts +0 -0
- /package/{src/common → common}/metadata/flow.metadata.d.ts +0 -0
- /package/{src/common → common}/metadata/hook.metadata.d.ts +0 -0
- /package/{src/common → common}/metadata/index.d.ts +0 -0
- /package/{src/common → common}/metadata/logger.metadata.d.ts +0 -0
- /package/{src/common → common}/metadata/plugin.metadata.d.ts +0 -0
- /package/{src/common → common}/metadata/provider.metadata.d.ts +0 -0
- /package/{src/common → common}/migrate/auth-transport.migrate.d.ts +0 -0
- /package/{src/common → common}/migrate/index.d.ts +0 -0
- /package/{src/common → common}/providers/base-config.provider.d.ts +0 -0
- /package/{src/common → common}/records/adapter.record.d.ts +0 -0
- /package/{src/common → common}/records/app.record.d.ts +0 -0
- /package/{src/common → common}/records/auth-provider.record.d.ts +0 -0
- /package/{src/common → common}/records/flow.record.d.ts +0 -0
- /package/{src/common → common}/records/hook.record.d.ts +0 -0
- /package/{src/common → common}/records/index.d.ts +0 -0
- /package/{src/common → common}/records/logger.record.d.ts +0 -0
- /package/{src/common → common}/records/plugin.record.d.ts +0 -0
- /package/{src/common → common}/records/prompt.record.d.ts +0 -0
- /package/{src/common → common}/records/provider.record.d.ts +0 -0
- /package/{src/common → common}/records/resource.record.d.ts +0 -0
- /package/{src/common → common}/records/scope.record.d.ts +0 -0
- /package/{src/common → common}/records/tool.record.d.ts +0 -0
- /package/{src/common → common}/schemas/annotated-class.schema.d.ts +0 -0
- /package/{src/common → common}/schemas/http-input.schema.d.ts +0 -0
- /package/{src/common → common}/schemas/index.d.ts +0 -0
- /package/{src/common → common}/schemas/session-header.schema.d.ts +0 -0
- /package/{src/common → common}/tokens/adapter.tokens.d.ts +0 -0
- /package/{src/common → common}/tokens/app.tokens.d.ts +0 -0
- /package/{src/common → common}/tokens/auth-provider.tokens.d.ts +0 -0
- /package/{src/common → common}/tokens/base.tokens.d.ts +0 -0
- /package/{src/common → common}/tokens/flow-hook.tokens.d.ts +0 -0
- /package/{src/common → common}/tokens/flow.tokens.d.ts +0 -0
- /package/{src/common → common}/tokens/front-mcp.tokens.d.ts +0 -0
- /package/{src/common → common}/tokens/index.d.ts +0 -0
- /package/{src/common → common}/tokens/logger.tokens.d.ts +0 -0
- /package/{src/common → common}/tokens/plugin.tokens.d.ts +0 -0
- /package/{src/common → common}/tokens/prompt.tokens.d.ts +0 -0
- /package/{src/common → common}/tokens/provider.tokens.d.ts +0 -0
- /package/{src/common → common}/tokens/resource.tokens.d.ts +0 -0
- /package/{src/common → common}/tokens/server.tokens.d.ts +0 -0
- /package/{src/common → common}/tokens/tool.tokens.d.ts +0 -0
- /package/{src/common → common}/types/auth/index.d.ts +0 -0
- /package/{src/common → common}/types/auth/jwt.types.d.ts +0 -0
- /package/{src/common → common}/types/auth/session.types.d.ts +0 -0
- /package/{src/common → common}/types/common.types.d.ts +0 -0
- /package/{src/common → common}/types/index.d.ts +0 -0
- /package/{src/logger/logger.tokens.d.ts → common/types/options/auth/auth.typecheck.d.ts} +0 -0
- /package/{src/common → common}/types/options/http.options.d.ts +0 -0
- /package/{src/common → common}/types/options/logging.options.d.ts +0 -0
- /package/{src/common → common}/types/options/session.options.d.ts +0 -0
- /package/{src/common → common}/utils/path.utils.d.ts +0 -0
- /package/{src/context → context}/frontmcp-context-storage.d.ts +0 -0
- /package/{src/context → context}/frontmcp-context.d.ts +0 -0
- /package/{src/context → context}/frontmcp-context.provider.d.ts +0 -0
- /package/{src/context → context}/index.d.ts +0 -0
- /package/{src/context → context}/request-context-storage.d.ts +0 -0
- /package/{src/context → context}/request-context.d.ts +0 -0
- /package/{src/context → context}/request-context.provider.d.ts +0 -0
- /package/{src/context → context}/session-key.provider.d.ts +0 -0
- /package/{src/context → context}/trace-context.d.ts +0 -0
- /package/{src/errors → errors}/authorization-required.error.d.ts +0 -0
- /package/{src/errors → errors}/error-handler.d.ts +0 -0
- /package/{src/exceptions → exceptions}/mcp-exceptions/session-missing.exception.d.ts +0 -0
- /package/{src/exceptions → exceptions}/mcp-exceptions/unsupported-client-version.exception.d.ts +0 -0
- /package/{src/flows → flows}/flow.instance.d.ts +0 -0
- /package/{src/flows → flows}/flow.registry.d.ts +0 -0
- /package/{src/flows → flows}/flow.stages.d.ts +0 -0
- /package/{src/flows → flows}/flow.utils.d.ts +0 -0
- /package/{src/front-mcp → front-mcp}/front-mcp.d.ts +0 -0
- /package/{src/front-mcp → front-mcp}/front-mcp.tokens.d.ts +0 -0
- /package/{src/front-mcp → front-mcp}/serverless-handler.d.ts +0 -0
- /package/{src/hooks → hooks}/hook.instance.d.ts +0 -0
- /package/{src/hooks → hooks}/hook.registry.d.ts +0 -0
- /package/{src/hooks → hooks}/hooks.utils.d.ts +0 -0
- /package/{src/logger → logger}/instances/instance.console-logger.d.ts +0 -0
- /package/{src/logger → logger}/instances/instance.logger.d.ts +0 -0
- /package/{src/logger → logger}/logger.registry.d.ts +0 -0
- /package/{src/logger → logger}/logger.types.d.ts +0 -0
- /package/{src/logger → logger}/logger.utils.d.ts +0 -0
- /package/{src/mcp-apps → mcp-apps}/csp.d.ts +0 -0
- /package/{src/mcp-apps → mcp-apps}/index.d.ts +0 -0
- /package/{src/mcp-apps → mcp-apps}/schemas.d.ts +0 -0
- /package/{src/mcp-apps → mcp-apps}/template.d.ts +0 -0
- /package/{src/mcp-apps → mcp-apps}/types.d.ts +0 -0
- /package/{src/notification → notification}/index.d.ts +0 -0
- /package/{src/notification → notification}/notification.service.d.ts +0 -0
- /package/{src/plugin → plugin}/plugin.registry.d.ts +0 -0
- /package/{src/plugin → plugin}/plugin.utils.d.ts +0 -0
- /package/{src/prompt → prompt}/index.d.ts +0 -0
- /package/{src/prompt → prompt}/prompt.events.d.ts +0 -0
- /package/{src/prompt → prompt}/prompt.instance.d.ts +0 -0
- /package/{src/prompt → prompt}/prompt.registry.d.ts +0 -0
- /package/{src/prompt → prompt}/prompt.types.d.ts +0 -0
- /package/{src/prompt → prompt}/prompt.utils.d.ts +0 -0
- /package/{src/provider → provider}/provider.registry.d.ts +0 -0
- /package/{src/provider → provider}/provider.types.d.ts +0 -0
- /package/{src/provider → provider}/provider.utils.d.ts +0 -0
- /package/{src/regsitry → regsitry}/index.d.ts +0 -0
- /package/{src/regsitry → regsitry}/registry.base.d.ts +0 -0
- /package/{src/resource → resource}/index.d.ts +0 -0
- /package/{src/resource → resource}/resource.events.d.ts +0 -0
- /package/{src/resource → resource}/resource.instance.d.ts +0 -0
- /package/{src/resource → resource}/resource.registry.d.ts +0 -0
- /package/{src/resource → resource}/resource.types.d.ts +0 -0
- /package/{src/resource → resource}/resource.utils.d.ts +0 -0
- /package/{src/scope → scope}/flows/http.request.flow.d.ts +0 -0
- /package/{src/scope → scope}/index.d.ts +0 -0
- /package/{src/scope → scope}/scope.instance.d.ts +0 -0
- /package/{src/scope → scope}/scope.registry.d.ts +0 -0
- /package/{src/scope → scope}/scope.utils.d.ts +0 -0
- /package/{src/server → server}/adapters/base.host.adapter.d.ts +0 -0
- /package/{src/server → server}/adapters/express.host.adapter.d.ts +0 -0
- /package/{src/server → server}/server.instance.d.ts +0 -0
- /package/{src/server → server}/server.types.d.ts +0 -0
- /package/{src/server → server}/server.validation.d.ts +0 -0
- /package/{src/store → store}/adapters/store.base.adapter.d.ts +0 -0
- /package/{src/store → store}/adapters/store.memory.adapter.d.ts +0 -0
- /package/{src/store → store}/adapters/store.redis.adapter.d.ts +0 -0
- /package/{src/store → store}/store.helpers.d.ts +0 -0
- /package/{src/store → store}/store.registry.d.ts +0 -0
- /package/{src/store → store}/store.tokens.d.ts +0 -0
- /package/{src/store → store}/store.types.d.ts +0 -0
- /package/{src/store → store}/store.utils.d.ts +0 -0
- /package/{src/tool → tool}/tool.events.d.ts +0 -0
- /package/{src/tool → tool}/tool.instance.d.ts +0 -0
- /package/{src/tool → tool}/tool.registry.d.ts +0 -0
- /package/{src/tool → tool}/tool.types.d.ts +0 -0
- /package/{src/tool → tool}/tool.utils.d.ts +0 -0
- /package/{src/tool → tool}/ui/ui-resource-template.d.ts +0 -0
- /package/{src/transport → transport}/adapters/transport.local.adapter.d.ts +0 -0
- /package/{src/transport → transport}/adapters/transport.sse.adapter.d.ts +0 -0
- /package/{src/transport → transport}/adapters/transport.streamable-http.adapter.d.ts +0 -0
- /package/{src/transport → transport}/flows/handle.sse.flow.d.ts +0 -0
- /package/{src/transport → transport}/flows/handle.stateless-http.flow.d.ts +0 -0
- /package/{src/transport → transport}/flows/handle.streamable-http.flow.d.ts +0 -0
- /package/{src/transport → transport}/legacy/legacy.sse.tranporter.d.ts +0 -0
- /package/{src/transport → transport}/mcp-handlers/Initialized-notification.hanlder.d.ts +0 -0
- /package/{src/transport → transport}/mcp-handlers/call-tool-request.handler.d.ts +0 -0
- /package/{src/transport → transport}/mcp-handlers/initialize-request.handler.d.ts +0 -0
- /package/{src/transport → transport}/mcp-handlers/mcp-handlers.types.d.ts +0 -0
- /package/{src/transport → transport}/mcp-handlers/roots-list-changed-notification.handler.d.ts +0 -0
- /package/{src/transport → transport}/transport.error.d.ts +0 -0
- /package/{src/transport → transport}/transport.event-store.d.ts +0 -0
- /package/{src/transport → transport}/transport.local.d.ts +0 -0
- /package/{src/transport → transport}/transport.remote.d.ts +0 -0
- /package/{src/transport → transport}/transport.types.d.ts +0 -0
- /package/{src/types → types}/drinen-hooks.types.d.ts +0 -0
- /package/{src/types → types}/invoke.type.d.ts +0 -0
- /package/{src/types → types}/token.types.d.ts +0 -0
- /package/{src/utils → utils}/content.utils.d.ts +0 -0
- /package/{src/utils → utils}/index.d.ts +0 -0
- /package/{src/utils → utils}/lineage.utils.d.ts +0 -0
- /package/{src/utils → utils}/metadata.utils.d.ts +0 -0
- /package/{src/utils → utils}/naming.utils.d.ts +0 -0
- /package/{src/utils → utils}/server.utils.d.ts +0 -0
- /package/{src/utils → utils}/string.utils.d.ts +0 -0
- /package/{src/utils → utils}/token.utils.d.ts +0 -0
- /package/{src/utils → utils}/types.utils.d.ts +0 -0
- /package/{src/utils → utils}/uri-template.utils.d.ts +0 -0
- /package/{src/utils → utils}/uri-validation.utils.d.ts +0 -0
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// auth/session/record/session.base.ts
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.SessionView = exports.Session = void 0;
|
|
5
|
-
const session_transport_1 = require("../session.transport");
|
|
6
|
-
class Session {
|
|
7
|
-
// ---------------- public immutable data ----------------
|
|
8
|
-
id;
|
|
9
|
-
createdAt;
|
|
10
|
-
scopeId;
|
|
11
|
-
user;
|
|
12
|
-
claims;
|
|
13
|
-
/** Epoch millis when the bearer token expires (if available). */
|
|
14
|
-
expiresAt;
|
|
15
|
-
authorizedProviders;
|
|
16
|
-
authorizedProviderIds;
|
|
17
|
-
authorizedApps;
|
|
18
|
-
authorizedAppIds;
|
|
19
|
-
authorizedResources;
|
|
20
|
-
scopes;
|
|
21
|
-
authorizedTools;
|
|
22
|
-
authorizedToolIds;
|
|
23
|
-
authorizedPrompts;
|
|
24
|
-
authorizedPromptIds;
|
|
25
|
-
// ---------------- private/shared ----------------
|
|
26
|
-
#scope;
|
|
27
|
-
#issuer;
|
|
28
|
-
token;
|
|
29
|
-
#activeTransportId;
|
|
30
|
-
constructor(ctx) {
|
|
31
|
-
this.id = ctx.id;
|
|
32
|
-
this.createdAt = ctx.createdAt || Date.now();
|
|
33
|
-
this.#scope = ctx.scope;
|
|
34
|
-
this.#issuer = ctx.issuer;
|
|
35
|
-
this.scopeId = ctx.scope.id;
|
|
36
|
-
this.user = ctx.user;
|
|
37
|
-
this.claims = ctx.claims;
|
|
38
|
-
// derive token expiration from JWT claims if present (exp in seconds)
|
|
39
|
-
const exp = ctx.claims && typeof ctx.claims['exp'] === 'number' ? Number(ctx.claims['exp']) : undefined;
|
|
40
|
-
if (exp) {
|
|
41
|
-
this.expiresAt = exp > 1e12 ? exp : exp * 1000;
|
|
42
|
-
}
|
|
43
|
-
// project authorized fields (defaults to empty)
|
|
44
|
-
this.authorizedProviders = ctx.authorizedProviders ?? {};
|
|
45
|
-
this.authorizedProviderIds = ctx.authorizedProviderIds ?? [];
|
|
46
|
-
this.authorizedApps = ctx.authorizedApps ?? {};
|
|
47
|
-
this.authorizedAppIds = ctx.authorizedAppIds ?? [];
|
|
48
|
-
this.authorizedResources = ctx.authorizedResources ?? [];
|
|
49
|
-
this.authorizedTools = ctx.authorizedTools ?? {};
|
|
50
|
-
this.authorizedToolIds = ctx.authorizedToolIds ?? [];
|
|
51
|
-
this.authorizedPrompts = ctx.authorizedPrompts ?? {};
|
|
52
|
-
this.authorizedPromptIds = ctx.authorizedPromptIds ?? [];
|
|
53
|
-
this.token = ctx.token;
|
|
54
|
-
this.#activeTransportId = ctx.sessionId;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Get the scope associated with this session.
|
|
58
|
-
* Can be used by subclasses to implement custom scope handling.
|
|
59
|
-
* @protected
|
|
60
|
-
*/
|
|
61
|
-
get scope() {
|
|
62
|
-
return this.#scope;
|
|
63
|
-
}
|
|
64
|
-
// ---------------- accessors ----------------
|
|
65
|
-
get issuer() {
|
|
66
|
-
return this.#issuer;
|
|
67
|
-
}
|
|
68
|
-
async getTransportSessionId() {
|
|
69
|
-
if (this.#activeTransportId)
|
|
70
|
-
return this.#activeTransportId;
|
|
71
|
-
const mode = this.scope.metadata.transport?.transportIdMode ?? 'uuid';
|
|
72
|
-
if (typeof mode === 'string') {
|
|
73
|
-
return session_transport_1.TransportIdGenerator.createId(mode);
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
// Cast to proper function type since Zod's z.function() type is too generic
|
|
77
|
-
const modeFn = mode;
|
|
78
|
-
const modeResult = await modeFn(this.issuer);
|
|
79
|
-
return session_transport_1.TransportIdGenerator.createId(modeResult);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
// ---------------- scoped view ----------------
|
|
83
|
-
scoped(allowed) {
|
|
84
|
-
const fn = typeof allowed === 'function'
|
|
85
|
-
? allowed
|
|
86
|
-
: Array.isArray(allowed)
|
|
87
|
-
? (id) => allowed.includes(id)
|
|
88
|
-
: (id) => id === allowed;
|
|
89
|
-
return new SessionView(this, fn);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
exports.Session = Session;
|
|
93
|
-
class SessionView {
|
|
94
|
-
parent;
|
|
95
|
-
allow;
|
|
96
|
-
constructor(parent, allow) {
|
|
97
|
-
this.parent = parent;
|
|
98
|
-
this.allow = allow;
|
|
99
|
-
}
|
|
100
|
-
get id() {
|
|
101
|
-
return this.parent.id;
|
|
102
|
-
}
|
|
103
|
-
get mode() {
|
|
104
|
-
return this.parent.mode;
|
|
105
|
-
}
|
|
106
|
-
get user() {
|
|
107
|
-
return this.parent.user;
|
|
108
|
-
}
|
|
109
|
-
get claims() {
|
|
110
|
-
return this.parent.claims;
|
|
111
|
-
}
|
|
112
|
-
get authorizedApps() {
|
|
113
|
-
return this.parent.authorizedApps;
|
|
114
|
-
}
|
|
115
|
-
async getToken(providerId) {
|
|
116
|
-
if (!this.allow(providerId))
|
|
117
|
-
throw new Error(`scoped_denied:${providerId}`);
|
|
118
|
-
return this.parent.getToken(providerId);
|
|
119
|
-
}
|
|
120
|
-
get transportId() {
|
|
121
|
-
return this.parent.getTransportSessionId;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
exports.SessionView = SessionView;
|
|
125
|
-
//# sourceMappingURL=session.base.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session.base.js","sourceRoot":"","sources":["../../../../../src/auth/session/record/session.base.ts"],"names":[],"mappings":";AAAA,sCAAsC;;;AAItC,4DAA4D;AAuC5D,MAAsB,OAAO;IAC3B,0DAA0D;IACjD,EAAE,CAAS;IAEX,SAAS,CAAS;IAClB,OAAO,CAAS;IAChB,IAAI,CAAc;IAClB,MAAM,CAA2B;IAC1C,iEAAiE;IACxD,SAAS,CAAU;IAEnB,mBAAmB,CAAmC;IACtD,qBAAqB,CAAW;IAChC,cAAc,CAAoD;IAClE,gBAAgB,CAAW;IAC3B,mBAAmB,CAAW;IAC9B,MAAM,CAAY;IAClB,eAAe,CAAsF;IACrG,iBAAiB,CAAY;IAC7B,iBAAiB,CAAsF;IACvG,mBAAmB,CAAY;IAExC,mDAAmD;IACnD,MAAM,CAAQ;IACd,OAAO,CAAS;IACN,KAAK,CAAS;IAExB,kBAAkB,CAAU;IAE5B,YAAsB,GAAkB;QACtC,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7C,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;QACzB,sEAAsE;QACtE,MAAM,GAAG,GACP,GAAG,CAAC,MAAM,IAAI,OAAQ,GAAG,CAAC,MAAc,CAAC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,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAC1B,CAAC;IACD,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAC5B,CAAC;IACD,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,UAAkB;QAC/B,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,iBAAiB,UAAU,EAAE,CAAC,CAAC;QAC5E,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC1C,CAAC;IACD,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC;IAC3C,CAAC;CACF;AA1BD,kCA0BC","sourcesContent":["// auth/session/record/session.base.ts\n\nimport type { ProviderSnapshot, SessionMode } from '../session.types';\nimport type { TransportIdMode } from '../../../common';\nimport { TransportIdGenerator } from '../session.transport';\nimport { Scope } from '../../../scope';\n\nexport interface BaseCreateCtx {\n id: string;\n sessionId?: string;\n scope: Scope;\n issuer: string;\n token: string;\n user: SessionUser;\n claims?: SessionClaims;\n createdAt?: number;\n // optional precomputed authorization projections\n authorizedProviders?: Record<string, ProviderSnapshot>;\n authorizedProviderIds?: string[];\n authorizedApps?: Record<string, { id: string; toolIds: string[] }>;\n authorizedAppIds?: string[];\n authorizedResources?: string[];\n scopes?: string[];\n // Scoped tools/prompts maps\n authorizedTools?: Record<string, { executionPath: [string, string]; details?: Record<string, any> }>;\n authorizedToolIds?: string[];\n authorizedPrompts?: Record<string, { executionPath: [string, string]; details?: Record<string, any> }>;\n authorizedPromptIds?: string[];\n}\n\n// TODO: can be extended\nexport interface SessionUser {\n sub?: string;\n name?: string;\n email?: string;\n picture?: string;\n}\n\n// TODO: can be extended\nexport interface SessionClaims {\n [key: string]: any;\n}\n\nexport abstract class Session {\n // ---------------- public immutable data ----------------\n readonly id: string;\n abstract readonly mode: SessionMode;\n readonly createdAt: number;\n readonly scopeId: string;\n readonly user: SessionUser;\n readonly claims?: Record<string, unknown>;\n /** Epoch millis when the bearer token expires (if available). */\n readonly expiresAt?: number;\n\n readonly authorizedProviders: Record<string, ProviderSnapshot>;\n readonly authorizedProviderIds: string[];\n readonly authorizedApps: Record<string, { id: string; toolIds: string[] }>;\n readonly authorizedAppIds: string[];\n readonly authorizedResources: string[];\n readonly scopes?: string[];\n readonly authorizedTools?: Record<string, { executionPath: [string, string]; details?: Record<string, any> }>;\n readonly authorizedToolIds?: string[];\n readonly authorizedPrompts?: Record<string, { executionPath: [string, string]; details?: Record<string, any> }>;\n readonly authorizedPromptIds?: string[];\n\n // ---------------- private/shared ----------------\n #scope: Scope;\n #issuer: string;\n protected token: string;\n\n #activeTransportId?: string;\n\n protected constructor(ctx: BaseCreateCtx) {\n this.id = ctx.id;\n this.createdAt = ctx.createdAt || Date.now();\n this.#scope = ctx.scope;\n this.#issuer = ctx.issuer;\n this.scopeId = ctx.scope.id;\n this.user = ctx.user;\n this.claims = ctx.claims;\n // derive token expiration from JWT claims if present (exp in seconds)\n const exp =\n ctx.claims && typeof (ctx.claims as any)['exp'] === 'number' ? Number((ctx.claims as any)['exp']) : undefined;\n if (exp) {\n this.expiresAt = exp > 1e12 ? exp : exp * 1000;\n }\n // project authorized fields (defaults to empty)\n this.authorizedProviders = ctx.authorizedProviders ?? {};\n this.authorizedProviderIds = ctx.authorizedProviderIds ?? [];\n this.authorizedApps = ctx.authorizedApps ?? {};\n this.authorizedAppIds = ctx.authorizedAppIds ?? [];\n this.authorizedResources = ctx.authorizedResources ?? [];\n this.authorizedTools = ctx.authorizedTools ?? {};\n this.authorizedToolIds = ctx.authorizedToolIds ?? [];\n this.authorizedPrompts = ctx.authorizedPrompts ?? {};\n this.authorizedPromptIds = ctx.authorizedPromptIds ?? [];\n this.token = ctx.token;\n this.#activeTransportId = ctx.sessionId;\n }\n\n /**\n * Get the scope associated with this session.\n * Can be used by subclasses to implement custom scope handling.\n * @protected\n */\n protected get scope(): Scope {\n return this.#scope;\n }\n // ---------------- accessors ----------------\n\n get issuer(): string {\n return this.#issuer;\n }\n\n async getTransportSessionId(): Promise<string> {\n if (this.#activeTransportId) return this.#activeTransportId;\n const mode = this.scope.metadata.transport?.transportIdMode ?? 'uuid';\n if (typeof mode === 'string') {\n return TransportIdGenerator.createId(mode as TransportIdMode);\n } else {\n // Cast to proper function type since Zod's z.function() type is too generic\n const modeFn = mode as (issuer: string) => Promise<TransportIdMode> | TransportIdMode;\n const modeResult = await modeFn(this.issuer);\n return TransportIdGenerator.createId(modeResult);\n }\n }\n\n /**\n * Get the access token for a given provider.\n * Must be implemented in subclasses based on session topology.\n * @protected\n * @param providerId\n */\n abstract getToken(providerId?: string): Promise<string> | string;\n\n // ---------------- scoped view ----------------\n scoped(allowed: string | string[] | ((id: string) => boolean)) {\n const fn =\n typeof allowed === 'function'\n ? allowed\n : Array.isArray(allowed)\n ? (id: string) => allowed.includes(id)\n : (id: string) => id === allowed;\n return new SessionView(this, fn);\n }\n}\n\nexport class SessionView {\n constructor(private readonly parent: Session, private readonly allow: (id: string) => boolean) {}\n\n get id() {\n return this.parent.id;\n }\n get mode() {\n return this.parent.mode;\n }\n get user() {\n return this.parent.user;\n }\n get claims() {\n return this.parent.claims;\n }\n get authorizedApps() {\n return this.parent.authorizedApps;\n }\n\n async getToken(providerId: string) {\n if (!this.allow(providerId)) throw new Error(`scoped_denied:${providerId}`);\n return this.parent.getToken(providerId);\n }\n get transportId() {\n return this.parent.getTransportSessionId;\n }\n}\n"]}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StatefulSession = void 0;
|
|
4
|
-
const session_base_1 = require("./session.base");
|
|
5
|
-
/**
|
|
6
|
-
* Represents a **stateful session** stored server-side (e.g., Redis).
|
|
7
|
-
* Nested OAuth tokens are never exposed in the JWT; instead, they are
|
|
8
|
-
* encrypted and persisted in Redis under a session key. The client only
|
|
9
|
-
* receives a lightweight reference to that key.
|
|
10
|
-
*
|
|
11
|
-
* Advantages:
|
|
12
|
-
* - Smaller JWT payloads and reduced token leakage risk.
|
|
13
|
-
* - Can refresh nested provider tokens on the fly without requiring
|
|
14
|
-
* the user to re-authorize.
|
|
15
|
-
* - Well suited for multi-app setups with short-lived OAuth tokens.
|
|
16
|
-
*/
|
|
17
|
-
class StatefulSession extends session_base_1.Session {
|
|
18
|
-
mode = 'stateful';
|
|
19
|
-
/**
|
|
20
|
-
* Used to encrypt/decrypt nested provider tokens in #store.
|
|
21
|
-
* @private
|
|
22
|
-
*/
|
|
23
|
-
// eslint-disable-next-line no-unused-private-class-members
|
|
24
|
-
#vault;
|
|
25
|
-
/**
|
|
26
|
-
* Used to store/retrieve encrypted nested provider tokens.
|
|
27
|
-
* By default it will be a memory store, but can be replaced with a
|
|
28
|
-
* persistent store like Redis by settings session.store in SecureMcp options
|
|
29
|
-
* @private
|
|
30
|
-
*/
|
|
31
|
-
// eslint-disable-next-line no-unused-private-class-members
|
|
32
|
-
#store;
|
|
33
|
-
/**
|
|
34
|
-
* Per-provider refreshers (keyed by providerId).
|
|
35
|
-
* Used to refresh nested provider tokens on the fly.
|
|
36
|
-
* By default, it will use the default refresher, which is a simple
|
|
37
|
-
* refresher that refreshes the token by calling the provider's refresh endpoint.
|
|
38
|
-
*
|
|
39
|
-
* If you want to use a custom refresher, you can set it by setting session.refresher in SecureMcp options
|
|
40
|
-
* @private
|
|
41
|
-
*/
|
|
42
|
-
// eslint-disable-next-line no-unused-private-class-members
|
|
43
|
-
#refreshers;
|
|
44
|
-
// eslint-disable-next-line no-unused-private-class-members
|
|
45
|
-
#defaultRefresher;
|
|
46
|
-
constructor(ctx) {
|
|
47
|
-
super(ctx);
|
|
48
|
-
throw new Error('Method not implemented.');
|
|
49
|
-
}
|
|
50
|
-
getToken(providerId) {
|
|
51
|
-
throw new Error('Method not implemented.');
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
exports.StatefulSession = StatefulSession;
|
|
55
|
-
//# sourceMappingURL=session.stateful.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session.stateful.js","sourceRoot":"","sources":["../../../../../src/auth/session/record/session.stateful.ts"],"names":[],"mappings":";;;AAAA,iDAA6D;AAO7D;;;;;;;;;;;GAWG;AACH,MAAa,eAAgB,SAAQ,sBAAO;IACjC,IAAI,GAAG,UAAU,CAAC;IAC3B;;;OAGG;IACH,2DAA2D;IAC3D,MAAM,CAAa;IACnB;;;;;OAKG;IACH,2DAA2D;IAC3D,MAAM,CAAa;IAEnB;;;;;;;;OAQG;IACH,2DAA2D;IAC3D,WAAW,CAAiC;IAC5C,2DAA2D;IAC3D,iBAAiB,CAAiB;IAElC,YAAY,GAAsB;QAChC,KAAK,CAAC,GAAU,CAAC,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAEQ,QAAQ,CAAC,UAAmB;QACnC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;CAkCF;AAxED,0CAwEC","sourcesContent":["import { Session, type BaseCreateCtx } from './session.base';\nimport { TokenRefresher } from '../token.refresh';\nimport type { TokenStore } from '../token.store';\nimport type { TokenVault } from '../token.vault';\n\nexport type StatefulCreateCtx = BaseCreateCtx & {};\n\n/**\n * Represents a **stateful session** stored server-side (e.g., Redis).\n * Nested OAuth tokens are never exposed in the JWT; instead, they are\n * encrypted and persisted in Redis under a session key. The client only\n * receives a lightweight reference to that key.\n *\n * Advantages:\n * - Smaller JWT payloads and reduced token leakage risk.\n * - Can refresh nested provider tokens on the fly without requiring\n * the user to re-authorize.\n * - Well suited for multi-app setups with short-lived OAuth tokens.\n */\nexport class StatefulSession extends Session {\n readonly mode = 'stateful';\n /**\n * Used to encrypt/decrypt nested provider tokens in #store.\n * @private\n */\n // eslint-disable-next-line no-unused-private-class-members\n #vault: TokenVault;\n /**\n * Used to store/retrieve encrypted nested provider tokens.\n * By default it will be a memory store, but can be replaced with a\n * persistent store like Redis by settings session.store in SecureMcp options\n * @private\n */\n // eslint-disable-next-line no-unused-private-class-members\n #store: TokenStore;\n\n /**\n * Per-provider refreshers (keyed by providerId).\n * Used to refresh nested provider tokens on the fly.\n * By default, it will use the default refresher, which is a simple\n * refresher that refreshes the token by calling the provider's refresh endpoint.\n *\n * If you want to use a custom refresher, you can set it by setting session.refresher in SecureMcp options\n * @private\n */\n // eslint-disable-next-line no-unused-private-class-members\n #refreshers: Record<string, TokenRefresher>;\n // eslint-disable-next-line no-unused-private-class-members\n #defaultRefresher: TokenRefresher;\n\n constructor(ctx: StatefulCreateCtx) {\n super(ctx as any);\n throw new Error('Method not implemented.');\n }\n\n override getToken(providerId?: string): Promise<string> | string {\n throw new Error('Method not implemented.');\n }\n //\n // protected async attachProviderSecrets(p: ProviderInput): Promise<ProviderSnapshot> {\n // const snap: ProviderSnapshot = {\n // id: p.id,\n // exp: p.exp,\n // payload: p.payload,\n // apps: p.apps?.map(a => ({ id: String(a.id), toolIds: (a.toolIds ?? []).map(String) })),\n // embedMode: 'store-only',\n // };\n // if (p.token) snap.tokenEnc = encryptAesGcm(this.#key, p.token);\n // else if (p.enc) snap.tokenEnc = p.enc;\n // if (p.refreshToken) snap.refreshTokenEnc = encryptAesGcm(this.#key, p.refreshToken);\n // return snap;\n // }\n //\n // protected async readAccessToken(providerId: string): Promise<string | undefined> {\n // const s = this.authorizedProviders[providerId];\n // if (!s?.tokenEnc) return undefined;\n // return decryptAesGcm(this.#key, s.tokenEnc);\n // }\n //\n // protected readRefreshToken(providerId: string): string | undefined {\n // const s = this.authorizedProviders[providerId];\n // if (!s?.refreshTokenEnc) return undefined;\n // return decryptAesGcm(this.#key, s.refreshTokenEnc);\n // }\n //\n // protected async persistRefreshedTokens(providerId: string, res: TokenRefreshResult): Promise<void> {\n // const s = this.authorizedProviders[providerId];\n // if (!s) return;\n // if (res.accessToken) s.tokenEnc = encryptAesGcm(this.#key, res.accessToken);\n // if (res.refreshToken) s.refreshTokenEnc = encryptAesGcm(this.#key, res.refreshToken);\n // }\n}\n"]}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StatelessSession = void 0;
|
|
4
|
-
const session_base_1 = require("./session.base");
|
|
5
|
-
const mcp_error_1 = require("../../../errors/mcp.error");
|
|
6
|
-
/**
|
|
7
|
-
* Represents a **stateful session (non-refreshable)** where nested OAuth
|
|
8
|
-
* tokens cannot be refreshed server-side. When a nested provider token
|
|
9
|
-
* expires, the user must re-authorize to obtain new credentials.
|
|
10
|
-
*
|
|
11
|
-
* Notes:
|
|
12
|
-
* - Simpler flow, but degrades UX when tokens are short-lived.
|
|
13
|
-
* - Prefer the refreshable stateful session for multi-app environments.
|
|
14
|
-
*/
|
|
15
|
-
class StatelessSession extends session_base_1.Session {
|
|
16
|
-
mode = 'stateless';
|
|
17
|
-
/**
|
|
18
|
-
* Used to encrypt/decrypt nested provider tokens in #store.
|
|
19
|
-
* @private
|
|
20
|
-
*/
|
|
21
|
-
// eslint-disable-next-line no-unused-private-class-members
|
|
22
|
-
#vault;
|
|
23
|
-
constructor(ctx) {
|
|
24
|
-
super(ctx);
|
|
25
|
-
throw new mcp_error_1.InternalMcpError('StatelessSession not yet implemented', 'NOT_IMPLEMENTED');
|
|
26
|
-
}
|
|
27
|
-
getToken(_providerId) {
|
|
28
|
-
throw new mcp_error_1.InternalMcpError('Token refresh not supported in stateless mode', 'NOT_IMPLEMENTED');
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.StatelessSession = StatelessSession;
|
|
32
|
-
//# sourceMappingURL=session.stateless.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session.stateless.js","sourceRoot":"","sources":["../../../../../src/auth/session/record/session.stateless.ts"],"names":[],"mappings":";;;AAAA,iDAA6D;AAE7D,yDAA6D;AAI7D;;;;;;;;GAQG;AACH,MAAa,gBAAiB,SAAQ,sBAAO;IAClC,IAAI,GAAG,WAAW,CAAC;IAC5B;;;OAGG;IACH,2DAA2D;IAC3D,MAAM,CAAa;IACnB,YAAY,GAAsB;QAChC,KAAK,CAAC,GAAoB,CAAC,CAAC;QAC5B,MAAM,IAAI,4BAAgB,CAAC,sCAAsC,EAAE,iBAAiB,CAAC,CAAC;IACxF,CAAC;IACQ,QAAQ,CAAC,WAAoB;QACpC,MAAM,IAAI,4BAAgB,CAAC,+CAA+C,EAAE,iBAAiB,CAAC,CAAC;IACjG,CAAC;CACF;AAfD,4CAeC","sourcesContent":["import { Session, type BaseCreateCtx } from './session.base';\nimport { TokenVault } from '../token.vault';\nimport { InternalMcpError } from '../../../errors/mcp.error';\n\nexport type StatefulCreateCtx = BaseCreateCtx & Record<string, never>;\n\n/**\n * Represents a **stateful session (non-refreshable)** where nested OAuth\n * tokens cannot be refreshed server-side. When a nested provider token\n * expires, the user must re-authorize to obtain new credentials.\n *\n * Notes:\n * - Simpler flow, but degrades UX when tokens are short-lived.\n * - Prefer the refreshable stateful session for multi-app environments.\n */\nexport class StatelessSession extends Session {\n readonly mode = 'stateless';\n /**\n * Used to encrypt/decrypt nested provider tokens in #store.\n * @private\n */\n // eslint-disable-next-line no-unused-private-class-members\n #vault: TokenVault;\n constructor(ctx: StatefulCreateCtx) {\n super(ctx as BaseCreateCtx);\n throw new InternalMcpError('StatelessSession not yet implemented', 'NOT_IMPLEMENTED');\n }\n override getToken(_providerId?: string): Promise<string> | string {\n throw new InternalMcpError('Token refresh not supported in stateless mode', 'NOT_IMPLEMENTED');\n }\n}\n"]}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TransparentSession = void 0;
|
|
4
|
-
const session_base_1 = require("./session.base");
|
|
5
|
-
/**
|
|
6
|
-
* Represents a transparent (Non-Orchestrated) session where delivered by authorization server.
|
|
7
|
-
* The session cannot have nest auth providers.
|
|
8
|
-
* The session cannot be refreshed.
|
|
9
|
-
* The session cannot be revoked.
|
|
10
|
-
* Useful for OAuth flows where the authorization server delivers the session.
|
|
11
|
-
*/
|
|
12
|
-
class TransparentSession extends session_base_1.Session {
|
|
13
|
-
mode = 'transparent';
|
|
14
|
-
constructor(ctx) {
|
|
15
|
-
super(ctx);
|
|
16
|
-
}
|
|
17
|
-
getToken() {
|
|
18
|
-
return this.token;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.TransparentSession = TransparentSession;
|
|
22
|
-
//# sourceMappingURL=session.transparent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session.transparent.js","sourceRoot":"","sources":["../../../../../src/auth/session/record/session.transparent.ts"],"names":[],"mappings":";;;AAAA,iDAAwD;AAMxD;;;;;;GAMG;AACH,MAAa,kBAAmB,SAAQ,sBAAO;IACpC,IAAI,GAAG,aAAa,CAAC;IAC9B,YAAY,GAAyB;QACnC,KAAK,CAAC,GAAU,CAAC,CAAC;IACpB,CAAC;IAEQ,QAAQ;QACf,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF;AATD,gDASC","sourcesContent":["import { BaseCreateCtx, Session } from './session.base';\n\ninterface TransparentCreateCtx extends BaseCreateCtx {\n apps: string[];\n}\n\n/**\n * Represents a transparent (Non-Orchestrated) session where delivered by authorization server.\n * The session cannot have nest auth providers.\n * The session cannot be refreshed.\n * The session cannot be revoked.\n * Useful for OAuth flows where the authorization server delivers the session.\n */\nexport class TransparentSession extends Session {\n readonly mode = 'transparent';\n constructor(ctx: TransparentCreateCtx) {\n super(ctx as any);\n }\n\n override getToken(): Promise<string> | string {\n return this.token;\n }\n}\n"]}
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RedisSessionStore = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
// auth/session/redis-session.store.ts
|
|
6
|
-
const ioredis_1 = tslib_1.__importDefault(require("ioredis"));
|
|
7
|
-
const crypto_1 = require("crypto");
|
|
8
|
-
const transport_session_types_1 = require("./transport-session.types");
|
|
9
|
-
/**
|
|
10
|
-
* Redis-backed session store implementation
|
|
11
|
-
*
|
|
12
|
-
* Provides persistent session storage for distributed deployments.
|
|
13
|
-
* Sessions are stored as JSON with optional TTL.
|
|
14
|
-
*/
|
|
15
|
-
class RedisSessionStore {
|
|
16
|
-
redis;
|
|
17
|
-
keyPrefix;
|
|
18
|
-
defaultTtlMs;
|
|
19
|
-
logger;
|
|
20
|
-
externalInstance = false;
|
|
21
|
-
constructor(config, logger) {
|
|
22
|
-
// Default TTL of 1 hour for session extension on access
|
|
23
|
-
this.defaultTtlMs = ('defaultTtlMs' in config ? config.defaultTtlMs : undefined) ?? 3600000;
|
|
24
|
-
this.logger = logger;
|
|
25
|
-
if ('redis' in config && config.redis) {
|
|
26
|
-
// Use provided Redis instance
|
|
27
|
-
this.redis = config.redis;
|
|
28
|
-
this.keyPrefix = config.keyPrefix ?? 'mcp:session:';
|
|
29
|
-
this.externalInstance = true;
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
// Create new Redis connection from config
|
|
33
|
-
const redisConfig = config;
|
|
34
|
-
const options = {
|
|
35
|
-
host: redisConfig.host,
|
|
36
|
-
port: redisConfig.port ?? 6379,
|
|
37
|
-
password: redisConfig.password,
|
|
38
|
-
db: redisConfig.db ?? 0,
|
|
39
|
-
};
|
|
40
|
-
if (redisConfig.tls) {
|
|
41
|
-
options.tls = {};
|
|
42
|
-
}
|
|
43
|
-
this.redis = new ioredis_1.default(options);
|
|
44
|
-
this.keyPrefix = redisConfig.keyPrefix ?? 'mcp:session:';
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Get the full Redis key for a session ID
|
|
49
|
-
* @throws Error if sessionId is empty
|
|
50
|
-
*/
|
|
51
|
-
key(sessionId) {
|
|
52
|
-
if (!sessionId || sessionId.trim() === '') {
|
|
53
|
-
throw new Error('[RedisSessionStore] sessionId cannot be empty');
|
|
54
|
-
}
|
|
55
|
-
return `${this.keyPrefix}${sessionId}`;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Get a stored session by ID
|
|
59
|
-
*
|
|
60
|
-
* Note: Uses atomic GETEX to extend TTL while reading, preventing race conditions
|
|
61
|
-
* where concurrent readers might resurrect expired sessions.
|
|
62
|
-
*/
|
|
63
|
-
async get(sessionId) {
|
|
64
|
-
const key = this.key(sessionId);
|
|
65
|
-
// Use GETEX to atomically get and extend TTL in a single operation
|
|
66
|
-
// This prevents the race where one request deletes expired session
|
|
67
|
-
// while another is trying to extend it
|
|
68
|
-
let raw;
|
|
69
|
-
try {
|
|
70
|
-
// GETEX with EXAT/PXAT is atomic - no race condition possible
|
|
71
|
-
raw = await this.redis.getex(key, 'PX', this.defaultTtlMs);
|
|
72
|
-
}
|
|
73
|
-
catch {
|
|
74
|
-
// Fallback for older Redis versions that don't support GETEX
|
|
75
|
-
raw = await this.redis.get(key);
|
|
76
|
-
}
|
|
77
|
-
if (!raw)
|
|
78
|
-
return null;
|
|
79
|
-
try {
|
|
80
|
-
const parsed = JSON.parse(raw);
|
|
81
|
-
const result = transport_session_types_1.storedSessionSchema.safeParse(parsed);
|
|
82
|
-
if (!result.success) {
|
|
83
|
-
this.logger?.warn('[RedisSessionStore] Invalid session format', {
|
|
84
|
-
sessionId: sessionId.slice(0, 20),
|
|
85
|
-
errors: result.error.issues.slice(0, 3).map((i) => ({ path: i.path, message: i.message })),
|
|
86
|
-
});
|
|
87
|
-
// Delete invalid session data
|
|
88
|
-
this.delete(sessionId).catch(() => void 0);
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
const session = result.data;
|
|
92
|
-
// Check application-level expiration (separate from Redis TTL)
|
|
93
|
-
if (session.session.expiresAt && session.session.expiresAt < Date.now()) {
|
|
94
|
-
// Session is logically expired - delete it
|
|
95
|
-
// Note: We await the delete to ensure it completes before returning
|
|
96
|
-
// This prevents race conditions where another read might get the expired session
|
|
97
|
-
await this.delete(sessionId);
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
|
-
// Bound Redis TTL by session.expiresAt to avoid keeping expired sessions in Redis
|
|
101
|
-
// GETEX may have extended TTL beyond expiresAt, so we shorten it if needed
|
|
102
|
-
if (session.session.expiresAt) {
|
|
103
|
-
const ttlMs = Math.min(this.defaultTtlMs, session.session.expiresAt - Date.now());
|
|
104
|
-
if (ttlMs > 0 && ttlMs < this.defaultTtlMs) {
|
|
105
|
-
// Fire-and-forget - we're only optimizing cache eviction timing
|
|
106
|
-
this.redis.pexpire(key, ttlMs).catch(() => void 0);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
// Update last accessed timestamp (in the returned object)
|
|
110
|
-
// Note: We don't fire-and-forget a set() here because:
|
|
111
|
-
// 1. GETEX already extended the Redis TTL
|
|
112
|
-
// 2. Fire-and-forget can cause race conditions with deletion
|
|
113
|
-
const updatedSession = {
|
|
114
|
-
...session,
|
|
115
|
-
lastAccessedAt: Date.now(),
|
|
116
|
-
};
|
|
117
|
-
return updatedSession;
|
|
118
|
-
}
|
|
119
|
-
catch (error) {
|
|
120
|
-
this.logger?.warn('[RedisSessionStore] Failed to parse session', {
|
|
121
|
-
sessionId: sessionId.slice(0, 20),
|
|
122
|
-
error: error.message,
|
|
123
|
-
});
|
|
124
|
-
// Delete corrupted session payloads to prevent repeated failures
|
|
125
|
-
this.delete(sessionId).catch(() => void 0);
|
|
126
|
-
return null;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Store a session with optional TTL
|
|
131
|
-
*/
|
|
132
|
-
async set(sessionId, session, ttlMs) {
|
|
133
|
-
const key = this.key(sessionId);
|
|
134
|
-
const value = JSON.stringify(session);
|
|
135
|
-
if (ttlMs && ttlMs > 0) {
|
|
136
|
-
// Use PX for millisecond precision
|
|
137
|
-
await this.redis.set(key, value, 'PX', ttlMs);
|
|
138
|
-
}
|
|
139
|
-
else if (session.session.expiresAt) {
|
|
140
|
-
// Use session's expiration if available
|
|
141
|
-
const ttl = session.session.expiresAt - Date.now();
|
|
142
|
-
if (ttl > 0) {
|
|
143
|
-
await this.redis.set(key, value, 'PX', ttl);
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
// Already expired, but store anyway (will be cleaned up on next access)
|
|
147
|
-
await this.redis.set(key, value);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
// No TTL - session persists until explicitly deleted
|
|
152
|
-
await this.redis.set(key, value);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Delete a session
|
|
157
|
-
*/
|
|
158
|
-
async delete(sessionId) {
|
|
159
|
-
await this.redis.del(this.key(sessionId));
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Check if a session exists
|
|
163
|
-
*/
|
|
164
|
-
async exists(sessionId) {
|
|
165
|
-
return (await this.redis.exists(this.key(sessionId))) === 1;
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Allocate a new session ID
|
|
169
|
-
*/
|
|
170
|
-
allocId() {
|
|
171
|
-
return (0, crypto_1.randomUUID)();
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Disconnect from Redis (only if we created the connection)
|
|
175
|
-
*/
|
|
176
|
-
async disconnect() {
|
|
177
|
-
if (!this.externalInstance) {
|
|
178
|
-
await this.redis.quit();
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Get the underlying Redis client (for advanced use cases)
|
|
183
|
-
*/
|
|
184
|
-
getRedisClient() {
|
|
185
|
-
return this.redis;
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Test Redis connection by sending a PING command.
|
|
189
|
-
* Useful for validating connection on startup.
|
|
190
|
-
*
|
|
191
|
-
* @returns true if connection is healthy, false otherwise
|
|
192
|
-
*/
|
|
193
|
-
async ping() {
|
|
194
|
-
try {
|
|
195
|
-
const result = await this.redis.ping();
|
|
196
|
-
return result === 'PONG';
|
|
197
|
-
}
|
|
198
|
-
catch {
|
|
199
|
-
return false;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
exports.RedisSessionStore = RedisSessionStore;
|
|
204
|
-
//# sourceMappingURL=redis-session.store.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"redis-session.store.js","sourceRoot":"","sources":["../../../../src/auth/session/redis-session.store.ts"],"names":[],"mappings":";;;;AAAA,sCAAsC;AACtC,8DAAuD;AACvD,mCAAoC;AACpC,uEAA0G;AAG1G;;;;;GAKG;AACH,MAAa,iBAAiB;IACX,KAAK,CAAQ;IACb,SAAS,CAAS;IAClB,YAAY,CAAS;IACrB,MAAM,CAAkB;IACjC,gBAAgB,GAAG,KAAK,CAAC;IAEjC,YACE,MAAiF,EACjF,MAAuB;QAEvB,wDAAwD;QACxD,IAAI,CAAC,YAAY,GAAG,CAAC,cAAc,IAAI,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC;QAC5F,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,IAAI,OAAO,IAAI,MAAM,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACtC,8BAA8B;YAC9B,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;YAC1B,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,cAAc,CAAC;YACpD,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC/B,CA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,EAAE,CAAC;QAC1B,CAAC;IACH,CAAC;IAED;;OAEG;IACH,cAAc;QACZ,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI;QACR,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;YACvC,OAAO,MAAM,KAAK,MAAM,CAAC;QAC3B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF;AA7MD,8CA6MC","sourcesContent":["// auth/session/redis-session.store.ts\nimport IoRedis, { Redis, RedisOptions } from 'ioredis';\nimport { randomUUID } from 'crypto';\nimport { SessionStore, StoredSession, RedisConfig, storedSessionSchema } from './transport-session.types';\nimport { FrontMcpLogger } from '../../common/interfaces/logger.interface';\n\n/**\n * Redis-backed session store implementation\n *\n * Provides persistent session storage for distributed deployments.\n * Sessions are stored as JSON with optional TTL.\n */\nexport class RedisSessionStore implements SessionStore {\n private readonly redis: Redis;\n private readonly keyPrefix: string;\n private readonly defaultTtlMs: number;\n private readonly logger?: FrontMcpLogger;\n private externalInstance = false;\n\n constructor(\n config: RedisConfig | { redis: Redis; keyPrefix?: string; defaultTtlMs?: number },\n logger?: FrontMcpLogger,\n ) {\n // Default TTL of 1 hour for session extension on access\n this.defaultTtlMs = ('defaultTtlMs' in config ? config.defaultTtlMs : undefined) ?? 3600000;\n this.logger = logger;\n\n if ('redis' in config && config.redis) {\n // Use provided Redis instance\n this.redis = config.redis;\n this.keyPrefix = config.keyPrefix ?? 'mcp:session:';\n this.externalInstance = true;\n } else {\n // Create new Redis connection from config\n const redisConfig = config as RedisConfig;\n const options: RedisOptions = {\n host: redisConfig.host,\n port: redisConfig.port ?? 6379,\n password: redisConfig.password,\n db: redisConfig.db ?? 0,\n };\n\n if (redisConfig.tls) {\n options.tls = {};\n }\n\n this.redis = new IoRedis(options);\n this.keyPrefix = redisConfig.keyPrefix ?? 'mcp:session:';\n }\n }\n\n /**\n * Get the full Redis key for a session ID\n * @throws Error if sessionId is empty\n */\n private key(sessionId: string): string {\n if (!sessionId || sessionId.trim() === '') {\n throw new Error('[RedisSessionStore] sessionId cannot be empty');\n }\n return `${this.keyPrefix}${sessionId}`;\n }\n\n /**\n * Get a stored session by ID\n *\n * Note: Uses atomic GETEX to extend TTL while reading, preventing race conditions\n * where concurrent readers might resurrect expired sessions.\n */\n async get(sessionId: string): Promise<StoredSession | null> {\n const key = this.key(sessionId);\n\n // Use GETEX to atomically get and extend TTL in a single operation\n // This prevents the race where one request deletes expired session\n // while another is trying to extend it\n let raw: string | null;\n try {\n // GETEX with EXAT/PXAT is atomic - no race condition possible\n raw = await this.redis.getex(key, 'PX', this.defaultTtlMs);\n } catch {\n // Fallback for older Redis versions that don't support GETEX\n raw = await this.redis.get(key);\n }\n\n if (!raw) return null;\n\n try {\n const parsed = JSON.parse(raw);\n const result = storedSessionSchema.safeParse(parsed);\n\n if (!result.success) {\n this.logger?.warn('[RedisSessionStore] Invalid session format', {\n sessionId: sessionId.slice(0, 20),\n errors: result.error.issues.slice(0, 3).map((i) => ({ path: i.path, message: i.message })),\n });\n // Delete invalid session data\n this.delete(sessionId).catch(() => void 0);\n return null;\n }\n\n const session = result.data;\n\n // Check application-level expiration (separate from Redis TTL)\n if (session.session.expiresAt && session.session.expiresAt < Date.now()) {\n // Session is logically expired - delete it\n // Note: We await the delete to ensure it completes before returning\n // This prevents race conditions where another read might get the expired session\n await this.delete(sessionId);\n return null;\n }\n\n // Bound Redis TTL by session.expiresAt to avoid keeping expired sessions in Redis\n // GETEX may have extended TTL beyond expiresAt, so we shorten it if needed\n if (session.session.expiresAt) {\n const ttlMs = Math.min(this.defaultTtlMs, session.session.expiresAt - Date.now());\n if (ttlMs > 0 && ttlMs < this.defaultTtlMs) {\n // Fire-and-forget - we're only optimizing cache eviction timing\n this.redis.pexpire(key, ttlMs).catch(() => void 0);\n }\n }\n\n // Update last accessed timestamp (in the returned object)\n // Note: We don't fire-and-forget a set() here because:\n // 1. GETEX already extended the Redis TTL\n // 2. Fire-and-forget can cause race conditions with deletion\n const updatedSession: StoredSession = {\n ...session,\n lastAccessedAt: Date.now(),\n };\n\n return updatedSession;\n } catch (error) {\n this.logger?.warn('[RedisSessionStore] Failed to parse session', {\n sessionId: sessionId.slice(0, 20),\n error: (error as Error).message,\n });\n // Delete corrupted session payloads to prevent repeated failures\n this.delete(sessionId).catch(() => void 0);\n return null;\n }\n }\n\n /**\n * Store a session with optional TTL\n */\n async set(sessionId: string, session: StoredSession, ttlMs?: number): Promise<void> {\n const key = this.key(sessionId);\n const value = JSON.stringify(session);\n\n if (ttlMs && ttlMs > 0) {\n // Use PX for millisecond precision\n await this.redis.set(key, value, 'PX', ttlMs);\n } else if (session.session.expiresAt) {\n // Use session's expiration if available\n const ttl = session.session.expiresAt - Date.now();\n if (ttl > 0) {\n await this.redis.set(key, value, 'PX', ttl);\n } else {\n // Already expired, but store anyway (will be cleaned up on next access)\n await this.redis.set(key, value);\n }\n } else {\n // No TTL - session persists until explicitly deleted\n await this.redis.set(key, value);\n }\n }\n\n /**\n * Delete a session\n */\n async delete(sessionId: string): Promise<void> {\n await this.redis.del(this.key(sessionId));\n }\n\n /**\n * Check if a session exists\n */\n async exists(sessionId: string): Promise<boolean> {\n return (await this.redis.exists(this.key(sessionId))) === 1;\n }\n\n /**\n * Allocate a new session ID\n */\n allocId(): string {\n return randomUUID();\n }\n\n /**\n * Disconnect from Redis (only if we created the connection)\n */\n async disconnect(): Promise<void> {\n if (!this.externalInstance) {\n await this.redis.quit();\n }\n }\n\n /**\n * Get the underlying Redis client (for advanced use cases)\n */\n getRedisClient(): Redis {\n return this.redis;\n }\n\n /**\n * Test Redis connection by sending a PING command.\n * Useful for validating connection on startup.\n *\n * @returns true if connection is healthy, false otherwise\n */\n async ping(): Promise<boolean> {\n try {\n const result = await this.redis.ping();\n return result === 'PONG';\n } catch {\n return false;\n }\n }\n}\n"]}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.encryptAesGcm = encryptAesGcm;
|
|
4
|
-
exports.decryptAesGcm = decryptAesGcm;
|
|
5
|
-
exports.hkdfSha256 = hkdfSha256;
|
|
6
|
-
const tslib_1 = require("tslib");
|
|
7
|
-
// auth/services/session/session.crypto.ts
|
|
8
|
-
const node_crypto_1 = tslib_1.__importDefault(require("node:crypto"));
|
|
9
|
-
/** Encrypt UTF-8 text using AES-256-GCM. Returns base64url fields. */
|
|
10
|
-
function encryptAesGcm(key, plaintext) {
|
|
11
|
-
const iv = node_crypto_1.default.randomBytes(12);
|
|
12
|
-
const cipher = node_crypto_1.default.createCipheriv('aes-256-gcm', key, iv);
|
|
13
|
-
const data = Buffer.concat([cipher.update(plaintext, 'utf8'), cipher.final()]);
|
|
14
|
-
const tag = cipher.getAuthTag();
|
|
15
|
-
return {
|
|
16
|
-
alg: 'A256GCM',
|
|
17
|
-
iv: iv.toString('base64url'),
|
|
18
|
-
tag: tag.toString('base64url'),
|
|
19
|
-
data: data.toString('base64url'),
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
/** Decrypt an AES-256-GCM blob (base64url fields) to UTF-8 text. */
|
|
23
|
-
function decryptAesGcm(key, blob) {
|
|
24
|
-
const iv = Buffer.from(blob.iv, 'base64url');
|
|
25
|
-
const tag = Buffer.from(blob.tag, 'base64url');
|
|
26
|
-
const data = Buffer.from(blob.data, 'base64url');
|
|
27
|
-
const decipher = node_crypto_1.default.createDecipheriv('aes-256-gcm', key, iv);
|
|
28
|
-
decipher.setAuthTag(tag);
|
|
29
|
-
const out = Buffer.concat([decipher.update(data), decipher.final()]);
|
|
30
|
-
return out.toString('utf8');
|
|
31
|
-
}
|
|
32
|
-
/** HKDF-SHA256 (RFC 5869) to derive key material. */
|
|
33
|
-
function hkdfSha256(ikm, salt, info, length) {
|
|
34
|
-
const prk = node_crypto_1.default.createHmac('sha256', salt).update(ikm).digest();
|
|
35
|
-
let prev = Buffer.alloc(0);
|
|
36
|
-
const chunks = [];
|
|
37
|
-
let ctr = 1;
|
|
38
|
-
while (Buffer.concat(chunks).length < length) {
|
|
39
|
-
prev = node_crypto_1.default
|
|
40
|
-
.createHmac('sha256', prk)
|
|
41
|
-
.update(Buffer.concat([prev, info, Buffer.from([ctr++])]))
|
|
42
|
-
.digest();
|
|
43
|
-
chunks.push(prev);
|
|
44
|
-
}
|
|
45
|
-
return Buffer.concat(chunks).subarray(0, length);
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=session.crypto.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session.crypto.js","sourceRoot":"","sources":["../../../../src/auth/session/session.crypto.ts"],"names":[],"mappings":";;AAKA,sCAWC;AAGD,sCAQC;AAGD,gCAaC;;AA3CD,0CAA0C;AAC1C,sEAAiC;AAGjC,sEAAsE;AACtE,SAAgB,aAAa,CAAC,GAAW,EAAE,SAAiB;IAC1D,MAAM,EAAE,GAAG,qBAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAClC,MAAM,MAAM,GAAG,qBAAM,CAAC,cAAc,CAAC,aAAa,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IAC7D,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAC/E,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;IAChC,OAAO;QACL,GAAG,EAAE,SAAS;QACd,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC;QAC5B,GAAG,EAAE,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC;QAC9B,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;KACjC,CAA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AM,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;aACzD,MAAM,EAAE,CAAC;QACZ,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AACnD,CAAC","sourcesContent":["// auth/services/session/session.crypto.ts\nimport crypto from 'node:crypto';\nimport type { EncBlob } from './session.types';\n\n/** Encrypt UTF-8 text using AES-256-GCM. Returns base64url fields. */\nexport function encryptAesGcm(key: Buffer, plaintext: string): EncBlob {\n const iv = crypto.randomBytes(12);\n const cipher = crypto.createCipheriv('aes-256-gcm', key, iv);\n const data = Buffer.concat([cipher.update(plaintext, 'utf8'), cipher.final()]);\n const tag = cipher.getAuthTag();\n return {\n alg: 'A256GCM',\n iv: iv.toString('base64url'),\n tag: tag.toString('base64url'),\n data: data.toString('base64url'),\n };\n}\n\n/** Decrypt an AES-256-GCM blob (base64url fields) to UTF-8 text. */\nexport function decryptAesGcm(key: Buffer, blob: EncBlob): string {\n const iv = Buffer.from(blob.iv, 'base64url');\n const tag = Buffer.from(blob.tag, 'base64url');\n const data = Buffer.from(blob.data, 'base64url');\n const decipher = crypto.createDecipheriv('aes-256-gcm', key, iv);\n decipher.setAuthTag(tag);\n const out = Buffer.concat([decipher.update(data), decipher.final()]);\n return out.toString('utf8');\n}\n\n/** HKDF-SHA256 (RFC 5869) to derive key material. */\nexport function hkdfSha256(ikm: Buffer, salt: Buffer, info: Buffer, length: number): Buffer {\n const prk = crypto.createHmac('sha256', salt).update(ikm).digest();\n let prev: Buffer = Buffer.alloc(0);\n const chunks: Buffer[] = [];\n let ctr = 1;\n while (Buffer.concat(chunks).length < length) {\n prev = crypto\n .createHmac('sha256', prk)\n .update(Buffer.concat([prev, info, Buffer.from([ctr++])]))\n .digest();\n chunks.push(prev);\n }\n return Buffer.concat(chunks).subarray(0, length);\n}\n"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SessionSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const session_transparent_1 = require("./record/session.transparent");
|
|
6
|
-
const session_stateful_1 = require("./record/session.stateful");
|
|
7
|
-
const session_stateless_1 = require("./record/session.stateless");
|
|
8
|
-
exports.SessionSchema = zod_1.z.union([
|
|
9
|
-
zod_1.z.instanceof(session_transparent_1.TransparentSession),
|
|
10
|
-
zod_1.z.instanceof(session_stateful_1.StatefulSession),
|
|
11
|
-
zod_1.z.instanceof(session_stateless_1.StatelessSession),
|
|
12
|
-
]);
|
|
13
|
-
//# sourceMappingURL=session.schema.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session.schema.js","sourceRoot":"","sources":["../../../../src/auth/session/session.schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,sEAAkE;AAClE,gEAA4D;AAC5D,kEAA8D;AAEjD,QAAA,aAAa,GAAG,OAAC,CAAC,KAAK,CAAC;IACnC,OAAC,CAAC,UAAU,CAAC,wCAAkB,CAAC;IAChC,OAAC,CAAC,UAAU,CAAC,kCAAe,CAAC;IAC7B,OAAC,CAAC,UAAU,CAAC,oCAAgB,CAAC;CAC/B,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport { TransparentSession } from './record/session.transparent';\nimport { StatefulSession } from './record/session.stateful';\nimport { StatelessSession } from './record/session.stateless';\n\nexport const SessionSchema = z.union([\n z.instanceof(TransparentSession),\n z.instanceof(StatefulSession),\n z.instanceof(StatelessSession),\n]);\n"]}
|