@passflow/core 0.19.0 → 0.20.1
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/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5944 -0
- package/dist/index.d.ts +5944 -0
- package/dist/index.mjs +4618 -7244
- package/dist/index.mjs.map +1 -1
- package/package.json +38 -27
- package/dist/lib/api/app.d.ts +0 -11
- package/dist/lib/api/app.d.ts.map +0 -1
- package/dist/lib/api/auth.d.ts +0 -42
- package/dist/lib/api/auth.d.ts.map +0 -1
- package/dist/lib/api/axios-client.d.ts +0 -109
- package/dist/lib/api/axios-client.d.ts.map +0 -1
- package/dist/lib/api/cli-auth.d.ts +0 -12
- package/dist/lib/api/cli-auth.d.ts.map +0 -1
- package/dist/lib/api/index.d.ts +0 -11
- package/dist/lib/api/index.d.ts.map +0 -1
- package/dist/lib/api/invitation.d.ts +0 -80
- package/dist/lib/api/invitation.d.ts.map +0 -1
- package/dist/lib/api/model.d.ts +0 -844
- package/dist/lib/api/model.d.ts.map +0 -1
- package/dist/lib/api/setting.d.ts +0 -13
- package/dist/lib/api/setting.d.ts.map +0 -1
- package/dist/lib/api/tenant.d.ts +0 -216
- package/dist/lib/api/tenant.d.ts.map +0 -1
- package/dist/lib/api/two-factor.d.ts +0 -137
- package/dist/lib/api/two-factor.d.ts.map +0 -1
- package/dist/lib/api/upgrade.d.ts +0 -39
- package/dist/lib/api/upgrade.d.ts.map +0 -1
- package/dist/lib/api/user.d.ts +0 -22
- package/dist/lib/api/user.d.ts.map +0 -1
- package/dist/lib/constants/index.d.ts +0 -33
- package/dist/lib/constants/index.d.ts.map +0 -1
- package/dist/lib/device/index.d.ts +0 -17
- package/dist/lib/device/index.d.ts.map +0 -1
- package/dist/lib/index.d.ts +0 -23
- package/dist/lib/index.d.ts.map +0 -1
- package/dist/lib/interceptors/fetch-registry.d.ts +0 -96
- package/dist/lib/interceptors/fetch-registry.d.ts.map +0 -1
- package/dist/lib/m2m/client.d.ts +0 -196
- package/dist/lib/m2m/client.d.ts.map +0 -1
- package/dist/lib/m2m/errors.d.ts +0 -107
- package/dist/lib/m2m/errors.d.ts.map +0 -1
- package/dist/lib/m2m/index.d.ts +0 -27
- package/dist/lib/m2m/index.d.ts.map +0 -1
- package/dist/lib/m2m/types.d.ts +0 -217
- package/dist/lib/m2m/types.d.ts.map +0 -1
- package/dist/lib/passflow.d.ts +0 -1224
- package/dist/lib/passflow.d.ts.map +0 -1
- package/dist/lib/pkce.d.ts +0 -13
- package/dist/lib/pkce.d.ts.map +0 -1
- package/dist/lib/platform/index.d.ts +0 -4
- package/dist/lib/platform/index.d.ts.map +0 -1
- package/dist/lib/platform/types.d.ts +0 -206
- package/dist/lib/platform/types.d.ts.map +0 -1
- package/dist/lib/platform/web-adapter.d.ts +0 -104
- package/dist/lib/platform/web-adapter.d.ts.map +0 -1
- package/dist/lib/services/auth-service.d.ts +0 -197
- package/dist/lib/services/auth-service.d.ts.map +0 -1
- package/dist/lib/services/index.d.ts +0 -8
- package/dist/lib/services/index.d.ts.map +0 -1
- package/dist/lib/services/invitation-service.d.ts +0 -44
- package/dist/lib/services/invitation-service.d.ts.map +0 -1
- package/dist/lib/services/logger.d.ts +0 -24
- package/dist/lib/services/logger.d.ts.map +0 -1
- package/dist/lib/services/tenant-service.d.ts +0 -200
- package/dist/lib/services/tenant-service.d.ts.map +0 -1
- package/dist/lib/services/tenant-user-membership.d.ts +0 -76
- package/dist/lib/services/tenant-user-membership.d.ts.map +0 -1
- package/dist/lib/services/token-cache-service.d.ts +0 -36
- package/dist/lib/services/token-cache-service.d.ts.map +0 -1
- package/dist/lib/services/two-factor-service.d.ts +0 -193
- package/dist/lib/services/two-factor-service.d.ts.map +0 -1
- package/dist/lib/services/user-service.d.ts +0 -41
- package/dist/lib/services/user-service.d.ts.map +0 -1
- package/dist/lib/storage/index.d.ts +0 -106
- package/dist/lib/storage/index.d.ts.map +0 -1
- package/dist/lib/store.d.ts +0 -175
- package/dist/lib/store.d.ts.map +0 -1
- package/dist/lib/token/delivery-manager.d.ts +0 -121
- package/dist/lib/token/delivery-manager.d.ts.map +0 -1
- package/dist/lib/token/index.d.ts +0 -4
- package/dist/lib/token/index.d.ts.map +0 -1
- package/dist/lib/token/membership.d.ts +0 -37
- package/dist/lib/token/membership.d.ts.map +0 -1
- package/dist/lib/token/service.d.ts +0 -47
- package/dist/lib/token/service.d.ts.map +0 -1
- package/dist/lib/token/token.d.ts +0 -55
- package/dist/lib/token/token.d.ts.map +0 -1
- package/dist/lib/types/index.d.ts +0 -24
- package/dist/lib/types/index.d.ts.map +0 -1
- package/dist/lib/upgrade/acr.d.ts +0 -85
- package/dist/lib/upgrade/acr.d.ts.map +0 -1
- package/dist/lib/upgrade/axios-adapter.d.ts +0 -81
- package/dist/lib/upgrade/axios-adapter.d.ts.map +0 -1
- package/dist/lib/upgrade/challenge.d.ts +0 -217
- package/dist/lib/upgrade/challenge.d.ts.map +0 -1
- package/dist/lib/upgrade/client.d.ts +0 -29
- package/dist/lib/upgrade/client.d.ts.map +0 -1
- package/dist/lib/upgrade/controller.d.ts +0 -435
- package/dist/lib/upgrade/controller.d.ts.map +0 -1
- package/dist/lib/upgrade/core.d.ts +0 -353
- package/dist/lib/upgrade/core.d.ts.map +0 -1
- package/dist/lib/upgrade/errors.d.ts +0 -208
- package/dist/lib/upgrade/errors.d.ts.map +0 -1
- package/dist/lib/upgrade/facade.d.ts +0 -188
- package/dist/lib/upgrade/facade.d.ts.map +0 -1
- package/dist/lib/upgrade/factors.d.ts +0 -97
- package/dist/lib/upgrade/factors.d.ts.map +0 -1
- package/dist/lib/upgrade/fetch-adapter.d.ts +0 -30
- package/dist/lib/upgrade/fetch-adapter.d.ts.map +0 -1
- package/dist/lib/upgrade/index.d.ts +0 -20
- package/dist/lib/upgrade/index.d.ts.map +0 -1
- package/dist/lib/upgrade/markers.d.ts +0 -64
- package/dist/lib/upgrade/markers.d.ts.map +0 -1
- package/dist/lib/upgrade/replay.d.ts +0 -132
- package/dist/lib/upgrade/replay.d.ts.map +0 -1
- package/dist/lib/upgrade/select.d.ts +0 -48
- package/dist/lib/upgrade/select.d.ts.map +0 -1
- package/dist/lib/upgrade/session.d.ts +0 -72
- package/dist/lib/upgrade/session.d.ts.map +0 -1
- package/dist/lib/upgrade/snapshot.d.ts +0 -196
- package/dist/lib/upgrade/snapshot.d.ts.map +0 -1
- package/dist/lib/upgrade/transport.d.ts +0 -69
- package/dist/lib/upgrade/transport.d.ts.map +0 -1
- package/dist/lib/utils/validation.d.ts +0 -54
- package/dist/lib/utils/validation.d.ts.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Storage Manager
|
|
3
|
-
*
|
|
4
|
-
* Abstraction layer over browser localStorage for token and data persistence.
|
|
5
|
-
* Supports custom storage implementations for testing and alternative platforms.
|
|
6
|
-
* Handles key prefixing for multi-app scenarios.
|
|
7
|
-
*
|
|
8
|
-
* @module storage
|
|
9
|
-
*/
|
|
10
|
-
import { TokenType } from '../token';
|
|
11
|
-
import { TokenDeliveryMode, Tokens } from '../types';
|
|
12
|
-
export type Storage = {
|
|
13
|
-
setItem: (key: string, value: string) => void;
|
|
14
|
-
getItem: (key: string) => string | null;
|
|
15
|
-
removeItem: (key: string) => void;
|
|
16
|
-
};
|
|
17
|
-
export interface StorageManagerParams {
|
|
18
|
-
storage?: Storage;
|
|
19
|
-
prefix?: string;
|
|
20
|
-
}
|
|
21
|
-
export declare class StorageManager {
|
|
22
|
-
private keyStoragePrefix;
|
|
23
|
-
readonly scopes: string;
|
|
24
|
-
readonly deviceId: string;
|
|
25
|
-
readonly invitationToken: string;
|
|
26
|
-
readonly previousRedirectUrl: string;
|
|
27
|
-
private readonly STORAGE_PREFIX;
|
|
28
|
-
private readonly ID_TOKEN_KEY;
|
|
29
|
-
private readonly CSRF_TOKEN_KEY;
|
|
30
|
-
private readonly DELIVERY_MODE_KEY;
|
|
31
|
-
private storage;
|
|
32
|
-
constructor({ storage, prefix }?: StorageManagerParams);
|
|
33
|
-
/**
|
|
34
|
-
* Save tokens to storage with conditional logic based on delivery mode
|
|
35
|
-
* In cookie/BFF mode: ONLY save ID token (not access/refresh tokens)
|
|
36
|
-
* In JSON mode: save all tokens (existing behavior)
|
|
37
|
-
*/
|
|
38
|
-
saveTokens(tokens: Tokens, deliveryMode?: TokenDeliveryMode): void;
|
|
39
|
-
getToken(tokenType: TokenType): string | undefined;
|
|
40
|
-
/**
|
|
41
|
-
* Get tokens from storage with conditional logic based on delivery mode
|
|
42
|
-
* In cookie/BFF mode: return ID token only (access/refresh in HttpOnly cookies)
|
|
43
|
-
* In JSON mode: return all stored tokens (existing behavior)
|
|
44
|
-
*/
|
|
45
|
-
getTokens(): Tokens | undefined;
|
|
46
|
-
getScopes(): string[] | undefined;
|
|
47
|
-
/**
|
|
48
|
-
* Check if JSON mode tokens exist in storage (ignores delivery mode)
|
|
49
|
-
* Used to detect stale state where delivery_mode is set but JSON tokens exist
|
|
50
|
-
*/
|
|
51
|
-
hasJsonModeTokens(): boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Check if cookie mode ID token exists in storage
|
|
54
|
-
* Used to detect legitimate cookie/BFF mode sessions
|
|
55
|
-
*/
|
|
56
|
-
hasCookieModeIdToken(): boolean;
|
|
57
|
-
deleteToken(tokenType: TokenType): void;
|
|
58
|
-
deleteTokens(): void;
|
|
59
|
-
getDeviceId(): string | undefined;
|
|
60
|
-
setDeviceId(deviceId: string): void;
|
|
61
|
-
deleteDeviceId(): void;
|
|
62
|
-
setInvitationToken(token: string): void;
|
|
63
|
-
getInvitationToken(): string | undefined;
|
|
64
|
-
deleteInvitationToken(): void;
|
|
65
|
-
setPreviousRedirectUrl(url: string): void;
|
|
66
|
-
getPreviousRedirectUrl(): string | undefined;
|
|
67
|
-
deletePreviousRedirectUrl(): void;
|
|
68
|
-
/**
|
|
69
|
-
* Set the token delivery mode in storage
|
|
70
|
-
*/
|
|
71
|
-
setDeliveryMode(mode: TokenDeliveryMode): void;
|
|
72
|
-
/**
|
|
73
|
-
* Get the token delivery mode from storage
|
|
74
|
-
*/
|
|
75
|
-
getDeliveryMode(): TokenDeliveryMode | undefined;
|
|
76
|
-
/**
|
|
77
|
-
* Clear the delivery mode from storage
|
|
78
|
-
*/
|
|
79
|
-
clearDeliveryMode(): void;
|
|
80
|
-
/**
|
|
81
|
-
* Get the ID token from storage (cookie mode)
|
|
82
|
-
*/
|
|
83
|
-
getIdToken(): string | undefined;
|
|
84
|
-
/**
|
|
85
|
-
* Set the ID token in storage (cookie mode)
|
|
86
|
-
*/
|
|
87
|
-
setIdToken(token: string): void;
|
|
88
|
-
/**
|
|
89
|
-
* Clear the ID token from storage
|
|
90
|
-
*/
|
|
91
|
-
clearIdToken(): void;
|
|
92
|
-
/**
|
|
93
|
-
* Get the CSRF token from storage
|
|
94
|
-
*/
|
|
95
|
-
getCsrfToken(): string | undefined;
|
|
96
|
-
/**
|
|
97
|
-
* Set the CSRF token in storage
|
|
98
|
-
*/
|
|
99
|
-
setCsrfToken(token: string): void;
|
|
100
|
-
/**
|
|
101
|
-
* Clear the CSRF token from storage
|
|
102
|
-
*/
|
|
103
|
-
clearCsrfToken(): void;
|
|
104
|
-
private getKeyForTokenType;
|
|
105
|
-
}
|
|
106
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/storage/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAErD,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IA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BAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIvC,kBAAkB,IAAI,MAAM,GAAG,SAAS;IAIxC,qBAAqB,IAAI,IAAI;IAI7B,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIzC,sBAAsB,IAAI,MAAM,GAAG,SAAS;IAI5C,yBAAyB,IAAI,IAAI;IAMjC;;OAEG;IACH,eAAe,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI;IAQ9C;;OAEG;IACH,eAAe,IAAI,iBAAiB,GAAG,SAAS;IAYhD;;OAEG;IACH,iBAAiB,IAAI,IAAI;IAUzB;;OAEG;IACH,UAAU,IAAI,MAAM,GAAG,SAAS;IAShC;;OAEG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAQ/B;;OAEG;IACH,YAAY,IAAI,IAAI;IAUpB;;OAEG;IACH,YAAY,IAAI,MAAM,GAAG,SAAS;IASlC;;OAEG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAQjC;;OAEG;IACH,cAAc,IAAI,IAAI;IAQtB,OAAO,CAAC,kBAAkB;CAG3B"}
|
package/dist/lib/store.d.ts
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Passflow Store
|
|
3
|
-
*
|
|
4
|
-
* Event subscription system using the Observer pattern.
|
|
5
|
-
* Manages authentication event notifications to subscribers.
|
|
6
|
-
* Supports filtered subscriptions for specific event types.
|
|
7
|
-
*
|
|
8
|
-
* @module store
|
|
9
|
-
*/
|
|
10
|
-
import type { TwoFactorMethod } from './api/model';
|
|
11
|
-
import { ParsedTokens, Tokens } from './types';
|
|
12
|
-
/**
|
|
13
|
-
* Passflow event types
|
|
14
|
-
*/
|
|
15
|
-
export declare enum PassflowEvent {
|
|
16
|
-
SignIn = "signin",
|
|
17
|
-
SignInStart = "signin:start",
|
|
18
|
-
Register = "register",
|
|
19
|
-
RegisterStart = "register:start",
|
|
20
|
-
SignOut = "signout",
|
|
21
|
-
SessionRestored = "session:restored",
|
|
22
|
-
SessionExpired = "session:expired",
|
|
23
|
-
Error = "error",
|
|
24
|
-
Refresh = "refresh",
|
|
25
|
-
RefreshStart = "refresh:start",
|
|
26
|
-
TokenCacheExpired = "token-cache-expired",
|
|
27
|
-
TwoFactorRequired = "2fa:required",
|
|
28
|
-
TwoFactorSetupStarted = "2fa:setup_started",
|
|
29
|
-
TwoFactorEnabled = "2fa:enabled",
|
|
30
|
-
TwoFactorDisabled = "2fa:disabled",
|
|
31
|
-
TwoFactorVerified = "2fa:verified",
|
|
32
|
-
TwoFactorRecoveryUsed = "2fa:recovery_used",
|
|
33
|
-
TwoFactorRecoveryCodesLow = "2fa:recovery_low",
|
|
34
|
-
TwoFactorRecoveryCodesExhausted = "2fa:recovery_exhausted",
|
|
35
|
-
TwoFactorSetupMagicLinkValidated = "2fa:magic_link_validated",
|
|
36
|
-
TwoFactorSetupMagicLinkFailed = "2fa:magic_link_failed",
|
|
37
|
-
TwoFactorChallengeReceived = "two_factor_challenge_received",
|
|
38
|
-
TwoFactorMethodSwitched = "two_factor_method_switched",
|
|
39
|
-
TwoFactorDeviceTrusted = "two_factor_device_trusted"
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Error payload interface for structured error information
|
|
43
|
-
*/
|
|
44
|
-
export interface ErrorPayload {
|
|
45
|
-
message: string;
|
|
46
|
-
code?: string | number;
|
|
47
|
-
details?: unknown;
|
|
48
|
-
originalError?: unknown;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Event-specific payload types
|
|
52
|
-
*/
|
|
53
|
-
export type PassflowEventPayload = {
|
|
54
|
-
[PassflowEvent.SignIn]: {
|
|
55
|
-
tokens?: Tokens;
|
|
56
|
-
parsedTokens?: ParsedTokens;
|
|
57
|
-
};
|
|
58
|
-
[PassflowEvent.SignInStart]: {
|
|
59
|
-
email?: string;
|
|
60
|
-
provider?: string;
|
|
61
|
-
};
|
|
62
|
-
[PassflowEvent.Register]: {
|
|
63
|
-
tokens?: Tokens;
|
|
64
|
-
parsedTokens?: ParsedTokens;
|
|
65
|
-
};
|
|
66
|
-
[PassflowEvent.RegisterStart]: {
|
|
67
|
-
email?: string;
|
|
68
|
-
};
|
|
69
|
-
[PassflowEvent.SignOut]: {
|
|
70
|
-
userId?: string;
|
|
71
|
-
};
|
|
72
|
-
[PassflowEvent.SessionRestored]: {
|
|
73
|
-
id: string;
|
|
74
|
-
email?: string;
|
|
75
|
-
username?: string;
|
|
76
|
-
[key: string]: unknown;
|
|
77
|
-
};
|
|
78
|
-
[PassflowEvent.SessionExpired]: {
|
|
79
|
-
reason: 'refresh_failed' | 'token_invalid' | 'logged_out';
|
|
80
|
-
};
|
|
81
|
-
[PassflowEvent.Error]: ErrorPayload;
|
|
82
|
-
[PassflowEvent.Refresh]: {
|
|
83
|
-
tokens?: Tokens;
|
|
84
|
-
parsedTokens?: ParsedTokens;
|
|
85
|
-
};
|
|
86
|
-
[PassflowEvent.RefreshStart]: {
|
|
87
|
-
tokenId?: string;
|
|
88
|
-
};
|
|
89
|
-
[PassflowEvent.TokenCacheExpired]: {
|
|
90
|
-
isExpired: boolean;
|
|
91
|
-
};
|
|
92
|
-
[PassflowEvent.TwoFactorRequired]: {
|
|
93
|
-
email: string;
|
|
94
|
-
challengeId: string;
|
|
95
|
-
tfaToken: string;
|
|
96
|
-
};
|
|
97
|
-
[PassflowEvent.TwoFactorSetupStarted]: {
|
|
98
|
-
secret: string;
|
|
99
|
-
method?: TwoFactorMethod;
|
|
100
|
-
};
|
|
101
|
-
[PassflowEvent.TwoFactorEnabled]: {
|
|
102
|
-
recoveryCodes: string[];
|
|
103
|
-
clearRecoveryCodes: () => void;
|
|
104
|
-
};
|
|
105
|
-
[PassflowEvent.TwoFactorDisabled]: Record<string, never>;
|
|
106
|
-
[PassflowEvent.TwoFactorVerified]: {
|
|
107
|
-
tokens?: Tokens;
|
|
108
|
-
};
|
|
109
|
-
[PassflowEvent.TwoFactorRecoveryUsed]: {
|
|
110
|
-
tokens?: Tokens;
|
|
111
|
-
remainingCodes: number;
|
|
112
|
-
};
|
|
113
|
-
[PassflowEvent.TwoFactorRecoveryCodesLow]: {
|
|
114
|
-
tokens?: Tokens;
|
|
115
|
-
remainingCodes: number;
|
|
116
|
-
};
|
|
117
|
-
[PassflowEvent.TwoFactorRecoveryCodesExhausted]: {
|
|
118
|
-
tokens?: Tokens;
|
|
119
|
-
};
|
|
120
|
-
[PassflowEvent.TwoFactorSetupMagicLinkValidated]: {
|
|
121
|
-
userId: string;
|
|
122
|
-
appId?: string | null;
|
|
123
|
-
expiresIn: number;
|
|
124
|
-
sessionToken: string;
|
|
125
|
-
};
|
|
126
|
-
[PassflowEvent.TwoFactorSetupMagicLinkFailed]: {
|
|
127
|
-
error: {
|
|
128
|
-
code: 'INVALID_TOKEN' | 'EXPIRED_TOKEN' | 'REVOKED_TOKEN' | 'RATE_LIMITED' | 'SERVER_ERROR';
|
|
129
|
-
message: string;
|
|
130
|
-
retryAfter?: number;
|
|
131
|
-
};
|
|
132
|
-
};
|
|
133
|
-
[PassflowEvent.TwoFactorChallengeReceived]: {
|
|
134
|
-
challengeId: string;
|
|
135
|
-
method: TwoFactorMethod;
|
|
136
|
-
alternativeMethods: TwoFactorMethod[];
|
|
137
|
-
};
|
|
138
|
-
[PassflowEvent.TwoFactorMethodSwitched]: {
|
|
139
|
-
challengeId: string;
|
|
140
|
-
method: TwoFactorMethod;
|
|
141
|
-
alternativeMethods: TwoFactorMethod[];
|
|
142
|
-
};
|
|
143
|
-
[PassflowEvent.TwoFactorDeviceTrusted]: Record<string, never>;
|
|
144
|
-
};
|
|
145
|
-
/**
|
|
146
|
-
* Passflow subscriber interface
|
|
147
|
-
*/
|
|
148
|
-
export interface PassflowSubscriber {
|
|
149
|
-
onAuthChange<E extends PassflowEvent>(eventType: E, payload?: PassflowEventPayload[E]): void;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Store for managing Passflow event subscriptions
|
|
153
|
-
*/
|
|
154
|
-
export declare class PassflowStore {
|
|
155
|
-
private subscribers;
|
|
156
|
-
/**
|
|
157
|
-
* Subscribe to authentication events
|
|
158
|
-
* @param subscriber The subscriber to register
|
|
159
|
-
* @param events Optional specific events to subscribe to
|
|
160
|
-
*/
|
|
161
|
-
subscribe(subscriber: PassflowSubscriber, events?: PassflowEvent[]): void;
|
|
162
|
-
/**
|
|
163
|
-
* Unsubscribe from authentication events
|
|
164
|
-
* @param subscriber The subscriber to unregister
|
|
165
|
-
* @param events Optional specific events to unsubscribe from
|
|
166
|
-
*/
|
|
167
|
-
unsubscribe(subscriber: PassflowSubscriber, events?: PassflowEvent[]): void;
|
|
168
|
-
/**
|
|
169
|
-
* Notify subscribers of an event
|
|
170
|
-
* @param eventType The type of event that occurred
|
|
171
|
-
* @param payload Event-specific payload data
|
|
172
|
-
*/
|
|
173
|
-
notify<E extends PassflowEvent>(eventType: E, payload?: PassflowEventPayload[E]): void;
|
|
174
|
-
}
|
|
175
|
-
//# sourceMappingURL=store.d.ts.map
|
package/dist/lib/store.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../lib/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAE/C;;GAEG;AACH,oBAAY,aAAa;IACvB,MAAM,WAAW;IACjB,WAAW,iBAAiB;IAC5B,QAAQ,aAAa;IACrB,aAAa,mBAAmB;IAChC,OAAO,YAAY;IACnB,eAAe,qBAAqB;IACpC,cAAc,oBAAoB;IAClC,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,YAAY,kBAAkB;IAC9B,iBAAiB,wBAAwB;IACzC,iBAAiB,iBAAiB;IAClC,qBAAqB,sBAAsB;IAC3C,gB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AO,CAAC,WAAW,CAAiE;IAEpF;;;;OAIG;IACH,SAAS,CAAC,UAAU,EAAE,kBAAkB,EAAE,MAAM,CAAC,EAAE,aAAa,EAAE,GAAG,IAAI;IASzE;;;;OAIG;IACH,WAAW,CAAC,UAAU,EAAE,kBAAkB,EAAE,MAAM,CAAC,EAAE,aAAa,EAAE,GAAG,IAAI;IAiB3E;;;;OAIG;IACH,MAAM,CAAC,CAAC,SAAS,aAAa,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,IAAI;CAOvF"}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Token Delivery Manager
|
|
3
|
-
*
|
|
4
|
-
* Manages token delivery mode state and session validity for the SDK.
|
|
5
|
-
* Supports three delivery modes: JSON body, cookie, and mobile.
|
|
6
|
-
* Persists delivery mode to storage for session continuity.
|
|
7
|
-
*
|
|
8
|
-
* @module token/delivery-manager
|
|
9
|
-
*/
|
|
10
|
-
import type { StorageManager } from '../storage';
|
|
11
|
-
export declare enum TokenDeliveryMode {
|
|
12
|
-
JsonBody = "json_body",
|
|
13
|
-
Cookie = "cookie",
|
|
14
|
-
Mobile = "mobile",
|
|
15
|
-
/**
|
|
16
|
-
* BFF (Backend-for-Frontend) mode.
|
|
17
|
-
* Tokens are sent to BFF server which stores them in httpOnly cookies.
|
|
18
|
-
* Only ID token is kept locally for user info display.
|
|
19
|
-
*/
|
|
20
|
-
BFF = "bff"
|
|
21
|
-
}
|
|
22
|
-
export declare enum SessionState {
|
|
23
|
-
Unknown = "unknown",// Initial state, not yet determined
|
|
24
|
-
Valid = "valid",// Session is valid (cookie mode trust state)
|
|
25
|
-
Invalid = "invalid"
|
|
26
|
-
}
|
|
27
|
-
export declare class TokenDeliveryManager {
|
|
28
|
-
private storageManager;
|
|
29
|
-
private mode;
|
|
30
|
-
private sessionState;
|
|
31
|
-
private isInitializedFlag;
|
|
32
|
-
private readonly STORAGE_PREFIX;
|
|
33
|
-
private readonly DELIVERY_MODE_KEY;
|
|
34
|
-
private readonly SESSION_STATE_KEY;
|
|
35
|
-
constructor(storageManager: StorageManager);
|
|
36
|
-
/**
|
|
37
|
-
* Set the token delivery mode
|
|
38
|
-
*/
|
|
39
|
-
setMode(mode: TokenDeliveryMode): void;
|
|
40
|
-
/**
|
|
41
|
-
* Get the current token delivery mode
|
|
42
|
-
*/
|
|
43
|
-
getMode(): TokenDeliveryMode;
|
|
44
|
-
/**
|
|
45
|
-
* Check if currently in cookie mode
|
|
46
|
-
*/
|
|
47
|
-
isCookieMode(): boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Check if currently in JSON body mode
|
|
50
|
-
*/
|
|
51
|
-
isJsonMode(): boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Check if currently in mobile mode
|
|
54
|
-
*/
|
|
55
|
-
isMobileMode(): boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Check if currently in BFF mode
|
|
58
|
-
*/
|
|
59
|
-
isBFFMode(): boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Check if delivery mode has been initialized from a server response
|
|
62
|
-
*/
|
|
63
|
-
isInitialized(): boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Mark session as valid (successful authentication or token refresh)
|
|
66
|
-
*/
|
|
67
|
-
setSessionValid(): void;
|
|
68
|
-
/**
|
|
69
|
-
* Mark session as invalid (received 401 or logout)
|
|
70
|
-
*/
|
|
71
|
-
setSessionInvalid(): void;
|
|
72
|
-
/**
|
|
73
|
-
* Reset session state to unknown (used during authentication flows)
|
|
74
|
-
*/
|
|
75
|
-
setSessionUnknown(): void;
|
|
76
|
-
/**
|
|
77
|
-
* Check if session is valid
|
|
78
|
-
*/
|
|
79
|
-
isSessionValid(): boolean;
|
|
80
|
-
/**
|
|
81
|
-
* Check if session state is unknown (not yet determined)
|
|
82
|
-
*/
|
|
83
|
-
isSessionUnknown(): boolean;
|
|
84
|
-
/**
|
|
85
|
-
* Check if session is invalid
|
|
86
|
-
*/
|
|
87
|
-
isSessionInvalid(): boolean;
|
|
88
|
-
/**
|
|
89
|
-
* Get current session state
|
|
90
|
-
*/
|
|
91
|
-
getSessionState(): SessionState;
|
|
92
|
-
/**
|
|
93
|
-
* Reset delivery manager to initial state
|
|
94
|
-
*/
|
|
95
|
-
reset(): void;
|
|
96
|
-
/**
|
|
97
|
-
* Load persisted delivery mode from storage
|
|
98
|
-
*/
|
|
99
|
-
private loadPersistedMode;
|
|
100
|
-
/**
|
|
101
|
-
* Load persisted session state from storage
|
|
102
|
-
*/
|
|
103
|
-
private loadPersistedSessionState;
|
|
104
|
-
/**
|
|
105
|
-
* Persist delivery mode to storage
|
|
106
|
-
*/
|
|
107
|
-
private persistMode;
|
|
108
|
-
/**
|
|
109
|
-
* Persist session state to storage
|
|
110
|
-
*/
|
|
111
|
-
private persistSessionState;
|
|
112
|
-
/**
|
|
113
|
-
* Clear persisted delivery mode from storage
|
|
114
|
-
*/
|
|
115
|
-
private clearPersistedMode;
|
|
116
|
-
/**
|
|
117
|
-
* Clear persisted session state from storage
|
|
118
|
-
*/
|
|
119
|
-
private clearPersistedSessionState;
|
|
120
|
-
}
|
|
121
|
-
//# sourceMappingURL=delivery-manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"delivery-manager.d.ts","sourceRoot":"","sources":["../../../lib/token/delivery-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,oBAAY,iBAAiB;IAC3B,QAAQ,cAAc;IACtB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB;;;;OAIG;IACH,GAAG,QAAQ;CACZ;AAED,oBAAY,YAAY;IACtB,OAAO,YAAY,CAAE,oCAAoC;IACzD,KAAK,UAAU,CAAE,6CAA6C;IAC9D,OAAO,YAAY;CACpB;AAED,qBAAa,oBAAoB;IASnB,OAAO,CAAC,cA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AAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export type Tenant = {
|
|
2
|
-
id: string;
|
|
3
|
-
name: string;
|
|
4
|
-
};
|
|
5
|
-
export type TenantMembership = {
|
|
6
|
-
tenant: Tenant;
|
|
7
|
-
tenantRoles?: GroupMembership;
|
|
8
|
-
groups?: GroupMembership[];
|
|
9
|
-
};
|
|
10
|
-
export type Group = {
|
|
11
|
-
id: string;
|
|
12
|
-
name: string;
|
|
13
|
-
};
|
|
14
|
-
export type GroupMembership = {
|
|
15
|
-
group: Group;
|
|
16
|
-
roles: string[];
|
|
17
|
-
};
|
|
18
|
-
export type RawUserMembership = {
|
|
19
|
-
[key: string]: {
|
|
20
|
-
tenant_id: string;
|
|
21
|
-
tenant_name: string;
|
|
22
|
-
tenant_roles?: string[];
|
|
23
|
-
root_group_id: string;
|
|
24
|
-
groups: {
|
|
25
|
-
[key: string]: string[];
|
|
26
|
-
};
|
|
27
|
-
group_names: {
|
|
28
|
-
[key: string]: string;
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
export type UserMembership = {
|
|
33
|
-
raw: RawUserMembership;
|
|
34
|
-
tenants: TenantMembership[];
|
|
35
|
-
};
|
|
36
|
-
export declare const parseMembership: (raw: RawUserMembership) => UserMembership;
|
|
37
|
-
//# sourceMappingURL=membership.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"membership.d.ts","sourceRoot":"","sources":["../../../lib/token/membership.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;QACxB,aAAa,EAAE,MAAM,CAAC;QACtB,MAAM,EAAE;YACN,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;SACzB,CAAC;QACF,WAAW,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAC;KACxC,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,iBAAiB,CAAC;IACvB,OAAO,EAAE,gBAAgB,EAAE,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,KAAK,iBAAiB,KAAG,cAmBxD,CAAC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Token Service
|
|
3
|
-
*
|
|
4
|
-
* JWT token parsing, validation, and utility functions.
|
|
5
|
-
* Provides platform-agnostic Base64 decoding for SSR/Node.js support.
|
|
6
|
-
* Handles token expiry calculations with configurable buffer time.
|
|
7
|
-
*
|
|
8
|
-
* @module token
|
|
9
|
-
*/
|
|
10
|
-
import { StorageManager } from '../storage';
|
|
11
|
-
import { Token, TokenType } from './token';
|
|
12
|
-
export declare class TokenService {
|
|
13
|
-
protected storageManager: StorageManager;
|
|
14
|
-
constructor(storageManager: StorageManager);
|
|
15
|
-
/**
|
|
16
|
-
* Checks if a token is not exists or expired.
|
|
17
|
-
*
|
|
18
|
-
* @param {TokenType} ttype - The token type to check.
|
|
19
|
-
* @returns {boolean} Returns true if the token is expired or not exists, false otherwise.
|
|
20
|
-
*/
|
|
21
|
-
isTokenTypeExpired(ttype: TokenType): boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Parse token from storage by type.
|
|
24
|
-
* Please be aware that this method does not check if the token signature and if the token is valid.
|
|
25
|
-
*
|
|
26
|
-
* @param {TokenType} tokenType - The token type to check.
|
|
27
|
-
* @returns {Token | undefined} Returns token with parsed user membership or undefined.
|
|
28
|
-
*/
|
|
29
|
-
parseTokenType(tokenType: TokenType): Token | undefined;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Checks if a token is expired.
|
|
33
|
-
*
|
|
34
|
-
* @param {Token} token - The token to check.
|
|
35
|
-
* @param {number} bufferSeconds - Time buffer in seconds to consider token expired early
|
|
36
|
-
* This prevents race conditions where token expires during request
|
|
37
|
-
* @returns {boolean} Returns true if the token is expired or will expire within buffer time, false otherwise.
|
|
38
|
-
*/
|
|
39
|
-
export declare function isTokenExpired(token: Token, bufferSeconds?: number): boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Parse token from string. Please be aware that this method does not check if the token signature and if the token is valid.
|
|
42
|
-
*
|
|
43
|
-
* @param {string} tokenString - The token string representation.
|
|
44
|
-
* @returns {Token } Returns token with parsed user membership or undefined.
|
|
45
|
-
*/
|
|
46
|
-
export declare function parseToken(tokenString: string): Token;
|
|
47
|
-
//# sourceMappingURL=service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../lib/token/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAG5C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAuB3C,qBAAa,YAAY;IACvB,SAAS,CAAC,cAAc,EAAE,cAAc,CAAC;gBAE7B,cAAc,EAAE,cAAc;IAI1C;;;;;OAKG;IACH,kBAAkB,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO;IAQ7C;;;;;;OAMG;IACH,cAAc,CAAC,SAAS,EAAE,SAAS,GAAG,KAAK,GAAG,SAAS;CAKxD;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,aAAa,SAA8B,GAAG,OAAO,CAGjG;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,KAAK,CAwBrD"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { RawUserMembership, UserMembership } from './membership';
|
|
2
|
-
export type Token = {
|
|
3
|
-
aud: string[];
|
|
4
|
-
exp: number;
|
|
5
|
-
iat: number;
|
|
6
|
-
iss: string;
|
|
7
|
-
jti: string;
|
|
8
|
-
sub: string;
|
|
9
|
-
type: string;
|
|
10
|
-
email?: string;
|
|
11
|
-
phonenumber?: string;
|
|
12
|
-
passflow_tm?: RawUserMembership;
|
|
13
|
-
payload?: unknown;
|
|
14
|
-
membership?: UserMembership;
|
|
15
|
-
};
|
|
16
|
-
export type InvitationToken = Token & {
|
|
17
|
-
email: string;
|
|
18
|
-
inviter_id: string;
|
|
19
|
-
inviter_name: string;
|
|
20
|
-
redirect_url: string;
|
|
21
|
-
tenant_name: string;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Token types used in the Passflow SDK.
|
|
25
|
-
*
|
|
26
|
-
* Note: Some enum values intentionally differ from keys for API compatibility.
|
|
27
|
-
* The values match what the Passflow API returns in token payloads.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* // access_token key maps to 'access' value (API response format)
|
|
31
|
-
* TokenType.access_token === 'access' // true
|
|
32
|
-
*/
|
|
33
|
-
export declare enum TokenType {
|
|
34
|
-
/** ID token - contains user identity claims */
|
|
35
|
-
id_token = "id_token",
|
|
36
|
-
/** Access token - for API authorization. Maps to 'access' in API responses */
|
|
37
|
-
access_token = "access",
|
|
38
|
-
/** Refresh token - for obtaining new access tokens. Maps to 'refresh' in API responses */
|
|
39
|
-
refresh_token = "refresh",
|
|
40
|
-
/** Invitation token - for accepting user invitations */
|
|
41
|
-
invite_token = "invite",
|
|
42
|
-
/** Password reset token - for password reset flows */
|
|
43
|
-
reset_token = "reset",
|
|
44
|
-
/** Web cookie token - for web-based session management */
|
|
45
|
-
web_cookie = "web-cookie",
|
|
46
|
-
/** Management token - for administrative operations */
|
|
47
|
-
management = "management",
|
|
48
|
-
/** Sign-in token - for authentication flows */
|
|
49
|
-
signin = "signin",
|
|
50
|
-
/** Actor token - for impersonation and delegated access */
|
|
51
|
-
actor = "actor",
|
|
52
|
-
/** Two-factor authentication challenge token - for 2FA flows */
|
|
53
|
-
two_factor = "2fa"
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=token.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../lib/token/token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEjE,MAAM,MAAM,KAAK,GAAG;IAClB,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,cAAc,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;;;;;GASG;AACH,oBAAY,SAAS;IACnB,+CAA+C;IAC/C,QAAQ,aAAa;IACrB,8EAA8E;IAC9E,YAAY,WAAW;IACvB,0FAA0F;IAC1F,aAAa,YAAY;IACzB,wDAAwD;IACxD,YAAY,WAAW;IACvB,sDAAsD;IACtD,WAAW,UAAU;IACrB,0DAA0D;IAC1D,UAAU,eAAe;IACzB,uDAAuD;IACvD,UAAU,eAAe;IACzB,+CAA+C;IAC/C,MAAM,WAAW;IACjB,2DAA2D;IAC3D,KAAK,UAAU;IACf,gEAAgE;IAChE,UAAU,QAAQ;CACnB"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Token } from '../token';
|
|
2
|
-
import { SessionState, TokenDeliveryMode } from '../token/delivery-manager';
|
|
3
|
-
export type Tokens = {
|
|
4
|
-
access_token?: string;
|
|
5
|
-
id_token?: string;
|
|
6
|
-
refresh_token?: string;
|
|
7
|
-
scopes?: string[];
|
|
8
|
-
};
|
|
9
|
-
export type ParsedTokens = {
|
|
10
|
-
access_token?: Token;
|
|
11
|
-
id_token?: Token;
|
|
12
|
-
refresh_token?: Token;
|
|
13
|
-
scopes?: string[];
|
|
14
|
-
};
|
|
15
|
-
export type SessionParams = {
|
|
16
|
-
createSession?: ({ tokens, parsedTokens }: {
|
|
17
|
-
tokens?: Tokens;
|
|
18
|
-
parsedTokens?: ParsedTokens;
|
|
19
|
-
}) => Promise<void>;
|
|
20
|
-
expiredSession?: () => Promise<void>;
|
|
21
|
-
doRefresh?: boolean;
|
|
22
|
-
};
|
|
23
|
-
export { TokenDeliveryMode, SessionState };
|
|
24
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE5E,MAAM,MAAM,MAAM,GAAG;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,aAAa,CAAC,EAAE,KAAK,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,aAAa,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,YAAY,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9G,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAGF,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,CAAC"}
|