@djangocfg/api 2.1.481 → 2.1.483
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/README.md +1 -1
- package/dist/auth.cjs +64 -25
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +14 -1
- package/dist/auth.d.ts +14 -1
- package/dist/auth.mjs +64 -25
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +29 -8
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +22 -2
- package/dist/clients.d.ts +22 -2
- package/dist/clients.mjs +29 -8
- package/dist/clients.mjs.map +1 -1
- package/dist/hooks.cjs +29 -8
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.mjs +29 -8
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.cjs +31 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -4
- package/dist/index.d.ts +32 -4
- package/dist/index.mjs +31 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/_api/generated/_cfg_accounts/api.ts +3 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpConsentPolicyRetrieve.ts +2 -2
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpRequestCreate.ts +2 -2
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpVerifyCreate.ts +2 -2
- package/src/_api/generated/_cfg_accounts/index.ts +1 -1
- package/src/_api/generated/_cfg_accounts/openapi.json +21 -43
- package/src/_api/generated/_cfg_accounts/schemas/OAuthCallbackRequestRequest.ts +1 -0
- package/src/_api/generated/_cfg_accounts/schemas/OAuthTokenResponse.ts +1 -0
- package/src/_api/generated/_cfg_accounts/schemas/OTPVerifyRequest.ts +1 -0
- package/src/_api/generated/_cfg_accounts/schemas/OTPVerifyResponse.ts +1 -0
- package/src/_api/generated/_cfg_totp/openapi.json +5 -0
- package/src/_api/generated/_cfg_totp/schemas/VerifyResponse.ts +1 -0
- package/src/_api/generated/helpers/auth.ts +27 -6
- package/src/_api/generated/index.ts +1 -1
- package/src/_api/generated/openapi.json +26 -43
- package/src/_api/generated/sdk.gen.ts +1 -1
- package/src/_api/generated/types.gen.ts +28 -0
- package/src/auth/context/AccountsContext.tsx +1 -0
- package/src/auth/context/AuthContext.tsx +3 -2
- package/src/auth/context/types.ts +1 -1
- package/src/auth/hooks/useAuthForm.ts +3 -2
- package/src/auth/hooks/useAuthFormState.ts +3 -0
- package/src/auth/hooks/useAuthRedirect.ts +2 -2
- package/src/auth/hooks/useGithubAuth.ts +34 -21
- package/src/auth/hooks/useTwoFactorVerify.ts +5 -3
- package/src/auth/types/form.ts +3 -1
- package/src/index.ts +5 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ConsolaInstance } from 'consola';
|
|
2
2
|
import { ZodError } from 'zod';
|
|
3
3
|
|
|
4
|
-
type StorageMode = 'localStorage' | 'cookie';
|
|
4
|
+
type StorageMode = 'localStorage' | 'sessionStorage' | 'cookie';
|
|
5
5
|
/**
|
|
6
6
|
* User-supplied refresh handler. Receives the current refresh token,
|
|
7
7
|
* must return a fresh access (and optional refresh) pair or null on failure.
|
|
@@ -850,6 +850,10 @@ type OAuthCallbackRequestRequest = {
|
|
|
850
850
|
* Same redirect_uri used in authorize request. If not provided, uses config's site_url + callback_path
|
|
851
851
|
*/
|
|
852
852
|
redirect_uri?: string;
|
|
853
|
+
/**
|
|
854
|
+
* Keep this browser signed in for 30 days
|
|
855
|
+
*/
|
|
856
|
+
remember_me?: boolean;
|
|
853
857
|
};
|
|
854
858
|
/**
|
|
855
859
|
* Serializer for OAuth connection info (user-facing).
|
|
@@ -973,6 +977,10 @@ type OAuthTokenResponse = {
|
|
|
973
977
|
* True if user should be prompted to enable 2FA
|
|
974
978
|
*/
|
|
975
979
|
should_prompt_2fa?: boolean;
|
|
980
|
+
/**
|
|
981
|
+
* Whether this login should persist across browser restarts
|
|
982
|
+
*/
|
|
983
|
+
persistent_session?: boolean;
|
|
976
984
|
};
|
|
977
985
|
/**
|
|
978
986
|
* Typed error response for OTP operations.
|
|
@@ -1048,6 +1056,10 @@ type OtpVerifyRequest = {
|
|
|
1048
1056
|
* Source URL for tracking login (e.g., https://my.djangocfg.com)
|
|
1049
1057
|
*/
|
|
1050
1058
|
source_url?: string;
|
|
1059
|
+
/**
|
|
1060
|
+
* Keep this browser signed in for 30 days
|
|
1061
|
+
*/
|
|
1062
|
+
remember_me?: boolean;
|
|
1051
1063
|
};
|
|
1052
1064
|
/**
|
|
1053
1065
|
* OTP verification response.
|
|
@@ -1087,6 +1099,10 @@ type OtpVerifyResponse = {
|
|
|
1087
1099
|
* Whether user should be prompted to enable 2FA
|
|
1088
1100
|
*/
|
|
1089
1101
|
should_prompt_2fa?: boolean;
|
|
1102
|
+
/**
|
|
1103
|
+
* Whether this login should persist across browser restarts
|
|
1104
|
+
*/
|
|
1105
|
+
persistent_session?: boolean;
|
|
1090
1106
|
};
|
|
1091
1107
|
/**
|
|
1092
1108
|
* Serializer for updating user profile.
|
|
@@ -1277,6 +1293,10 @@ type VerifyResponse = {
|
|
|
1277
1293
|
* User profile data
|
|
1278
1294
|
*/
|
|
1279
1295
|
user: TotpVerifyUser;
|
|
1296
|
+
/**
|
|
1297
|
+
* Whether this login should persist across browser restarts
|
|
1298
|
+
*/
|
|
1299
|
+
persistent_session: boolean;
|
|
1280
1300
|
/**
|
|
1281
1301
|
* Number of remaining backup codes (if backup code was used)
|
|
1282
1302
|
*/
|
|
@@ -1462,6 +1482,10 @@ type OtpVerifyResponseWritable = {
|
|
|
1462
1482
|
* Whether user should be prompted to enable 2FA
|
|
1463
1483
|
*/
|
|
1464
1484
|
should_prompt_2fa?: boolean;
|
|
1485
|
+
/**
|
|
1486
|
+
* Whether this login should persist across browser restarts
|
|
1487
|
+
*/
|
|
1488
|
+
persistent_session?: boolean;
|
|
1465
1489
|
};
|
|
1466
1490
|
type TokenRefreshWritable = {
|
|
1467
1491
|
refresh: string;
|
|
@@ -1507,6 +1531,10 @@ type VerifyResponseWritable = {
|
|
|
1507
1531
|
* User profile data
|
|
1508
1532
|
*/
|
|
1509
1533
|
user: TotpVerifyUserWritable;
|
|
1534
|
+
/**
|
|
1535
|
+
* Whether this login should persist across browser restarts
|
|
1536
|
+
*/
|
|
1537
|
+
persistent_session: boolean;
|
|
1510
1538
|
/**
|
|
1511
1539
|
* Number of remaining backup codes (if backup code was used)
|
|
1512
1540
|
*/
|
|
@@ -2068,7 +2096,7 @@ declare class CfgAccountsOauth {
|
|
|
2068
2096
|
*/
|
|
2069
2097
|
static cfgAccountsOauthProvidersRetrieve<ThrowOnError extends boolean = false>(options?: Options<CfgAccountsOauthProvidersRetrieveData, ThrowOnError>): RequestResult<CfgAccountsOauthProvidersRetrieveResponses, unknown, ThrowOnError>;
|
|
2070
2098
|
}
|
|
2071
|
-
declare class
|
|
2099
|
+
declare class CfgAccountsOtp {
|
|
2072
2100
|
/**
|
|
2073
2101
|
* Marketing-consent checkbox policy for the caller's jurisdiction.
|
|
2074
2102
|
*
|
|
@@ -2259,7 +2287,7 @@ declare class API$2 {
|
|
|
2259
2287
|
readonly logger: APILogger;
|
|
2260
2288
|
readonly cfgAccountsApiKey: typeof CfgAccountsApiKey;
|
|
2261
2289
|
readonly cfgAccountsOauth: typeof CfgAccountsOauth;
|
|
2262
|
-
readonly
|
|
2290
|
+
readonly cfgAccountsOtp: typeof CfgAccountsOtp;
|
|
2263
2291
|
readonly cfgAccountsProfile: typeof CfgAccountsProfile;
|
|
2264
2292
|
readonly cfgAccountsAuth: typeof CfgAccountsAuth;
|
|
2265
2293
|
constructor(_baseUrl?: string, opts?: APIOptions$2);
|
|
@@ -3090,4 +3118,4 @@ declare const isStaticBuild: boolean;
|
|
|
3090
3118
|
*/
|
|
3091
3119
|
declare const dpopEnabled: boolean;
|
|
3092
3120
|
|
|
3093
|
-
export { APIError, APILogger, type AccountDeleteResponse, types_gen$2 as AccountsTypes, type ApiKey, type ApiKeyRegenerate, type ApiKeyRequest, type ApiKeyReveal, type ApiKeyTestRequest, type ApiKeyTestResult, type Auth$1 as Auth, type BackupCodesRegenerateRequest, type BackupCodesRegenerateResponse, type BackupCodesStatus, type CentrifugoToken, types_gen as CentrifugoTypes, CfgAccounts, API$2 as CfgAccountsAPI, CfgAccountsApi, CfgAccountsApiKey, type CfgAccountsApiKeyRegenerateCreateData, type CfgAccountsApiKeyRegenerateCreateErrors, type CfgAccountsApiKeyRegenerateCreateResponse, type CfgAccountsApiKeyRegenerateCreateResponses, type CfgAccountsApiKeyRetrieveData, type CfgAccountsApiKeyRetrieveErrors, type CfgAccountsApiKeyRetrieveResponse, type CfgAccountsApiKeyRetrieveResponses, type CfgAccountsApiKeyRevealCreateData, type CfgAccountsApiKeyRevealCreateErrors, type CfgAccountsApiKeyRevealCreateResponse, type CfgAccountsApiKeyRevealCreateResponses, type CfgAccountsApiKeyTestCreateData, type CfgAccountsApiKeyTestCreateResponse, type CfgAccountsApiKeyTestCreateResponses, CfgAccountsAuth, CfgAccountsOauth, type CfgAccountsOauthConnectionsListData, type CfgAccountsOauthConnectionsListResponse, type CfgAccountsOauthConnectionsListResponses, type CfgAccountsOauthConnectionsResponse200AutoRef, type CfgAccountsOauthDisconnectCreateData, type CfgAccountsOauthDisconnectCreateError, type CfgAccountsOauthDisconnectCreateErrors, type CfgAccountsOauthDisconnectCreateResponse, type CfgAccountsOauthDisconnectCreateResponses, type CfgAccountsOauthDisconnectResponse200AutoRef, type CfgAccountsOauthGithubAuthorizeCreateData, type CfgAccountsOauthGithubAuthorizeCreateError, type CfgAccountsOauthGithubAuthorizeCreateErrors, type CfgAccountsOauthGithubAuthorizeCreateResponse, type CfgAccountsOauthGithubAuthorizeCreateResponses, type CfgAccountsOauthGithubCallbackCreateData, type CfgAccountsOauthGithubCallbackCreateError, type CfgAccountsOauthGithubCallbackCreateErrors, type CfgAccountsOauthGithubCallbackCreateResponse, type CfgAccountsOauthGithubCallbackCreateResponses, type CfgAccountsOauthProvidersRetrieveData, type CfgAccountsOauthProvidersRetrieveResponse, type CfgAccountsOauthProvidersRetrieveResponses, type CfgAccountsOtpConsentPolicyRetrieveData, type CfgAccountsOtpConsentPolicyRetrieveResponse, type CfgAccountsOtpConsentPolicyRetrieveResponses, type CfgAccountsOtpRequestCreateData, type CfgAccountsOtpRequestCreateError, type CfgAccountsOtpRequestCreateErrors, type CfgAccountsOtpRequestCreateResponse, type CfgAccountsOtpRequestCreateResponses, type CfgAccountsOtpVerifyCreateData, type CfgAccountsOtpVerifyCreateError, type CfgAccountsOtpVerifyCreateErrors, type CfgAccountsOtpVerifyCreateResponse, type CfgAccountsOtpVerifyCreateResponses, CfgAccountsProfile, type CfgAccountsProfileAvatarCreateData, type CfgAccountsProfileAvatarCreateErrors, type CfgAccountsProfileAvatarCreateResponse, type CfgAccountsProfileAvatarCreateResponses, type CfgAccountsProfileDeleteCreateData, type CfgAccountsProfileDeleteCreateErrors, type CfgAccountsProfileDeleteCreateResponse, type CfgAccountsProfileDeleteCreateResponses, type CfgAccountsProfilePartialPartialUpdateData, type CfgAccountsProfilePartialPartialUpdateErrors, type CfgAccountsProfilePartialPartialUpdateResponse, type CfgAccountsProfilePartialPartialUpdateResponses, type CfgAccountsProfilePartialUpdateData, type CfgAccountsProfilePartialUpdateErrors, type CfgAccountsProfilePartialUpdateResponse, type CfgAccountsProfilePartialUpdateResponses, type CfgAccountsProfileRetrieveData, type CfgAccountsProfileRetrieveErrors, type CfgAccountsProfileRetrieveResponse, type CfgAccountsProfileRetrieveResponses, type CfgAccountsProfileUpdatePartialUpdateData, type CfgAccountsProfileUpdatePartialUpdateErrors, type CfgAccountsProfileUpdatePartialUpdateResponse, type CfgAccountsProfileUpdatePartialUpdateResponses, type CfgAccountsProfileUpdateUpdateData, type CfgAccountsProfileUpdateUpdateErrors, type CfgAccountsProfileUpdateUpdateResponse, type CfgAccountsProfileUpdateUpdateResponses, type CfgAccountsTokenBlacklistCreateData, type CfgAccountsTokenBlacklistCreateResponses, type CfgAccountsTokenRefreshCreateData, type CfgAccountsTokenRefreshCreateResponse, type CfgAccountsTokenRefreshCreateResponses, CfgCentrifugo, API$1 as CfgCentrifugoAPI, CfgCentrifugoApi, type CfgCentrifugoAuthTokenRetrieveData, type CfgCentrifugoAuthTokenRetrieveErrors, type CfgCentrifugoAuthTokenRetrieveResponse, type CfgCentrifugoAuthTokenRetrieveResponses, CfgTotp, API as CfgTotpAPI, CfgTotpApi, CfgTotpBackupCodes, type CfgTotpBackupCodesRegenerateCreateData, type CfgTotpBackupCodesRegenerateCreateErrors, type CfgTotpBackupCodesRegenerateCreateResponse, type CfgTotpBackupCodesRegenerateCreateResponses, type CfgTotpBackupCodesRetrieveData, type CfgTotpBackupCodesRetrieveResponse, type CfgTotpBackupCodesRetrieveResponses, type CfgTotpDevicesDestroyData, type CfgTotpDevicesDestroyResponse, type CfgTotpDevicesDestroyResponses, type CfgTotpDevicesRetrieveData, type CfgTotpDevicesRetrieveResponse, type CfgTotpDevicesRetrieveResponses, type CfgTotpDisableCreateData, type CfgTotpDisableCreateErrors, type CfgTotpDisableCreateResponse, type CfgTotpDisableCreateResponses, type CfgTotpDisableResponse200AutoRef, CfgTotpSetup, type CfgTotpSetupConfirmCreateData, type CfgTotpSetupConfirmCreateErrors, type CfgTotpSetupConfirmCreateResponse, type CfgTotpSetupConfirmCreateResponses, type CfgTotpSetupCreateData, type CfgTotpSetupCreateErrors, type CfgTotpSetupCreateResponse, type CfgTotpSetupCreateResponses, CfgTotpVerify, type CfgTotpVerifyBackupCreateData, type CfgTotpVerifyBackupCreateErrors, type CfgTotpVerifyBackupCreateResponse, type CfgTotpVerifyBackupCreateResponses, type CfgTotpVerifyCreateData, type CfgTotpVerifyCreateErrors, type CfgTotpVerifyCreateResponse, type CfgTotpVerifyCreateResponses, type CfgUserUpdateRequest, type ClientOptions, type ConfirmSetupRequest, type ConfirmSetupResponse, type ConnectionTokenResponse, type ConsentPolicy, type ConsolaLevel, CookieStorageAdapter, type DeviceList, type DeviceListResponse, type DeviceListResponseWritable, DeviceStatusEnum, type DisableRequest, type ErrorLog, LocalStorageAdapter, type LoggerConfig, MarketingConsentDefaultEnum, MemoryStorageAdapter, NetworkError, type OAuthAuthorizeRequestRequest, type OAuthAuthorizeResponse, type OAuthCallbackRequestRequest, type OAuthConnection, type OAuthDisconnectRequestRequest, type OAuthError, OAuthProviderEnum, type OAuthProvidersResponse, type OAuthTokenResponse, type OtpErrorResponse, type OtpRequestRequest, type OtpRequestResponse, type OtpVerifyRequest, type OtpVerifyResponse, type OtpVerifyResponseWritable, type PatchedCfgUserUpdateRequest, type RequestLog, type ResponseLog, type SetupRequest, type SetupResponse, type StorageAdapter, type TokenBlacklistRequest, type TokenRefresh, type TokenRefreshRequest, type TokenRefreshWritable, types_gen$1 as TotpTypes, type TotpVerifyUser, type TotpVerifyUserWritable, type User, type UserWritable, type ValidationErrorDetail, type ValidationErrorEvent, type VerifyBackupRequest, type VerifyRequest, type VerifyResponse, type VerifyResponseWritable, type WebmailLink, WebmailLinkProviderEnum, CfgAccountsApi as api, applyRoleLogPolicy, auth, defaultLogger, dispatchValidationError, dpopEnabled, formatZodError, getLogLevel, isBrowser, isDev, isProd, isStaticBuild, onLogLevelChange, onValidationError, setLogLevel };
|
|
3121
|
+
export { APIError, APILogger, type AccountDeleteResponse, types_gen$2 as AccountsTypes, type ApiKey, type ApiKeyRegenerate, type ApiKeyRequest, type ApiKeyReveal, type ApiKeyTestRequest, type ApiKeyTestResult, type Auth$1 as Auth, type BackupCodesRegenerateRequest, type BackupCodesRegenerateResponse, type BackupCodesStatus, type CentrifugoToken, types_gen as CentrifugoTypes, CfgAccountsOtp as CfgAccounts, API$2 as CfgAccountsAPI, CfgAccountsApi, CfgAccountsApiKey, type CfgAccountsApiKeyRegenerateCreateData, type CfgAccountsApiKeyRegenerateCreateErrors, type CfgAccountsApiKeyRegenerateCreateResponse, type CfgAccountsApiKeyRegenerateCreateResponses, type CfgAccountsApiKeyRetrieveData, type CfgAccountsApiKeyRetrieveErrors, type CfgAccountsApiKeyRetrieveResponse, type CfgAccountsApiKeyRetrieveResponses, type CfgAccountsApiKeyRevealCreateData, type CfgAccountsApiKeyRevealCreateErrors, type CfgAccountsApiKeyRevealCreateResponse, type CfgAccountsApiKeyRevealCreateResponses, type CfgAccountsApiKeyTestCreateData, type CfgAccountsApiKeyTestCreateResponse, type CfgAccountsApiKeyTestCreateResponses, CfgAccountsAuth, CfgAccountsOauth, type CfgAccountsOauthConnectionsListData, type CfgAccountsOauthConnectionsListResponse, type CfgAccountsOauthConnectionsListResponses, type CfgAccountsOauthConnectionsResponse200AutoRef, type CfgAccountsOauthDisconnectCreateData, type CfgAccountsOauthDisconnectCreateError, type CfgAccountsOauthDisconnectCreateErrors, type CfgAccountsOauthDisconnectCreateResponse, type CfgAccountsOauthDisconnectCreateResponses, type CfgAccountsOauthDisconnectResponse200AutoRef, type CfgAccountsOauthGithubAuthorizeCreateData, type CfgAccountsOauthGithubAuthorizeCreateError, type CfgAccountsOauthGithubAuthorizeCreateErrors, type CfgAccountsOauthGithubAuthorizeCreateResponse, type CfgAccountsOauthGithubAuthorizeCreateResponses, type CfgAccountsOauthGithubCallbackCreateData, type CfgAccountsOauthGithubCallbackCreateError, type CfgAccountsOauthGithubCallbackCreateErrors, type CfgAccountsOauthGithubCallbackCreateResponse, type CfgAccountsOauthGithubCallbackCreateResponses, type CfgAccountsOauthProvidersRetrieveData, type CfgAccountsOauthProvidersRetrieveResponse, type CfgAccountsOauthProvidersRetrieveResponses, CfgAccountsOtp, type CfgAccountsOtpConsentPolicyRetrieveData, type CfgAccountsOtpConsentPolicyRetrieveResponse, type CfgAccountsOtpConsentPolicyRetrieveResponses, type CfgAccountsOtpRequestCreateData, type CfgAccountsOtpRequestCreateError, type CfgAccountsOtpRequestCreateErrors, type CfgAccountsOtpRequestCreateResponse, type CfgAccountsOtpRequestCreateResponses, type CfgAccountsOtpVerifyCreateData, type CfgAccountsOtpVerifyCreateError, type CfgAccountsOtpVerifyCreateErrors, type CfgAccountsOtpVerifyCreateResponse, type CfgAccountsOtpVerifyCreateResponses, CfgAccountsProfile, type CfgAccountsProfileAvatarCreateData, type CfgAccountsProfileAvatarCreateErrors, type CfgAccountsProfileAvatarCreateResponse, type CfgAccountsProfileAvatarCreateResponses, type CfgAccountsProfileDeleteCreateData, type CfgAccountsProfileDeleteCreateErrors, type CfgAccountsProfileDeleteCreateResponse, type CfgAccountsProfileDeleteCreateResponses, type CfgAccountsProfilePartialPartialUpdateData, type CfgAccountsProfilePartialPartialUpdateErrors, type CfgAccountsProfilePartialPartialUpdateResponse, type CfgAccountsProfilePartialPartialUpdateResponses, type CfgAccountsProfilePartialUpdateData, type CfgAccountsProfilePartialUpdateErrors, type CfgAccountsProfilePartialUpdateResponse, type CfgAccountsProfilePartialUpdateResponses, type CfgAccountsProfileRetrieveData, type CfgAccountsProfileRetrieveErrors, type CfgAccountsProfileRetrieveResponse, type CfgAccountsProfileRetrieveResponses, type CfgAccountsProfileUpdatePartialUpdateData, type CfgAccountsProfileUpdatePartialUpdateErrors, type CfgAccountsProfileUpdatePartialUpdateResponse, type CfgAccountsProfileUpdatePartialUpdateResponses, type CfgAccountsProfileUpdateUpdateData, type CfgAccountsProfileUpdateUpdateErrors, type CfgAccountsProfileUpdateUpdateResponse, type CfgAccountsProfileUpdateUpdateResponses, type CfgAccountsTokenBlacklistCreateData, type CfgAccountsTokenBlacklistCreateResponses, type CfgAccountsTokenRefreshCreateData, type CfgAccountsTokenRefreshCreateResponse, type CfgAccountsTokenRefreshCreateResponses, CfgCentrifugo, API$1 as CfgCentrifugoAPI, CfgCentrifugoApi, type CfgCentrifugoAuthTokenRetrieveData, type CfgCentrifugoAuthTokenRetrieveErrors, type CfgCentrifugoAuthTokenRetrieveResponse, type CfgCentrifugoAuthTokenRetrieveResponses, CfgTotp, API as CfgTotpAPI, CfgTotpApi, CfgTotpBackupCodes, type CfgTotpBackupCodesRegenerateCreateData, type CfgTotpBackupCodesRegenerateCreateErrors, type CfgTotpBackupCodesRegenerateCreateResponse, type CfgTotpBackupCodesRegenerateCreateResponses, type CfgTotpBackupCodesRetrieveData, type CfgTotpBackupCodesRetrieveResponse, type CfgTotpBackupCodesRetrieveResponses, type CfgTotpDevicesDestroyData, type CfgTotpDevicesDestroyResponse, type CfgTotpDevicesDestroyResponses, type CfgTotpDevicesRetrieveData, type CfgTotpDevicesRetrieveResponse, type CfgTotpDevicesRetrieveResponses, type CfgTotpDisableCreateData, type CfgTotpDisableCreateErrors, type CfgTotpDisableCreateResponse, type CfgTotpDisableCreateResponses, type CfgTotpDisableResponse200AutoRef, CfgTotpSetup, type CfgTotpSetupConfirmCreateData, type CfgTotpSetupConfirmCreateErrors, type CfgTotpSetupConfirmCreateResponse, type CfgTotpSetupConfirmCreateResponses, type CfgTotpSetupCreateData, type CfgTotpSetupCreateErrors, type CfgTotpSetupCreateResponse, type CfgTotpSetupCreateResponses, CfgTotpVerify, type CfgTotpVerifyBackupCreateData, type CfgTotpVerifyBackupCreateErrors, type CfgTotpVerifyBackupCreateResponse, type CfgTotpVerifyBackupCreateResponses, type CfgTotpVerifyCreateData, type CfgTotpVerifyCreateErrors, type CfgTotpVerifyCreateResponse, type CfgTotpVerifyCreateResponses, type CfgUserUpdateRequest, type ClientOptions, type ConfirmSetupRequest, type ConfirmSetupResponse, type ConnectionTokenResponse, type ConsentPolicy, type ConsolaLevel, CookieStorageAdapter, type DeviceList, type DeviceListResponse, type DeviceListResponseWritable, DeviceStatusEnum, type DisableRequest, type ErrorLog, LocalStorageAdapter, type LoggerConfig, MarketingConsentDefaultEnum, MemoryStorageAdapter, NetworkError, type OAuthAuthorizeRequestRequest, type OAuthAuthorizeResponse, type OAuthCallbackRequestRequest, type OAuthConnection, type OAuthDisconnectRequestRequest, type OAuthError, OAuthProviderEnum, type OAuthProvidersResponse, type OAuthTokenResponse, type OtpErrorResponse, type OtpRequestRequest, type OtpRequestResponse, type OtpVerifyRequest, type OtpVerifyResponse, type OtpVerifyResponseWritable, type PatchedCfgUserUpdateRequest, type RequestLog, type ResponseLog, type SetupRequest, type SetupResponse, type StorageAdapter, type TokenBlacklistRequest, type TokenRefresh, type TokenRefreshRequest, type TokenRefreshWritable, types_gen$1 as TotpTypes, type TotpVerifyUser, type TotpVerifyUserWritable, type User, type UserWritable, type ValidationErrorDetail, type ValidationErrorEvent, type VerifyBackupRequest, type VerifyRequest, type VerifyResponse, type VerifyResponseWritable, type WebmailLink, WebmailLinkProviderEnum, CfgAccountsApi as api, applyRoleLogPolicy, auth, defaultLogger, dispatchValidationError, dpopEnabled, formatZodError, getLogLevel, isBrowser, isDev, isProd, isStaticBuild, onLogLevelChange, onValidationError, setLogLevel };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ConsolaInstance } from 'consola';
|
|
2
2
|
import { ZodError } from 'zod';
|
|
3
3
|
|
|
4
|
-
type StorageMode = 'localStorage' | 'cookie';
|
|
4
|
+
type StorageMode = 'localStorage' | 'sessionStorage' | 'cookie';
|
|
5
5
|
/**
|
|
6
6
|
* User-supplied refresh handler. Receives the current refresh token,
|
|
7
7
|
* must return a fresh access (and optional refresh) pair or null on failure.
|
|
@@ -850,6 +850,10 @@ type OAuthCallbackRequestRequest = {
|
|
|
850
850
|
* Same redirect_uri used in authorize request. If not provided, uses config's site_url + callback_path
|
|
851
851
|
*/
|
|
852
852
|
redirect_uri?: string;
|
|
853
|
+
/**
|
|
854
|
+
* Keep this browser signed in for 30 days
|
|
855
|
+
*/
|
|
856
|
+
remember_me?: boolean;
|
|
853
857
|
};
|
|
854
858
|
/**
|
|
855
859
|
* Serializer for OAuth connection info (user-facing).
|
|
@@ -973,6 +977,10 @@ type OAuthTokenResponse = {
|
|
|
973
977
|
* True if user should be prompted to enable 2FA
|
|
974
978
|
*/
|
|
975
979
|
should_prompt_2fa?: boolean;
|
|
980
|
+
/**
|
|
981
|
+
* Whether this login should persist across browser restarts
|
|
982
|
+
*/
|
|
983
|
+
persistent_session?: boolean;
|
|
976
984
|
};
|
|
977
985
|
/**
|
|
978
986
|
* Typed error response for OTP operations.
|
|
@@ -1048,6 +1056,10 @@ type OtpVerifyRequest = {
|
|
|
1048
1056
|
* Source URL for tracking login (e.g., https://my.djangocfg.com)
|
|
1049
1057
|
*/
|
|
1050
1058
|
source_url?: string;
|
|
1059
|
+
/**
|
|
1060
|
+
* Keep this browser signed in for 30 days
|
|
1061
|
+
*/
|
|
1062
|
+
remember_me?: boolean;
|
|
1051
1063
|
};
|
|
1052
1064
|
/**
|
|
1053
1065
|
* OTP verification response.
|
|
@@ -1087,6 +1099,10 @@ type OtpVerifyResponse = {
|
|
|
1087
1099
|
* Whether user should be prompted to enable 2FA
|
|
1088
1100
|
*/
|
|
1089
1101
|
should_prompt_2fa?: boolean;
|
|
1102
|
+
/**
|
|
1103
|
+
* Whether this login should persist across browser restarts
|
|
1104
|
+
*/
|
|
1105
|
+
persistent_session?: boolean;
|
|
1090
1106
|
};
|
|
1091
1107
|
/**
|
|
1092
1108
|
* Serializer for updating user profile.
|
|
@@ -1277,6 +1293,10 @@ type VerifyResponse = {
|
|
|
1277
1293
|
* User profile data
|
|
1278
1294
|
*/
|
|
1279
1295
|
user: TotpVerifyUser;
|
|
1296
|
+
/**
|
|
1297
|
+
* Whether this login should persist across browser restarts
|
|
1298
|
+
*/
|
|
1299
|
+
persistent_session: boolean;
|
|
1280
1300
|
/**
|
|
1281
1301
|
* Number of remaining backup codes (if backup code was used)
|
|
1282
1302
|
*/
|
|
@@ -1462,6 +1482,10 @@ type OtpVerifyResponseWritable = {
|
|
|
1462
1482
|
* Whether user should be prompted to enable 2FA
|
|
1463
1483
|
*/
|
|
1464
1484
|
should_prompt_2fa?: boolean;
|
|
1485
|
+
/**
|
|
1486
|
+
* Whether this login should persist across browser restarts
|
|
1487
|
+
*/
|
|
1488
|
+
persistent_session?: boolean;
|
|
1465
1489
|
};
|
|
1466
1490
|
type TokenRefreshWritable = {
|
|
1467
1491
|
refresh: string;
|
|
@@ -1507,6 +1531,10 @@ type VerifyResponseWritable = {
|
|
|
1507
1531
|
* User profile data
|
|
1508
1532
|
*/
|
|
1509
1533
|
user: TotpVerifyUserWritable;
|
|
1534
|
+
/**
|
|
1535
|
+
* Whether this login should persist across browser restarts
|
|
1536
|
+
*/
|
|
1537
|
+
persistent_session: boolean;
|
|
1510
1538
|
/**
|
|
1511
1539
|
* Number of remaining backup codes (if backup code was used)
|
|
1512
1540
|
*/
|
|
@@ -2068,7 +2096,7 @@ declare class CfgAccountsOauth {
|
|
|
2068
2096
|
*/
|
|
2069
2097
|
static cfgAccountsOauthProvidersRetrieve<ThrowOnError extends boolean = false>(options?: Options<CfgAccountsOauthProvidersRetrieveData, ThrowOnError>): RequestResult<CfgAccountsOauthProvidersRetrieveResponses, unknown, ThrowOnError>;
|
|
2070
2098
|
}
|
|
2071
|
-
declare class
|
|
2099
|
+
declare class CfgAccountsOtp {
|
|
2072
2100
|
/**
|
|
2073
2101
|
* Marketing-consent checkbox policy for the caller's jurisdiction.
|
|
2074
2102
|
*
|
|
@@ -2259,7 +2287,7 @@ declare class API$2 {
|
|
|
2259
2287
|
readonly logger: APILogger;
|
|
2260
2288
|
readonly cfgAccountsApiKey: typeof CfgAccountsApiKey;
|
|
2261
2289
|
readonly cfgAccountsOauth: typeof CfgAccountsOauth;
|
|
2262
|
-
readonly
|
|
2290
|
+
readonly cfgAccountsOtp: typeof CfgAccountsOtp;
|
|
2263
2291
|
readonly cfgAccountsProfile: typeof CfgAccountsProfile;
|
|
2264
2292
|
readonly cfgAccountsAuth: typeof CfgAccountsAuth;
|
|
2265
2293
|
constructor(_baseUrl?: string, opts?: APIOptions$2);
|
|
@@ -3090,4 +3118,4 @@ declare const isStaticBuild: boolean;
|
|
|
3090
3118
|
*/
|
|
3091
3119
|
declare const dpopEnabled: boolean;
|
|
3092
3120
|
|
|
3093
|
-
export { APIError, APILogger, type AccountDeleteResponse, types_gen$2 as AccountsTypes, type ApiKey, type ApiKeyRegenerate, type ApiKeyRequest, type ApiKeyReveal, type ApiKeyTestRequest, type ApiKeyTestResult, type Auth$1 as Auth, type BackupCodesRegenerateRequest, type BackupCodesRegenerateResponse, type BackupCodesStatus, type CentrifugoToken, types_gen as CentrifugoTypes, CfgAccounts, API$2 as CfgAccountsAPI, CfgAccountsApi, CfgAccountsApiKey, type CfgAccountsApiKeyRegenerateCreateData, type CfgAccountsApiKeyRegenerateCreateErrors, type CfgAccountsApiKeyRegenerateCreateResponse, type CfgAccountsApiKeyRegenerateCreateResponses, type CfgAccountsApiKeyRetrieveData, type CfgAccountsApiKeyRetrieveErrors, type CfgAccountsApiKeyRetrieveResponse, type CfgAccountsApiKeyRetrieveResponses, type CfgAccountsApiKeyRevealCreateData, type CfgAccountsApiKeyRevealCreateErrors, type CfgAccountsApiKeyRevealCreateResponse, type CfgAccountsApiKeyRevealCreateResponses, type CfgAccountsApiKeyTestCreateData, type CfgAccountsApiKeyTestCreateResponse, type CfgAccountsApiKeyTestCreateResponses, CfgAccountsAuth, CfgAccountsOauth, type CfgAccountsOauthConnectionsListData, type CfgAccountsOauthConnectionsListResponse, type CfgAccountsOauthConnectionsListResponses, type CfgAccountsOauthConnectionsResponse200AutoRef, type CfgAccountsOauthDisconnectCreateData, type CfgAccountsOauthDisconnectCreateError, type CfgAccountsOauthDisconnectCreateErrors, type CfgAccountsOauthDisconnectCreateResponse, type CfgAccountsOauthDisconnectCreateResponses, type CfgAccountsOauthDisconnectResponse200AutoRef, type CfgAccountsOauthGithubAuthorizeCreateData, type CfgAccountsOauthGithubAuthorizeCreateError, type CfgAccountsOauthGithubAuthorizeCreateErrors, type CfgAccountsOauthGithubAuthorizeCreateResponse, type CfgAccountsOauthGithubAuthorizeCreateResponses, type CfgAccountsOauthGithubCallbackCreateData, type CfgAccountsOauthGithubCallbackCreateError, type CfgAccountsOauthGithubCallbackCreateErrors, type CfgAccountsOauthGithubCallbackCreateResponse, type CfgAccountsOauthGithubCallbackCreateResponses, type CfgAccountsOauthProvidersRetrieveData, type CfgAccountsOauthProvidersRetrieveResponse, type CfgAccountsOauthProvidersRetrieveResponses, type CfgAccountsOtpConsentPolicyRetrieveData, type CfgAccountsOtpConsentPolicyRetrieveResponse, type CfgAccountsOtpConsentPolicyRetrieveResponses, type CfgAccountsOtpRequestCreateData, type CfgAccountsOtpRequestCreateError, type CfgAccountsOtpRequestCreateErrors, type CfgAccountsOtpRequestCreateResponse, type CfgAccountsOtpRequestCreateResponses, type CfgAccountsOtpVerifyCreateData, type CfgAccountsOtpVerifyCreateError, type CfgAccountsOtpVerifyCreateErrors, type CfgAccountsOtpVerifyCreateResponse, type CfgAccountsOtpVerifyCreateResponses, CfgAccountsProfile, type CfgAccountsProfileAvatarCreateData, type CfgAccountsProfileAvatarCreateErrors, type CfgAccountsProfileAvatarCreateResponse, type CfgAccountsProfileAvatarCreateResponses, type CfgAccountsProfileDeleteCreateData, type CfgAccountsProfileDeleteCreateErrors, type CfgAccountsProfileDeleteCreateResponse, type CfgAccountsProfileDeleteCreateResponses, type CfgAccountsProfilePartialPartialUpdateData, type CfgAccountsProfilePartialPartialUpdateErrors, type CfgAccountsProfilePartialPartialUpdateResponse, type CfgAccountsProfilePartialPartialUpdateResponses, type CfgAccountsProfilePartialUpdateData, type CfgAccountsProfilePartialUpdateErrors, type CfgAccountsProfilePartialUpdateResponse, type CfgAccountsProfilePartialUpdateResponses, type CfgAccountsProfileRetrieveData, type CfgAccountsProfileRetrieveErrors, type CfgAccountsProfileRetrieveResponse, type CfgAccountsProfileRetrieveResponses, type CfgAccountsProfileUpdatePartialUpdateData, type CfgAccountsProfileUpdatePartialUpdateErrors, type CfgAccountsProfileUpdatePartialUpdateResponse, type CfgAccountsProfileUpdatePartialUpdateResponses, type CfgAccountsProfileUpdateUpdateData, type CfgAccountsProfileUpdateUpdateErrors, type CfgAccountsProfileUpdateUpdateResponse, type CfgAccountsProfileUpdateUpdateResponses, type CfgAccountsTokenBlacklistCreateData, type CfgAccountsTokenBlacklistCreateResponses, type CfgAccountsTokenRefreshCreateData, type CfgAccountsTokenRefreshCreateResponse, type CfgAccountsTokenRefreshCreateResponses, CfgCentrifugo, API$1 as CfgCentrifugoAPI, CfgCentrifugoApi, type CfgCentrifugoAuthTokenRetrieveData, type CfgCentrifugoAuthTokenRetrieveErrors, type CfgCentrifugoAuthTokenRetrieveResponse, type CfgCentrifugoAuthTokenRetrieveResponses, CfgTotp, API as CfgTotpAPI, CfgTotpApi, CfgTotpBackupCodes, type CfgTotpBackupCodesRegenerateCreateData, type CfgTotpBackupCodesRegenerateCreateErrors, type CfgTotpBackupCodesRegenerateCreateResponse, type CfgTotpBackupCodesRegenerateCreateResponses, type CfgTotpBackupCodesRetrieveData, type CfgTotpBackupCodesRetrieveResponse, type CfgTotpBackupCodesRetrieveResponses, type CfgTotpDevicesDestroyData, type CfgTotpDevicesDestroyResponse, type CfgTotpDevicesDestroyResponses, type CfgTotpDevicesRetrieveData, type CfgTotpDevicesRetrieveResponse, type CfgTotpDevicesRetrieveResponses, type CfgTotpDisableCreateData, type CfgTotpDisableCreateErrors, type CfgTotpDisableCreateResponse, type CfgTotpDisableCreateResponses, type CfgTotpDisableResponse200AutoRef, CfgTotpSetup, type CfgTotpSetupConfirmCreateData, type CfgTotpSetupConfirmCreateErrors, type CfgTotpSetupConfirmCreateResponse, type CfgTotpSetupConfirmCreateResponses, type CfgTotpSetupCreateData, type CfgTotpSetupCreateErrors, type CfgTotpSetupCreateResponse, type CfgTotpSetupCreateResponses, CfgTotpVerify, type CfgTotpVerifyBackupCreateData, type CfgTotpVerifyBackupCreateErrors, type CfgTotpVerifyBackupCreateResponse, type CfgTotpVerifyBackupCreateResponses, type CfgTotpVerifyCreateData, type CfgTotpVerifyCreateErrors, type CfgTotpVerifyCreateResponse, type CfgTotpVerifyCreateResponses, type CfgUserUpdateRequest, type ClientOptions, type ConfirmSetupRequest, type ConfirmSetupResponse, type ConnectionTokenResponse, type ConsentPolicy, type ConsolaLevel, CookieStorageAdapter, type DeviceList, type DeviceListResponse, type DeviceListResponseWritable, DeviceStatusEnum, type DisableRequest, type ErrorLog, LocalStorageAdapter, type LoggerConfig, MarketingConsentDefaultEnum, MemoryStorageAdapter, NetworkError, type OAuthAuthorizeRequestRequest, type OAuthAuthorizeResponse, type OAuthCallbackRequestRequest, type OAuthConnection, type OAuthDisconnectRequestRequest, type OAuthError, OAuthProviderEnum, type OAuthProvidersResponse, type OAuthTokenResponse, type OtpErrorResponse, type OtpRequestRequest, type OtpRequestResponse, type OtpVerifyRequest, type OtpVerifyResponse, type OtpVerifyResponseWritable, type PatchedCfgUserUpdateRequest, type RequestLog, type ResponseLog, type SetupRequest, type SetupResponse, type StorageAdapter, type TokenBlacklistRequest, type TokenRefresh, type TokenRefreshRequest, type TokenRefreshWritable, types_gen$1 as TotpTypes, type TotpVerifyUser, type TotpVerifyUserWritable, type User, type UserWritable, type ValidationErrorDetail, type ValidationErrorEvent, type VerifyBackupRequest, type VerifyRequest, type VerifyResponse, type VerifyResponseWritable, type WebmailLink, WebmailLinkProviderEnum, CfgAccountsApi as api, applyRoleLogPolicy, auth, defaultLogger, dispatchValidationError, dpopEnabled, formatZodError, getLogLevel, isBrowser, isDev, isProd, isStaticBuild, onLogLevelChange, onValidationError, setLogLevel };
|
|
3121
|
+
export { APIError, APILogger, type AccountDeleteResponse, types_gen$2 as AccountsTypes, type ApiKey, type ApiKeyRegenerate, type ApiKeyRequest, type ApiKeyReveal, type ApiKeyTestRequest, type ApiKeyTestResult, type Auth$1 as Auth, type BackupCodesRegenerateRequest, type BackupCodesRegenerateResponse, type BackupCodesStatus, type CentrifugoToken, types_gen as CentrifugoTypes, CfgAccountsOtp as CfgAccounts, API$2 as CfgAccountsAPI, CfgAccountsApi, CfgAccountsApiKey, type CfgAccountsApiKeyRegenerateCreateData, type CfgAccountsApiKeyRegenerateCreateErrors, type CfgAccountsApiKeyRegenerateCreateResponse, type CfgAccountsApiKeyRegenerateCreateResponses, type CfgAccountsApiKeyRetrieveData, type CfgAccountsApiKeyRetrieveErrors, type CfgAccountsApiKeyRetrieveResponse, type CfgAccountsApiKeyRetrieveResponses, type CfgAccountsApiKeyRevealCreateData, type CfgAccountsApiKeyRevealCreateErrors, type CfgAccountsApiKeyRevealCreateResponse, type CfgAccountsApiKeyRevealCreateResponses, type CfgAccountsApiKeyTestCreateData, type CfgAccountsApiKeyTestCreateResponse, type CfgAccountsApiKeyTestCreateResponses, CfgAccountsAuth, CfgAccountsOauth, type CfgAccountsOauthConnectionsListData, type CfgAccountsOauthConnectionsListResponse, type CfgAccountsOauthConnectionsListResponses, type CfgAccountsOauthConnectionsResponse200AutoRef, type CfgAccountsOauthDisconnectCreateData, type CfgAccountsOauthDisconnectCreateError, type CfgAccountsOauthDisconnectCreateErrors, type CfgAccountsOauthDisconnectCreateResponse, type CfgAccountsOauthDisconnectCreateResponses, type CfgAccountsOauthDisconnectResponse200AutoRef, type CfgAccountsOauthGithubAuthorizeCreateData, type CfgAccountsOauthGithubAuthorizeCreateError, type CfgAccountsOauthGithubAuthorizeCreateErrors, type CfgAccountsOauthGithubAuthorizeCreateResponse, type CfgAccountsOauthGithubAuthorizeCreateResponses, type CfgAccountsOauthGithubCallbackCreateData, type CfgAccountsOauthGithubCallbackCreateError, type CfgAccountsOauthGithubCallbackCreateErrors, type CfgAccountsOauthGithubCallbackCreateResponse, type CfgAccountsOauthGithubCallbackCreateResponses, type CfgAccountsOauthProvidersRetrieveData, type CfgAccountsOauthProvidersRetrieveResponse, type CfgAccountsOauthProvidersRetrieveResponses, CfgAccountsOtp, type CfgAccountsOtpConsentPolicyRetrieveData, type CfgAccountsOtpConsentPolicyRetrieveResponse, type CfgAccountsOtpConsentPolicyRetrieveResponses, type CfgAccountsOtpRequestCreateData, type CfgAccountsOtpRequestCreateError, type CfgAccountsOtpRequestCreateErrors, type CfgAccountsOtpRequestCreateResponse, type CfgAccountsOtpRequestCreateResponses, type CfgAccountsOtpVerifyCreateData, type CfgAccountsOtpVerifyCreateError, type CfgAccountsOtpVerifyCreateErrors, type CfgAccountsOtpVerifyCreateResponse, type CfgAccountsOtpVerifyCreateResponses, CfgAccountsProfile, type CfgAccountsProfileAvatarCreateData, type CfgAccountsProfileAvatarCreateErrors, type CfgAccountsProfileAvatarCreateResponse, type CfgAccountsProfileAvatarCreateResponses, type CfgAccountsProfileDeleteCreateData, type CfgAccountsProfileDeleteCreateErrors, type CfgAccountsProfileDeleteCreateResponse, type CfgAccountsProfileDeleteCreateResponses, type CfgAccountsProfilePartialPartialUpdateData, type CfgAccountsProfilePartialPartialUpdateErrors, type CfgAccountsProfilePartialPartialUpdateResponse, type CfgAccountsProfilePartialPartialUpdateResponses, type CfgAccountsProfilePartialUpdateData, type CfgAccountsProfilePartialUpdateErrors, type CfgAccountsProfilePartialUpdateResponse, type CfgAccountsProfilePartialUpdateResponses, type CfgAccountsProfileRetrieveData, type CfgAccountsProfileRetrieveErrors, type CfgAccountsProfileRetrieveResponse, type CfgAccountsProfileRetrieveResponses, type CfgAccountsProfileUpdatePartialUpdateData, type CfgAccountsProfileUpdatePartialUpdateErrors, type CfgAccountsProfileUpdatePartialUpdateResponse, type CfgAccountsProfileUpdatePartialUpdateResponses, type CfgAccountsProfileUpdateUpdateData, type CfgAccountsProfileUpdateUpdateErrors, type CfgAccountsProfileUpdateUpdateResponse, type CfgAccountsProfileUpdateUpdateResponses, type CfgAccountsTokenBlacklistCreateData, type CfgAccountsTokenBlacklistCreateResponses, type CfgAccountsTokenRefreshCreateData, type CfgAccountsTokenRefreshCreateResponse, type CfgAccountsTokenRefreshCreateResponses, CfgCentrifugo, API$1 as CfgCentrifugoAPI, CfgCentrifugoApi, type CfgCentrifugoAuthTokenRetrieveData, type CfgCentrifugoAuthTokenRetrieveErrors, type CfgCentrifugoAuthTokenRetrieveResponse, type CfgCentrifugoAuthTokenRetrieveResponses, CfgTotp, API as CfgTotpAPI, CfgTotpApi, CfgTotpBackupCodes, type CfgTotpBackupCodesRegenerateCreateData, type CfgTotpBackupCodesRegenerateCreateErrors, type CfgTotpBackupCodesRegenerateCreateResponse, type CfgTotpBackupCodesRegenerateCreateResponses, type CfgTotpBackupCodesRetrieveData, type CfgTotpBackupCodesRetrieveResponse, type CfgTotpBackupCodesRetrieveResponses, type CfgTotpDevicesDestroyData, type CfgTotpDevicesDestroyResponse, type CfgTotpDevicesDestroyResponses, type CfgTotpDevicesRetrieveData, type CfgTotpDevicesRetrieveResponse, type CfgTotpDevicesRetrieveResponses, type CfgTotpDisableCreateData, type CfgTotpDisableCreateErrors, type CfgTotpDisableCreateResponse, type CfgTotpDisableCreateResponses, type CfgTotpDisableResponse200AutoRef, CfgTotpSetup, type CfgTotpSetupConfirmCreateData, type CfgTotpSetupConfirmCreateErrors, type CfgTotpSetupConfirmCreateResponse, type CfgTotpSetupConfirmCreateResponses, type CfgTotpSetupCreateData, type CfgTotpSetupCreateErrors, type CfgTotpSetupCreateResponse, type CfgTotpSetupCreateResponses, CfgTotpVerify, type CfgTotpVerifyBackupCreateData, type CfgTotpVerifyBackupCreateErrors, type CfgTotpVerifyBackupCreateResponse, type CfgTotpVerifyBackupCreateResponses, type CfgTotpVerifyCreateData, type CfgTotpVerifyCreateErrors, type CfgTotpVerifyCreateResponse, type CfgTotpVerifyCreateResponses, type CfgUserUpdateRequest, type ClientOptions, type ConfirmSetupRequest, type ConfirmSetupResponse, type ConnectionTokenResponse, type ConsentPolicy, type ConsolaLevel, CookieStorageAdapter, type DeviceList, type DeviceListResponse, type DeviceListResponseWritable, DeviceStatusEnum, type DisableRequest, type ErrorLog, LocalStorageAdapter, type LoggerConfig, MarketingConsentDefaultEnum, MemoryStorageAdapter, NetworkError, type OAuthAuthorizeRequestRequest, type OAuthAuthorizeResponse, type OAuthCallbackRequestRequest, type OAuthConnection, type OAuthDisconnectRequestRequest, type OAuthError, OAuthProviderEnum, type OAuthProvidersResponse, type OAuthTokenResponse, type OtpErrorResponse, type OtpRequestRequest, type OtpRequestResponse, type OtpVerifyRequest, type OtpVerifyResponse, type OtpVerifyResponseWritable, type PatchedCfgUserUpdateRequest, type RequestLog, type ResponseLog, type SetupRequest, type SetupResponse, type StorageAdapter, type TokenBlacklistRequest, type TokenRefresh, type TokenRefreshRequest, type TokenRefreshWritable, types_gen$1 as TotpTypes, type TotpVerifyUser, type TotpVerifyUserWritable, type User, type UserWritable, type ValidationErrorDetail, type ValidationErrorEvent, type VerifyBackupRequest, type VerifyRequest, type VerifyResponse, type VerifyResponseWritable, type WebmailLink, WebmailLinkProviderEnum, CfgAccountsApi as api, applyRoleLogPolicy, auth, defaultLogger, dispatchValidationError, dpopEnabled, formatZodError, getLogLevel, isBrowser, isDev, isProd, isStaticBuild, onLogLevelChange, onValidationError, setLogLevel };
|
package/dist/index.mjs
CHANGED
|
@@ -101,6 +101,24 @@ var localStorageBackend = {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
|
+
var sessionStorageBackend = {
|
|
105
|
+
get(key) {
|
|
106
|
+
if (!isBrowser) return null;
|
|
107
|
+
try {
|
|
108
|
+
return window.sessionStorage.getItem(key);
|
|
109
|
+
} catch {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
set(key, value) {
|
|
114
|
+
if (!isBrowser) return;
|
|
115
|
+
try {
|
|
116
|
+
if (value === null) window.sessionStorage.removeItem(key);
|
|
117
|
+
else window.sessionStorage.setItem(key, value);
|
|
118
|
+
} catch {
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
};
|
|
104
122
|
var COOKIE_MAX_AGE = 60 * 60 * 24 * 30;
|
|
105
123
|
var cookieBackend = {
|
|
106
124
|
get(key) {
|
|
@@ -108,7 +126,8 @@ var cookieBackend = {
|
|
|
108
126
|
try {
|
|
109
127
|
const re = new RegExp(`(?:^|;\\s*)${encodeURIComponent(key)}=([^;]*)`);
|
|
110
128
|
const m = document.cookie.match(re);
|
|
111
|
-
|
|
129
|
+
const value = m?.[1];
|
|
130
|
+
return value === void 0 ? null : decodeURIComponent(value);
|
|
112
131
|
} catch {
|
|
113
132
|
return null;
|
|
114
133
|
}
|
|
@@ -134,7 +153,8 @@ function detectLocale() {
|
|
|
134
153
|
try {
|
|
135
154
|
if (typeof document !== "undefined") {
|
|
136
155
|
const m = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
|
|
137
|
-
|
|
156
|
+
const locale = m?.[1];
|
|
157
|
+
if (locale !== void 0) return decodeURIComponent(locale);
|
|
138
158
|
}
|
|
139
159
|
if (typeof navigator !== "undefined" && navigator.language) {
|
|
140
160
|
return navigator.language;
|
|
@@ -284,7 +304,7 @@ var auth = {
|
|
|
284
304
|
},
|
|
285
305
|
setStorageMode(mode) {
|
|
286
306
|
_storageMode = mode;
|
|
287
|
-
_storage = mode === "cookie" ? cookieBackend : localStorageBackend;
|
|
307
|
+
_storage = mode === "cookie" ? cookieBackend : mode === "sessionStorage" ? sessionStorageBackend : localStorageBackend;
|
|
288
308
|
notifySessionChanged();
|
|
289
309
|
},
|
|
290
310
|
// ── Bearer token ──────────────────────────────────────────────────
|
|
@@ -548,7 +568,7 @@ __name(_getDpopKeyPair, "_getDpopKeyPair");
|
|
|
548
568
|
function _b64urlFromBytes(bytes) {
|
|
549
569
|
const arr = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes);
|
|
550
570
|
let s = "";
|
|
551
|
-
for (let i = 0; i < arr.length; i++) s += String.fromCharCode(arr[i]);
|
|
571
|
+
for (let i = 0; i < arr.length; i++) s += String.fromCharCode(arr[i] ?? 0);
|
|
552
572
|
return btoa(s).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
553
573
|
}
|
|
554
574
|
__name(_b64urlFromBytes, "_b64urlFromBytes");
|
|
@@ -566,7 +586,8 @@ async function _makeDpopProof(method, url) {
|
|
|
566
586
|
const pair = await _getDpopKeyPair();
|
|
567
587
|
const jwk = await _publicJwk(pair.publicKey);
|
|
568
588
|
const header = { typ: "dpop+jwt", alg: "ES256", jwk };
|
|
569
|
-
const
|
|
589
|
+
const withoutFragment = url.split("#")[0] ?? url;
|
|
590
|
+
const htu = withoutFragment.split("?")[0] ?? withoutFragment;
|
|
570
591
|
const jti = crypto.randomUUID && crypto.randomUUID() || _b64urlFromBytes(crypto.getRandomValues(new Uint8Array(16)));
|
|
571
592
|
const payload = { htm: method.toUpperCase(), htu, iat: Math.floor(Date.now() / 1e3), jti };
|
|
572
593
|
const signingInput = `${_b64urlFromString(JSON.stringify(header))}.${_b64urlFromString(JSON.stringify(payload))}`;
|
|
@@ -1756,9 +1777,9 @@ var CfgAccountsOauth = class {
|
|
|
1756
1777
|
return (options?.client ?? client).get({ url: "/cfg/accounts/oauth/providers/", ...options });
|
|
1757
1778
|
}
|
|
1758
1779
|
};
|
|
1759
|
-
var
|
|
1780
|
+
var CfgAccountsOtp = class {
|
|
1760
1781
|
static {
|
|
1761
|
-
__name(this, "
|
|
1782
|
+
__name(this, "CfgAccountsOtp");
|
|
1762
1783
|
}
|
|
1763
1784
|
/**
|
|
1764
1785
|
* Marketing-consent checkbox policy for the caller's jurisdiction.
|
|
@@ -2226,7 +2247,7 @@ var API = class {
|
|
|
2226
2247
|
logger;
|
|
2227
2248
|
cfgAccountsApiKey = CfgAccountsApiKey;
|
|
2228
2249
|
cfgAccountsOauth = CfgAccountsOauth;
|
|
2229
|
-
|
|
2250
|
+
cfgAccountsOtp = CfgAccountsOtp;
|
|
2230
2251
|
cfgAccountsProfile = CfgAccountsProfile;
|
|
2231
2252
|
cfgAccountsAuth = CfgAccountsAuth;
|
|
2232
2253
|
constructor(_baseUrl, opts = {}) {
|
|
@@ -2621,12 +2642,13 @@ __name(applyRoleLogPolicy, "applyRoleLogPolicy");
|
|
|
2621
2642
|
export {
|
|
2622
2643
|
APIError,
|
|
2623
2644
|
APILogger,
|
|
2624
|
-
CfgAccounts,
|
|
2645
|
+
CfgAccountsOtp as CfgAccounts,
|
|
2625
2646
|
API as CfgAccountsAPI,
|
|
2626
2647
|
CfgAccountsApi,
|
|
2627
2648
|
CfgAccountsApiKey,
|
|
2628
2649
|
CfgAccountsAuth,
|
|
2629
2650
|
CfgAccountsOauth,
|
|
2651
|
+
CfgAccountsOtp,
|
|
2630
2652
|
CfgAccountsProfile,
|
|
2631
2653
|
CfgCentrifugo,
|
|
2632
2654
|
API2 as CfgCentrifugoAPI,
|