@frontmcp/sdk 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/adapter/adapter.instance.d.ts +10 -3
- package/adapter/adapter.instance.d.ts.map +1 -1
- package/adapter/{adapter.regsitry.d.ts → adapter.registry.d.ts} +2 -1
- package/adapter/adapter.registry.d.ts.map +1 -0
- package/adapter/adapter.utils.d.ts.map +1 -1
- package/agent/agent.instance.d.ts.map +1 -1
- package/agent/agent.scope.d.ts +9 -9
- package/agent/agent.scope.d.ts.map +1 -1
- package/agent/agent.utils.d.ts.map +1 -1
- package/app/app.registry.d.ts.map +1 -1
- package/app/app.utils.d.ts.map +1 -1
- package/app/instances/app.local.instance.d.ts +1 -1
- package/auth/auth.registry.d.ts +1 -1
- package/auth/auth.registry.d.ts.map +1 -1
- package/auth/auth.utils.d.ts.map +1 -1
- package/auth/authorization/index.d.ts +0 -6
- package/auth/authorization/index.d.ts.map +1 -1
- package/auth/authorization/orchestrated.context-extension.d.ts +1 -1
- package/auth/authorization/orchestrated.context-extension.d.ts.map +1 -1
- package/auth/flows/auth.verify.flow.d.ts +1 -1
- package/auth/flows/auth.verify.flow.d.ts.map +1 -1
- package/auth/flows/oauth.authorize.flow.d.ts.map +1 -1
- package/auth/flows/oauth.callback.flow.d.ts.map +1 -1
- package/auth/flows/oauth.provider-callback.flow.d.ts.map +1 -1
- package/auth/flows/session.verify.flow.d.ts +2 -2
- package/auth/flows/session.verify.flow.d.ts.map +1 -1
- package/auth/flows/well-known.jwks.flow.d.ts.map +1 -1
- package/auth/flows/well-known.oauth-authorization-server.flow.d.ts.map +1 -1
- package/auth/flows/well-known.prm.flow.d.ts.map +1 -1
- package/auth/instances/instance.local-primary-auth.d.ts +2 -2
- package/auth/instances/instance.local-primary-auth.d.ts.map +1 -1
- package/auth/session/index.d.ts +7 -11
- package/auth/session/index.d.ts.map +1 -1
- package/auth/session/record/session.base.d.ts +1 -1
- package/auth/session/record/session.base.d.ts.map +1 -1
- package/auth/session/session-store.factory.d.ts +19 -3
- package/auth/session/session-store.factory.d.ts.map +1 -1
- package/auth/session/session.service.d.ts +1 -1
- package/auth/session/session.service.d.ts.map +1 -1
- package/auth/session/transport-session.manager.d.ts +1 -1
- package/auth/session/transport-session.manager.d.ts.map +1 -1
- package/auth/session/utils/session-id.utils.d.ts +1 -2
- package/auth/session/utils/session-id.utils.d.ts.map +1 -1
- package/auth/vault/auth-providers.context-extension.d.ts +2 -2
- package/auth/vault/auth-providers.context-extension.d.ts.map +1 -1
- package/auth/vault/auth-providers.providers.d.ts +1 -1
- package/auth/vault/auth-providers.providers.d.ts.map +1 -1
- package/auth/vault/index.d.ts +0 -52
- package/auth/vault/index.d.ts.map +1 -1
- package/builtin/config/config-resolver.d.ts.map +1 -1
- package/common/decorators/app.decorator.d.ts +1 -1
- package/common/decorators/app.decorator.d.ts.map +1 -1
- package/common/decorators/front-mcp.decorator.d.ts.map +1 -1
- package/common/decorators/plugin.decorator.d.ts.map +1 -1
- package/common/dynamic/dynamic.adapter.d.ts.map +1 -1
- package/common/dynamic/dynamic.plugin.d.ts.map +1 -1
- package/common/interfaces/agent.interface.d.ts.map +1 -1
- package/common/interfaces/internal/flow.utils.d.ts.map +1 -1
- package/common/interfaces/server.interface.d.ts +4 -2
- package/common/interfaces/server.interface.d.ts.map +1 -1
- package/common/metadata/app.metadata.d.ts +16 -16
- package/common/metadata/front-mcp.metadata.d.ts +184 -52
- package/common/metadata/front-mcp.metadata.d.ts.map +1 -1
- package/common/providers/base-config.provider.d.ts.map +1 -1
- package/common/tokens/front-mcp.tokens.d.ts.map +1 -1
- package/common/types/auth/jwt.types.d.ts +2 -86
- package/common/types/auth/jwt.types.d.ts.map +1 -1
- package/common/types/auth/session.types.d.ts +5 -101
- package/common/types/auth/session.types.d.ts.map +1 -1
- package/common/types/options/auth/app-auth.schema.d.ts +8 -8
- package/common/types/options/auth/index.d.ts +14 -14
- package/common/types/options/auth/index.d.ts.map +1 -1
- package/common/types/options/auth/interfaces.d.ts +1 -1
- package/common/types/options/auth/interfaces.d.ts.map +1 -1
- package/common/types/options/auth/orchestrated.schema.d.ts +10 -10
- package/common/types/options/auth/public.schema.d.ts +2 -2
- package/common/types/options/auth/schema.d.ts +8 -8
- package/common/types/options/auth/shared.schemas.d.ts +2 -132
- package/common/types/options/auth/shared.schemas.d.ts.map +1 -1
- package/common/types/options/auth/transparent.schema.d.ts +1 -1
- package/common/types/options/http/index.d.ts +1 -1
- package/common/types/options/http/index.d.ts.map +1 -1
- package/common/types/options/http/interfaces.d.ts +36 -0
- package/common/types/options/http/interfaces.d.ts.map +1 -1
- package/common/types/options/http/schema.d.ts +6 -0
- package/common/types/options/http/schema.d.ts.map +1 -1
- package/common/types/options/index.d.ts +1 -0
- package/common/types/options/index.d.ts.map +1 -1
- package/common/types/options/session/schema.d.ts +3 -3
- package/common/types/options/sqlite/index.d.ts +3 -0
- package/common/types/options/sqlite/index.d.ts.map +1 -0
- package/common/types/options/sqlite/schema.d.ts +26 -0
- package/common/types/options/sqlite/schema.d.ts.map +1 -0
- package/common/types/options/transport/schema.d.ts +1 -1
- package/elicitation/store/elicitation-encryption.d.ts +1 -1
- package/elicitation/store/elicitation-encryption.d.ts.map +1 -1
- package/elicitation/store/elicitation-store.factory.d.ts +21 -1
- package/elicitation/store/elicitation-store.factory.d.ts.map +1 -1
- package/errors/auth-internal.errors.d.ts +2 -0
- package/errors/auth-internal.errors.d.ts.map +1 -0
- package/errors/decorator.errors.d.ts +14 -0
- package/errors/decorator.errors.d.ts.map +1 -0
- package/errors/index.d.ts +8 -1
- package/errors/index.d.ts.map +1 -1
- package/errors/normalization.errors.d.ts +32 -0
- package/errors/normalization.errors.d.ts.map +1 -0
- package/errors/provider.errors.d.ts +63 -0
- package/errors/provider.errors.d.ts.map +1 -0
- package/errors/registry.errors.d.ts +50 -0
- package/errors/registry.errors.d.ts.map +1 -0
- package/errors/remote.errors.d.ts +8 -0
- package/errors/remote.errors.d.ts.map +1 -1
- package/errors/sdk.errors.d.ts +139 -0
- package/errors/sdk.errors.d.ts.map +1 -0
- package/errors/transport.errors.d.ts +46 -0
- package/errors/transport.errors.d.ts.map +1 -0
- package/esm/index.mjs +7422 -8497
- package/esm/package.json +11 -7
- package/flows/flow.instance.d.ts.map +1 -1
- package/flows/flow.registry.d.ts.map +1 -1
- package/flows/flow.utils.d.ts.map +1 -1
- package/front-mcp/front-mcp.d.ts +30 -1
- package/front-mcp/front-mcp.d.ts.map +1 -1
- package/front-mcp/front-mcp.providers.d.ts +76 -20
- package/front-mcp/front-mcp.providers.d.ts.map +1 -1
- package/front-mcp/serverless-handler.d.ts +0 -4
- package/front-mcp/serverless-handler.d.ts.map +1 -1
- package/hooks/hook.instance.d.ts.map +1 -1
- package/hooks/hook.registry.d.ts.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +19714 -20739
- package/logger/logger.registry.d.ts.map +1 -1
- package/logger/logger.utils.d.ts.map +1 -1
- package/package.json +11 -7
- package/plugin/plugin.utils.d.ts.map +1 -1
- package/prompt/prompt.instance.d.ts.map +1 -1
- package/prompt/prompt.registry.d.ts.map +1 -1
- package/prompt/prompt.utils.d.ts.map +1 -1
- package/provider/provider.registry.d.ts.map +1 -1
- package/provider/provider.utils.d.ts.map +1 -1
- package/regsitry/registry.base.d.ts.map +1 -1
- package/remote-mcp/mcp-client.service.d.ts.map +1 -1
- package/remote-mcp/resilience/retry.d.ts.map +1 -1
- package/resource/resource.instance.d.ts.map +1 -1
- package/resource/resource.registry.d.ts.map +1 -1
- package/resource/resource.utils.d.ts.map +1 -1
- package/scope/flows/http.request.flow.d.ts +1 -1
- package/scope/flows/http.request.flow.d.ts.map +1 -1
- package/scope/scope.instance.d.ts.map +1 -1
- package/scope/scope.registry.d.ts.map +1 -1
- package/scope/scope.utils.d.ts.map +1 -1
- package/server/adapters/base.host.adapter.d.ts +4 -2
- package/server/adapters/base.host.adapter.d.ts.map +1 -1
- package/server/adapters/express.host.adapter.d.ts +6 -32
- package/server/adapters/express.host.adapter.d.ts.map +1 -1
- package/server/server.instance.d.ts +1 -1
- package/server/server.instance.d.ts.map +1 -1
- package/skill/flows/search-skills.flow.d.ts +2 -2
- package/skill/session/skill-session.manager.d.ts.map +1 -1
- package/skill/skill.utils.d.ts.map +1 -1
- package/skill/tools/search-skills.tool.d.ts +1 -1
- package/tool/tool.instance.d.ts.map +1 -1
- package/tool/tool.registry.d.ts.map +1 -1
- package/tool/tool.utils.d.ts.map +1 -1
- package/transport/adapters/streamable-http-transport.d.ts +9 -3
- package/transport/adapters/streamable-http-transport.d.ts.map +1 -1
- package/transport/event-stores/event-store.factory.d.ts +8 -3
- package/transport/event-stores/event-store.factory.d.ts.map +1 -1
- package/transport/event-stores/redis.event-store.d.ts.map +1 -1
- package/transport/flows/handle.sse.flow.d.ts +1 -1
- package/transport/flows/handle.streamable-http.flow.d.ts +1 -1
- package/transport/legacy/legacy.sse.tranporter.d.ts.map +1 -1
- package/transport/mcp-handlers/skills-mcp.types.d.ts +1 -1
- package/transport/transport.local.d.ts.map +1 -1
- package/transport/transport.registry.d.ts +1 -1
- package/transport/transport.registry.d.ts.map +1 -1
- package/transport/transport.remote.d.ts.map +1 -1
- package/adapter/adapter.regsitry.d.ts.map +0 -1
- package/auth/authorization/authorization.class.d.ts +0 -123
- package/auth/authorization/authorization.class.d.ts.map +0 -1
- package/auth/authorization/authorization.types.d.ts +0 -128
- package/auth/authorization/authorization.types.d.ts.map +0 -1
- package/auth/authorization/orchestrated.accessor.d.ts +0 -161
- package/auth/authorization/orchestrated.accessor.d.ts.map +0 -1
- package/auth/authorization/orchestrated.authorization.d.ts +0 -258
- package/auth/authorization/orchestrated.authorization.d.ts.map +0 -1
- package/auth/authorization/public.authorization.d.ts +0 -92
- package/auth/authorization/public.authorization.d.ts.map +0 -1
- package/auth/authorization/transparent.authorization.d.ts +0 -131
- package/auth/authorization/transparent.authorization.d.ts.map +0 -1
- package/auth/consent/consent.types.d.ts +0 -112
- package/auth/consent/consent.types.d.ts.map +0 -1
- package/auth/consent/index.d.ts +0 -2
- package/auth/consent/index.d.ts.map +0 -1
- package/auth/detection/auth-provider-detection.d.ts +0 -85
- package/auth/detection/auth-provider-detection.d.ts.map +0 -1
- package/auth/detection/index.d.ts +0 -2
- package/auth/detection/index.d.ts.map +0 -1
- package/auth/machine-id.d.ts +0 -28
- package/auth/machine-id.d.ts.map +0 -1
- package/auth/session/encrypted-authorization-vault.d.ts +0 -181
- package/auth/session/encrypted-authorization-vault.d.ts.map +0 -1
- package/auth/session/federated-auth.session.d.ts +0 -252
- package/auth/session/federated-auth.session.d.ts.map +0 -1
- package/auth/session/orchestrated-token.store.d.ts +0 -155
- package/auth/session/orchestrated-token.store.d.ts.map +0 -1
- package/auth/session/redis-session.store.d.ts +0 -93
- package/auth/session/redis-session.store.d.ts.map +0 -1
- package/auth/session/session-crypto.d.ts +0 -84
- package/auth/session/session-crypto.d.ts.map +0 -1
- package/auth/session/session-rate-limiter.d.ts +0 -114
- package/auth/session/session-rate-limiter.d.ts.map +0 -1
- package/auth/session/session.transport.d.ts +0 -11
- package/auth/session/session.transport.d.ts.map +0 -1
- package/auth/session/session.types.d.ts +0 -66
- package/auth/session/session.types.d.ts.map +0 -1
- package/auth/session/token.refresh.d.ts +0 -60
- package/auth/session/token.refresh.d.ts.map +0 -1
- package/auth/session/transport-session.types.d.ts +0 -479
- package/auth/session/transport-session.types.d.ts.map +0 -1
- package/auth/session/utils/auth-token.utils.d.ts +0 -12
- package/auth/session/utils/auth-token.utils.d.ts.map +0 -1
- package/auth/session/vercel-kv-session.store.d.ts +0 -117
- package/auth/session/vercel-kv-session.store.d.ts.map +0 -1
- package/auth/ui/base-layout.d.ts +0 -181
- package/auth/ui/base-layout.d.ts.map +0 -1
- package/auth/ui/index.d.ts +0 -11
- package/auth/ui/index.d.ts.map +0 -1
- package/auth/ui/templates.d.ts +0 -135
- package/auth/ui/templates.d.ts.map +0 -1
- package/auth/utils/authorization-id.utils.d.ts +0 -12
- package/auth/utils/authorization-id.utils.d.ts.map +0 -1
- package/auth/utils/index.d.ts +0 -2
- package/auth/utils/index.d.ts.map +0 -1
- package/auth/vault/auth-providers.accessor.d.ts +0 -153
- package/auth/vault/auth-providers.accessor.d.ts.map +0 -1
- package/auth/vault/auth-providers.accessor.impl.d.ts +0 -52
- package/auth/vault/auth-providers.accessor.impl.d.ts.map +0 -1
- package/auth/vault/auth-providers.registry.d.ts +0 -110
- package/auth/vault/auth-providers.registry.d.ts.map +0 -1
- package/auth/vault/auth-providers.vault.d.ts +0 -93
- package/auth/vault/auth-providers.vault.d.ts.map +0 -1
- package/auth/vault/credential-loaders/eager-loader.d.ts +0 -46
- package/auth/vault/credential-loaders/eager-loader.d.ts.map +0 -1
- package/auth/vault/credential-loaders/index.d.ts +0 -7
- package/auth/vault/credential-loaders/index.d.ts.map +0 -1
- package/auth/vault/credential-loaders/lazy-loader.d.ts +0 -53
- package/auth/vault/credential-loaders/lazy-loader.d.ts.map +0 -1
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Auth Provider Detection
|
|
3
|
-
*
|
|
4
|
-
* Detects unique auth providers across nested apps and determines
|
|
5
|
-
* if orchestrated mode is required at the parent scope level.
|
|
6
|
-
*
|
|
7
|
-
* When multiple apps have different auth providers, the parent MUST
|
|
8
|
-
* use orchestrated mode to properly manage tokens for each provider.
|
|
9
|
-
*/
|
|
10
|
-
import { z } from 'zod';
|
|
11
|
-
import { AuthOptions } from '../../common';
|
|
12
|
-
/**
|
|
13
|
-
* Schema for a detected auth provider
|
|
14
|
-
*/
|
|
15
|
-
export declare const detectedAuthProviderSchema: z.ZodObject<{
|
|
16
|
-
id: z.ZodString;
|
|
17
|
-
providerUrl: z.ZodOptional<z.ZodString>;
|
|
18
|
-
mode: z.ZodEnum<{
|
|
19
|
-
public: "public";
|
|
20
|
-
transparent: "transparent";
|
|
21
|
-
orchestrated: "orchestrated";
|
|
22
|
-
}>;
|
|
23
|
-
appIds: z.ZodArray<z.ZodString>;
|
|
24
|
-
scopes: z.ZodArray<z.ZodString>;
|
|
25
|
-
isParentProvider: z.ZodBoolean;
|
|
26
|
-
}, z.core.$strip>;
|
|
27
|
-
/**
|
|
28
|
-
* Schema for auth provider detection result
|
|
29
|
-
*/
|
|
30
|
-
export declare const authProviderDetectionResultSchema: z.ZodObject<{
|
|
31
|
-
providers: z.ZodMap<z.ZodString, z.ZodObject<{
|
|
32
|
-
id: z.ZodString;
|
|
33
|
-
providerUrl: z.ZodOptional<z.ZodString>;
|
|
34
|
-
mode: z.ZodEnum<{
|
|
35
|
-
public: "public";
|
|
36
|
-
transparent: "transparent";
|
|
37
|
-
orchestrated: "orchestrated";
|
|
38
|
-
}>;
|
|
39
|
-
appIds: z.ZodArray<z.ZodString>;
|
|
40
|
-
scopes: z.ZodArray<z.ZodString>;
|
|
41
|
-
isParentProvider: z.ZodBoolean;
|
|
42
|
-
}, z.core.$strip>>;
|
|
43
|
-
requiresOrchestration: z.ZodBoolean;
|
|
44
|
-
parentProviderId: z.ZodOptional<z.ZodString>;
|
|
45
|
-
childProviderIds: z.ZodArray<z.ZodString>;
|
|
46
|
-
uniqueProviderCount: z.ZodNumber;
|
|
47
|
-
validationErrors: z.ZodArray<z.ZodString>;
|
|
48
|
-
warnings: z.ZodArray<z.ZodString>;
|
|
49
|
-
}, z.core.$strip>;
|
|
50
|
-
export type DetectedAuthProvider = z.infer<typeof detectedAuthProviderSchema>;
|
|
51
|
-
export type AuthProviderDetectionResult = z.infer<typeof authProviderDetectionResultSchema>;
|
|
52
|
-
/**
|
|
53
|
-
* App auth info for detection (minimal interface)
|
|
54
|
-
*/
|
|
55
|
-
export interface AppAuthInfo {
|
|
56
|
-
id: string;
|
|
57
|
-
name: string;
|
|
58
|
-
auth?: AuthOptions;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Derive a stable provider ID from auth options
|
|
62
|
-
*/
|
|
63
|
-
export declare function deriveProviderId(options: AuthOptions): string;
|
|
64
|
-
/**
|
|
65
|
-
* Detect all unique auth providers across parent and apps
|
|
66
|
-
*
|
|
67
|
-
* @param parentAuth - Parent scope's auth options (may be undefined)
|
|
68
|
-
* @param apps - Array of app auth info
|
|
69
|
-
* @returns Detection result with providers, validation, and requirements
|
|
70
|
-
*/
|
|
71
|
-
export declare function detectAuthProviders(parentAuth: AuthOptions | undefined, apps: AppAuthInfo[]): AuthProviderDetectionResult;
|
|
72
|
-
/**
|
|
73
|
-
* Check if a specific app requires orchestration
|
|
74
|
-
* (i.e., has a different provider than parent)
|
|
75
|
-
*/
|
|
76
|
-
export declare function appRequiresOrchestration(appAuth: AuthOptions | undefined, parentAuth: AuthOptions | undefined): boolean;
|
|
77
|
-
/**
|
|
78
|
-
* Get all OAuth scopes needed for a provider across all apps
|
|
79
|
-
*/
|
|
80
|
-
export declare function getProviderScopes(detection: AuthProviderDetectionResult, providerId: string): string[];
|
|
81
|
-
/**
|
|
82
|
-
* Get apps that use a specific provider
|
|
83
|
-
*/
|
|
84
|
-
export declare function getProviderApps(detection: AuthProviderDetectionResult, providerId: string): string[];
|
|
85
|
-
//# sourceMappingURL=auth-provider-detection.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth-provider-detection.d.ts","sourceRoot":"","sources":["../../../src/auth/detection/auth-provider-detection.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAA6E,MAAM,cAAc,CAAC;AAMtH;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;iBAarC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;iBAe5C,CAAC;AAMH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAC;AAE5F;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAMD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAkB7D;AA+BD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,WAAW,GAAG,SAAS,EACnC,IAAI,EAAE,WAAW,EAAE,GAClB,2BAA2B,CAsF7B;AAiBD;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,WAAW,GAAG,SAAS,EAChC,UAAU,EAAE,WAAW,GAAG,SAAS,GAClC,OAAO,CAgBT;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,2BAA2B,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAGtG;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,2BAA2B,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAGpG"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export { detectedAuthProviderSchema, authProviderDetectionResultSchema, DetectedAuthProvider, AuthProviderDetectionResult, AppAuthInfo, detectAuthProviders, deriveProviderId, appRequiresOrchestration, getProviderScopes, getProviderApps, } from './auth-provider-detection';
|
|
2
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/detection/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,0BAA0B,EAC1B,iCAAiC,EAEjC,oBAAoB,EACpB,2BAA2B,EAC3B,WAAW,EAEX,mBAAmB,EACnB,gBAAgB,EAChB,wBAAwB,EACxB,iBAAiB,EACjB,eAAe,GAChB,MAAM,2BAA2B,CAAC"}
|
package/auth/machine-id.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Machine ID Utility
|
|
3
|
-
*
|
|
4
|
-
* Single source of truth for the machine ID used across session management.
|
|
5
|
-
*
|
|
6
|
-
* Configuration Priority:
|
|
7
|
-
* 1. MACHINE_ID environment variable (highest priority, recommended for production)
|
|
8
|
-
* 2. File persistence in dev mode (.frontmcp/machine-id)
|
|
9
|
-
* 3. Random UUID (ephemeral, invalidates sessions on restart)
|
|
10
|
-
*
|
|
11
|
-
* For distributed deployments with Redis session storage, set MACHINE_ID
|
|
12
|
-
* to the same value across all instances to allow session portability,
|
|
13
|
-
* or use unique values per instance to enforce session affinity.
|
|
14
|
-
*/
|
|
15
|
-
/**
|
|
16
|
-
* Get the current machine ID.
|
|
17
|
-
* Returns the override (if set via `setMachineIdOverride`) or the computed value.
|
|
18
|
-
*/
|
|
19
|
-
export declare function getMachineId(): string;
|
|
20
|
-
/**
|
|
21
|
-
* Set a process-wide machine ID override.
|
|
22
|
-
* Pass `undefined` to clear the override and revert to the computed value.
|
|
23
|
-
*
|
|
24
|
-
* This is used by `create()` to inject a stable machine ID for session continuity,
|
|
25
|
-
* especially when using Redis-backed sessions across process restarts.
|
|
26
|
-
*/
|
|
27
|
-
export declare function setMachineIdOverride(id: string | undefined): void;
|
|
28
|
-
//# sourceMappingURL=machine-id.d.ts.map
|
package/auth/machine-id.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"machine-id.d.ts","sourceRoot":"","sources":["../../src/auth/machine-id.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;GAaG;AA+GH;;;GAGG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAEjE"}
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Encrypted Authorization Vault
|
|
3
|
-
*
|
|
4
|
-
* A vault implementation that encrypts all sensitive data using a key
|
|
5
|
-
* derived from the client's JWT authorization token.
|
|
6
|
-
*
|
|
7
|
-
* Security Properties:
|
|
8
|
-
* - Zero-knowledge storage: Server cannot decrypt credentials
|
|
9
|
-
* - Client-side key: Encryption key derived from JWT (client must present token)
|
|
10
|
-
* - Authenticated encryption: AES-256-GCM prevents tampering
|
|
11
|
-
* - Per-vault keys: Each vault has a unique encryption key
|
|
12
|
-
*
|
|
13
|
-
* Usage:
|
|
14
|
-
* ```typescript
|
|
15
|
-
* const vault = new EncryptedRedisVault(redis, encryption);
|
|
16
|
-
*
|
|
17
|
-
* // On each request, derive key from JWT and set context
|
|
18
|
-
* const key = encryption.deriveKeyFromToken(token, claims);
|
|
19
|
-
* vault.setEncryptionKey(key);
|
|
20
|
-
*
|
|
21
|
-
* // Now all operations automatically encrypt/decrypt
|
|
22
|
-
* await vault.addAppCredential(vaultId, credential);
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
import { z } from 'zod';
|
|
26
|
-
import { VaultEncryption, AuthorizationVault, AuthorizationVaultEntry, AppCredential, VaultConsentRecord, VaultFederatedRecord, PendingIncrementalAuth } from '@frontmcp/auth';
|
|
27
|
-
/**
|
|
28
|
-
* What we store in Redis - minimal metadata + encrypted blob
|
|
29
|
-
*/
|
|
30
|
-
export declare const redisVaultEntrySchema: z.ZodObject<{
|
|
31
|
-
id: z.ZodString;
|
|
32
|
-
userSub: z.ZodString;
|
|
33
|
-
userEmail: z.ZodOptional<z.ZodString>;
|
|
34
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
35
|
-
clientId: z.ZodString;
|
|
36
|
-
createdAt: z.ZodNumber;
|
|
37
|
-
lastAccessAt: z.ZodNumber;
|
|
38
|
-
authorizedAppIds: z.ZodArray<z.ZodString>;
|
|
39
|
-
skippedAppIds: z.ZodArray<z.ZodString>;
|
|
40
|
-
pendingAuthIds: z.ZodArray<z.ZodString>;
|
|
41
|
-
encrypted: z.ZodObject<{
|
|
42
|
-
v: z.ZodLiteral<1>;
|
|
43
|
-
alg: z.ZodLiteral<"aes-256-gcm">;
|
|
44
|
-
iv: z.ZodString;
|
|
45
|
-
ct: z.ZodString;
|
|
46
|
-
tag: z.ZodString;
|
|
47
|
-
}, z.core.$strip>;
|
|
48
|
-
}, z.core.$strip>;
|
|
49
|
-
export type RedisVaultEntry = z.infer<typeof redisVaultEntrySchema>;
|
|
50
|
-
/**
|
|
51
|
-
* Encryption context for the current request
|
|
52
|
-
* Must be set before performing vault operations
|
|
53
|
-
*/
|
|
54
|
-
export interface EncryptionContext {
|
|
55
|
-
/** Encryption key derived from JWT */
|
|
56
|
-
key: Uint8Array;
|
|
57
|
-
/** Vault ID (from JWT jti claim) */
|
|
58
|
-
vaultId: string;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Redis vault with client-side encryption
|
|
62
|
-
*
|
|
63
|
-
* All sensitive data (tokens, credentials, consent, pending auths)
|
|
64
|
-
* is encrypted using a key derived from the client's JWT.
|
|
65
|
-
*
|
|
66
|
-
* Use `runWithContext()` to set encryption context for concurrent safety.
|
|
67
|
-
*/
|
|
68
|
-
export declare class EncryptedRedisVault implements AuthorizationVault {
|
|
69
|
-
private readonly redis;
|
|
70
|
-
private readonly encryption;
|
|
71
|
-
private readonly namespace;
|
|
72
|
-
constructor(redis: any, encryption: VaultEncryption, namespace?: string);
|
|
73
|
-
/**
|
|
74
|
-
* Run a callback with encryption context set for the current async scope.
|
|
75
|
-
* This is the recommended way to set encryption context as it is safe for
|
|
76
|
-
* concurrent requests (each request gets its own isolated context).
|
|
77
|
-
*
|
|
78
|
-
* @param context - Encryption context with key and vaultId
|
|
79
|
-
* @param fn - Async function to run with the context
|
|
80
|
-
* @returns The result of the callback
|
|
81
|
-
*
|
|
82
|
-
* @example
|
|
83
|
-
* ```typescript
|
|
84
|
-
* const result = await vault.runWithContext({ key, vaultId }, async () => {
|
|
85
|
-
* await vault.get(id);
|
|
86
|
-
* await vault.update(id, data);
|
|
87
|
-
* return 'done';
|
|
88
|
-
* });
|
|
89
|
-
* ```
|
|
90
|
-
*/
|
|
91
|
-
runWithContext<T>(context: EncryptionContext, fn: () => T | Promise<T>): T | Promise<T>;
|
|
92
|
-
/**
|
|
93
|
-
* Get current encryption key from AsyncLocalStorage.
|
|
94
|
-
*/
|
|
95
|
-
private getKey;
|
|
96
|
-
/**
|
|
97
|
-
* Create Redis key from vault ID
|
|
98
|
-
*/
|
|
99
|
-
private redisKey;
|
|
100
|
-
/**
|
|
101
|
-
* Create credential key from appId and providerId
|
|
102
|
-
*/
|
|
103
|
-
private credentialKey;
|
|
104
|
-
/**
|
|
105
|
-
* Encrypt sensitive data
|
|
106
|
-
*/
|
|
107
|
-
private encryptSensitive;
|
|
108
|
-
/**
|
|
109
|
-
* Decrypt sensitive data
|
|
110
|
-
*/
|
|
111
|
-
private decryptSensitive;
|
|
112
|
-
/**
|
|
113
|
-
* Convert Redis entry to full vault entry (decrypts sensitive data)
|
|
114
|
-
*/
|
|
115
|
-
private toVaultEntry;
|
|
116
|
-
/**
|
|
117
|
-
* Convert vault entry to Redis entry (encrypts sensitive data)
|
|
118
|
-
*/
|
|
119
|
-
private toRedisEntry;
|
|
120
|
-
/**
|
|
121
|
-
* Save entry to Redis
|
|
122
|
-
*/
|
|
123
|
-
private saveEntry;
|
|
124
|
-
/**
|
|
125
|
-
* Load entry from Redis
|
|
126
|
-
*/
|
|
127
|
-
private loadEntry;
|
|
128
|
-
create(params: {
|
|
129
|
-
userSub: string;
|
|
130
|
-
userEmail?: string;
|
|
131
|
-
userName?: string;
|
|
132
|
-
clientId: string;
|
|
133
|
-
consent?: VaultConsentRecord;
|
|
134
|
-
federated?: VaultFederatedRecord;
|
|
135
|
-
authorizedAppIds?: string[];
|
|
136
|
-
skippedAppIds?: string[];
|
|
137
|
-
}): Promise<AuthorizationVaultEntry>;
|
|
138
|
-
get(id: string): Promise<AuthorizationVaultEntry | null>;
|
|
139
|
-
update(id: string, updates: Partial<AuthorizationVaultEntry>): Promise<void>;
|
|
140
|
-
delete(id: string): Promise<void>;
|
|
141
|
-
updateConsent(vaultId: string, consent: VaultConsentRecord): Promise<void>;
|
|
142
|
-
authorizeApp(vaultId: string, appId: string): Promise<void>;
|
|
143
|
-
createPendingAuth(vaultId: string, params: {
|
|
144
|
-
appId: string;
|
|
145
|
-
toolId?: string;
|
|
146
|
-
authUrl: string;
|
|
147
|
-
requiredScopes?: string[];
|
|
148
|
-
elicitId?: string;
|
|
149
|
-
ttlMs?: number;
|
|
150
|
-
}): Promise<PendingIncrementalAuth>;
|
|
151
|
-
getPendingAuth(vaultId: string, pendingAuthId: string): Promise<PendingIncrementalAuth | null>;
|
|
152
|
-
completePendingAuth(vaultId: string, pendingAuthId: string): Promise<void>;
|
|
153
|
-
cancelPendingAuth(vaultId: string, pendingAuthId: string): Promise<void>;
|
|
154
|
-
isAppAuthorized(vaultId: string, appId: string): Promise<boolean>;
|
|
155
|
-
getPendingAuths(vaultId: string): Promise<PendingIncrementalAuth[]>;
|
|
156
|
-
addAppCredential(vaultId: string, credential: AppCredential): Promise<void>;
|
|
157
|
-
removeAppCredential(vaultId: string, appId: string, providerId: string): Promise<void>;
|
|
158
|
-
getAppCredentials(vaultId: string, appId: string): Promise<AppCredential[]>;
|
|
159
|
-
getCredential(vaultId: string, appId: string, providerId: string): Promise<AppCredential | null>;
|
|
160
|
-
getAllCredentials(vaultId: string, filterByConsent?: boolean): Promise<AppCredential[]>;
|
|
161
|
-
updateCredential(vaultId: string, appId: string, providerId: string, updates: Partial<Pick<AppCredential, 'lastUsedAt' | 'isValid' | 'invalidReason' | 'expiresAt' | 'metadata'>>): Promise<void>;
|
|
162
|
-
shouldStoreCredential(vaultId: string, appId: string, toolIds?: string[]): Promise<boolean>;
|
|
163
|
-
invalidateCredential(vaultId: string, appId: string, providerId: string, reason: string): Promise<void>;
|
|
164
|
-
refreshOAuthCredential(vaultId: string, appId: string, providerId: string, tokens: {
|
|
165
|
-
accessToken: string;
|
|
166
|
-
refreshToken?: string;
|
|
167
|
-
expiresAt?: number;
|
|
168
|
-
}): Promise<void>;
|
|
169
|
-
cleanup(): Promise<void>;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Create an encrypted vault with the given configuration
|
|
173
|
-
*/
|
|
174
|
-
export declare function createEncryptedVault(redis: any, config?: {
|
|
175
|
-
pepper?: string;
|
|
176
|
-
namespace?: string;
|
|
177
|
-
}): {
|
|
178
|
-
vault: EncryptedRedisVault;
|
|
179
|
-
encryption: VaultEncryption;
|
|
180
|
-
};
|
|
181
|
-
//# sourceMappingURL=encrypted-authorization-vault.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encrypted-authorization-vault.d.ts","sourceRoot":"","sources":["../../../src/auth/session/encrypted-authorization-vault.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EACL,eAAe,EAIf,kBAAkB,EAClB,uBAAuB,EACvB,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EAEvB,MAAM,gBAAgB,CAAC;AAMxB;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;iBAuBhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAMpE;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,sCAAsC;IACtC,GAAG,EAAE,UAAU,CAAC;IAChB,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC;CACjB;AAYD;;;;;;;GAOG;AACH,qBAAa,mBAAoB,YAAW,kBAAkB;IAG1D,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,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A;CAAE,CAK7D"}
|
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Federated Auth Session
|
|
3
|
-
*
|
|
4
|
-
* Manages state during multi-provider OAuth flows where a user needs to
|
|
5
|
-
* authenticate with multiple upstream OAuth providers sequentially.
|
|
6
|
-
*
|
|
7
|
-
* Flow:
|
|
8
|
-
* 1. User selects providers on federated login page
|
|
9
|
-
* 2. System stores FederatedAuthSession with provider queue
|
|
10
|
-
* 3. User is redirected to first provider's OAuth authorize endpoint
|
|
11
|
-
* 4. After provider callback, tokens are stored and next provider is processed
|
|
12
|
-
* 5. When all providers complete, FrontMCP JWT is issued
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* PKCE data for upstream provider OAuth flow
|
|
16
|
-
*/
|
|
17
|
-
export interface ProviderPkce {
|
|
18
|
-
/** Code verifier (used in token exchange) */
|
|
19
|
-
verifier: string;
|
|
20
|
-
/** Code challenge (sent to authorize endpoint) */
|
|
21
|
-
challenge: string;
|
|
22
|
-
/** Challenge method (always S256) */
|
|
23
|
-
method: 'S256';
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Token data received from an upstream provider
|
|
27
|
-
*/
|
|
28
|
-
export interface ProviderTokens {
|
|
29
|
-
/** Access token */
|
|
30
|
-
accessToken: string;
|
|
31
|
-
/** Refresh token (if provided) */
|
|
32
|
-
refreshToken?: string;
|
|
33
|
-
/** Token expiration (epoch ms) */
|
|
34
|
-
expiresAt?: number;
|
|
35
|
-
/** Token type (usually 'Bearer') */
|
|
36
|
-
tokenType?: string;
|
|
37
|
-
/** Granted scopes */
|
|
38
|
-
scopes?: string[];
|
|
39
|
-
/** ID token (for OIDC providers) */
|
|
40
|
-
idToken?: string;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* User info from an upstream provider
|
|
44
|
-
*/
|
|
45
|
-
export interface ProviderUserInfo {
|
|
46
|
-
/** Subject identifier from provider */
|
|
47
|
-
sub: string;
|
|
48
|
-
/** User email */
|
|
49
|
-
email?: string;
|
|
50
|
-
/** Display name */
|
|
51
|
-
name?: string;
|
|
52
|
-
/** Profile picture URL */
|
|
53
|
-
picture?: string;
|
|
54
|
-
/** Additional claims */
|
|
55
|
-
claims?: Record<string, unknown>;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Completed provider entry in the federated session
|
|
59
|
-
*/
|
|
60
|
-
export interface CompletedProvider {
|
|
61
|
-
/** Provider ID */
|
|
62
|
-
providerId: string;
|
|
63
|
-
/** OAuth tokens from the provider */
|
|
64
|
-
tokens: ProviderTokens;
|
|
65
|
-
/** User info from the provider */
|
|
66
|
-
userInfo?: ProviderUserInfo;
|
|
67
|
-
/** Timestamp when provider auth completed */
|
|
68
|
-
completedAt: number;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Federated Auth Session state
|
|
72
|
-
*
|
|
73
|
-
* Stored during multi-provider OAuth flow to track progress
|
|
74
|
-
*/
|
|
75
|
-
export interface FederatedAuthSession {
|
|
76
|
-
/** Unique session ID */
|
|
77
|
-
id: string;
|
|
78
|
-
/** Original pending auth ID (from /oauth/authorize request) */
|
|
79
|
-
pendingAuthId: string;
|
|
80
|
-
/** Client ID that initiated the auth flow */
|
|
81
|
-
clientId: string;
|
|
82
|
-
/** Redirect URI for final callback */
|
|
83
|
-
redirectUri: string;
|
|
84
|
-
/** Requested scopes for FrontMCP token */
|
|
85
|
-
scopes: string[];
|
|
86
|
-
/** Original state parameter from client */
|
|
87
|
-
state?: string;
|
|
88
|
-
/** Resource/audience for final token */
|
|
89
|
-
resource?: string;
|
|
90
|
-
/** User info (email, name) from initial login form */
|
|
91
|
-
userInfo: {
|
|
92
|
-
email?: string;
|
|
93
|
-
name?: string;
|
|
94
|
-
sub?: string;
|
|
95
|
-
};
|
|
96
|
-
/** PKCE challenge for final FrontMCP token exchange */
|
|
97
|
-
frontmcpPkce: {
|
|
98
|
-
challenge: string;
|
|
99
|
-
method: 'S256';
|
|
100
|
-
};
|
|
101
|
-
/** Queue of provider IDs remaining to auth */
|
|
102
|
-
providerQueue: string[];
|
|
103
|
-
/** Map of completed providers with their tokens */
|
|
104
|
-
completedProviders: Map<string, CompletedProvider>;
|
|
105
|
-
/** Providers that user declined/skipped */
|
|
106
|
-
skippedProviders: string[];
|
|
107
|
-
/** Currently active provider (being authenticated) */
|
|
108
|
-
currentProviderId?: string;
|
|
109
|
-
/** PKCE data for current provider's OAuth flow */
|
|
110
|
-
currentProviderPkce?: ProviderPkce;
|
|
111
|
-
/** State parameter for current provider's OAuth flow */
|
|
112
|
-
currentProviderState?: string;
|
|
113
|
-
/** Session creation timestamp */
|
|
114
|
-
createdAt: number;
|
|
115
|
-
/** Session expiration timestamp */
|
|
116
|
-
expiresAt: number;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Serializable version of FederatedAuthSession for storage
|
|
120
|
-
*/
|
|
121
|
-
export interface FederatedAuthSessionRecord {
|
|
122
|
-
id: string;
|
|
123
|
-
pendingAuthId: string;
|
|
124
|
-
clientId: string;
|
|
125
|
-
redirectUri: string;
|
|
126
|
-
scopes: string[];
|
|
127
|
-
state?: string;
|
|
128
|
-
resource?: string;
|
|
129
|
-
userInfo: {
|
|
130
|
-
email?: string;
|
|
131
|
-
name?: string;
|
|
132
|
-
sub?: string;
|
|
133
|
-
};
|
|
134
|
-
frontmcpPkce: {
|
|
135
|
-
challenge: string;
|
|
136
|
-
method: 'S256';
|
|
137
|
-
};
|
|
138
|
-
providerQueue: string[];
|
|
139
|
-
completedProviders: Array<[string, CompletedProvider]>;
|
|
140
|
-
skippedProviders: string[];
|
|
141
|
-
currentProviderId?: string;
|
|
142
|
-
currentProviderPkce?: ProviderPkce;
|
|
143
|
-
currentProviderState?: string;
|
|
144
|
-
createdAt: number;
|
|
145
|
-
expiresAt: number;
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Federated Auth Session Store Interface
|
|
149
|
-
*/
|
|
150
|
-
export interface FederatedAuthSessionStore {
|
|
151
|
-
/** Store a federated auth session */
|
|
152
|
-
store(session: FederatedAuthSession): Promise<void>;
|
|
153
|
-
/** Get a federated auth session by ID */
|
|
154
|
-
get(id: string): Promise<FederatedAuthSession | null>;
|
|
155
|
-
/** Delete a federated auth session */
|
|
156
|
-
delete(id: string): Promise<void>;
|
|
157
|
-
/** Update a federated auth session */
|
|
158
|
-
update(session: FederatedAuthSession): Promise<void>;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Convert FederatedAuthSession to serializable record
|
|
162
|
-
*/
|
|
163
|
-
export declare function toSessionRecord(session: FederatedAuthSession): FederatedAuthSessionRecord;
|
|
164
|
-
/**
|
|
165
|
-
* Convert serializable record back to FederatedAuthSession
|
|
166
|
-
*/
|
|
167
|
-
export declare function fromSessionRecord(record: FederatedAuthSessionRecord): FederatedAuthSession;
|
|
168
|
-
/**
|
|
169
|
-
* Parameters for creating a federated auth session
|
|
170
|
-
*/
|
|
171
|
-
export interface FederatedAuthSessionCreateParams {
|
|
172
|
-
pendingAuthId: string;
|
|
173
|
-
clientId: string;
|
|
174
|
-
redirectUri: string;
|
|
175
|
-
scopes: string[];
|
|
176
|
-
state?: string;
|
|
177
|
-
resource?: string;
|
|
178
|
-
userInfo: {
|
|
179
|
-
email?: string;
|
|
180
|
-
name?: string;
|
|
181
|
-
sub?: string;
|
|
182
|
-
};
|
|
183
|
-
frontmcpPkce: {
|
|
184
|
-
challenge: string;
|
|
185
|
-
method: 'S256';
|
|
186
|
-
};
|
|
187
|
-
providerIds: string[];
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* In-Memory Federated Auth Session Store
|
|
191
|
-
*
|
|
192
|
-
* Development/testing implementation for federated auth session storage.
|
|
193
|
-
*/
|
|
194
|
-
export declare class InMemoryFederatedAuthSessionStore implements FederatedAuthSessionStore {
|
|
195
|
-
private readonly sessions;
|
|
196
|
-
/** Default TTL for sessions (15 minutes) */
|
|
197
|
-
private readonly sessionTtlMs;
|
|
198
|
-
/** Cleanup interval timer */
|
|
199
|
-
private cleanupTimer?;
|
|
200
|
-
constructor();
|
|
201
|
-
store(session: FederatedAuthSession): Promise<void>;
|
|
202
|
-
get(id: string): Promise<FederatedAuthSession | null>;
|
|
203
|
-
delete(id: string): Promise<void>;
|
|
204
|
-
update(session: FederatedAuthSession): Promise<void>;
|
|
205
|
-
/**
|
|
206
|
-
* Clean up expired sessions
|
|
207
|
-
*/
|
|
208
|
-
cleanup(): Promise<void>;
|
|
209
|
-
/**
|
|
210
|
-
* Stop the cleanup timer
|
|
211
|
-
*/
|
|
212
|
-
dispose(): void;
|
|
213
|
-
/**
|
|
214
|
-
* Create a new federated auth session
|
|
215
|
-
*/
|
|
216
|
-
createSession(params: FederatedAuthSessionCreateParams): FederatedAuthSession;
|
|
217
|
-
/**
|
|
218
|
-
* Get count (for testing/monitoring)
|
|
219
|
-
*/
|
|
220
|
-
get size(): number;
|
|
221
|
-
/**
|
|
222
|
-
* Clear all sessions (for testing)
|
|
223
|
-
*/
|
|
224
|
-
clear(): void;
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Create a new federated auth session object
|
|
228
|
-
*
|
|
229
|
-
* This is a standalone factory function that creates a FederatedAuthSession
|
|
230
|
-
* without requiring a store instance. Use this for type-safe session creation.
|
|
231
|
-
*
|
|
232
|
-
* @param params Session parameters
|
|
233
|
-
* @param ttlMs Session TTL in milliseconds (default: 15 minutes)
|
|
234
|
-
*/
|
|
235
|
-
export declare function createFederatedAuthSession(params: FederatedAuthSessionCreateParams, ttlMs?: number): FederatedAuthSession;
|
|
236
|
-
/**
|
|
237
|
-
* Helper to check if all providers have been authenticated
|
|
238
|
-
*/
|
|
239
|
-
export declare function isSessionComplete(session: FederatedAuthSession): boolean;
|
|
240
|
-
/**
|
|
241
|
-
* Helper to get the next provider to authenticate
|
|
242
|
-
*/
|
|
243
|
-
export declare function getNextProvider(session: FederatedAuthSession): string | undefined;
|
|
244
|
-
/**
|
|
245
|
-
* Helper to mark current provider as complete and move to next
|
|
246
|
-
*/
|
|
247
|
-
export declare function completeCurrentProvider(session: FederatedAuthSession, tokens: ProviderTokens, userInfo?: ProviderUserInfo): void;
|
|
248
|
-
/**
|
|
249
|
-
* Helper to start authentication with next provider
|
|
250
|
-
*/
|
|
251
|
-
export declare function startNextProvider(session: FederatedAuthSession, pkce: ProviderPkce, state: string): string;
|
|
252
|
-
//# sourceMappingURL=federated-auth.session.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"federated-auth.session.d.ts","sourceRoot":"","sources":["../../../src/auth/session/federated-auth.session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,kDAAkD;IAClD,SAAS,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,mBAAmB;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qBAAqB;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,oCAAoC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,uCAAuC;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,iBAAiB;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mBAAmB;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0BAA0B;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wBAAwB;IACxB,MAAM,CAAC,E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