@okta/okta-auth-js 6.4.0 → 6.4.3

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.
Files changed (84) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/cjs/OktaAuth.js.map +1 -1
  3. package/cjs/OktaUserAgent.js +2 -2
  4. package/cjs/ServiceManager.js +1 -1
  5. package/cjs/ServiceManager.js.map +1 -1
  6. package/cjs/TransactionManager.js +25 -13
  7. package/cjs/TransactionManager.js.map +1 -1
  8. package/cjs/crypto/node.js +11 -16
  9. package/cjs/crypto/node.js.map +1 -1
  10. package/cjs/errors/AuthApiError.js.map +1 -1
  11. package/cjs/errors/AuthSdkError.js.map +1 -1
  12. package/cjs/idx/authenticate.js.map +1 -1
  13. package/cjs/idx/authenticator/SecurityQuestionEnrollment.js +1 -1
  14. package/cjs/idx/authenticator/SecurityQuestionEnrollment.js.map +1 -1
  15. package/cjs/idx/authenticator/SecurityQuestionVerification.js +12 -1
  16. package/cjs/idx/authenticator/SecurityQuestionVerification.js.map +1 -1
  17. package/cjs/idx/cancel.js.map +1 -1
  18. package/cjs/idx/idxState/v1/generateIdxAction.js +0 -2
  19. package/cjs/idx/idxState/v1/generateIdxAction.js.map +1 -1
  20. package/cjs/idx/interact.js.map +1 -1
  21. package/cjs/idx/introspect.js +1 -1
  22. package/cjs/idx/introspect.js.map +1 -1
  23. package/cjs/idx/proceed.js.map +1 -1
  24. package/cjs/idx/recoverPassword.js.map +1 -1
  25. package/cjs/idx/register.js.map +1 -1
  26. package/cjs/idx/remediate.js +12 -12
  27. package/cjs/idx/remediate.js.map +1 -1
  28. package/cjs/idx/remediators/AuthenticatorVerificationData.js.map +1 -1
  29. package/cjs/idx/remediators/Base/Remediator.js.map +1 -1
  30. package/cjs/idx/remediators/EnrollmentChannelData.js.map +1 -1
  31. package/cjs/idx/remediators/SelectEnrollmentChannel.js.map +1 -1
  32. package/cjs/idx/run.js +33 -4
  33. package/cjs/idx/run.js.map +1 -1
  34. package/cjs/idx/startTransaction.js.map +1 -1
  35. package/cjs/idx/types/api.js +42 -0
  36. package/cjs/idx/types/api.js.map +1 -0
  37. package/cjs/idx/types/idx-js.js.map +1 -1
  38. package/cjs/idx/types/index.js +27 -51
  39. package/cjs/idx/types/index.js.map +1 -1
  40. package/cjs/idx/types/options.js +2 -0
  41. package/cjs/idx/types/options.js.map +1 -0
  42. package/cjs/idx/unlockAccount.js.map +1 -1
  43. package/cjs/oidc/exchangeCodeForTokens.js.map +1 -1
  44. package/cjs/types/Transaction.js.map +1 -1
  45. package/dist/okta-auth-js.min.js +1 -1
  46. package/dist/okta-auth-js.min.js.map +1 -1
  47. package/dist/okta-auth-js.umd.js +1 -1
  48. package/dist/okta-auth-js.umd.js.map +1 -1
  49. package/esm/esm.browser.js +93 -65
  50. package/esm/esm.browser.js.map +1 -1
  51. package/esm/esm.node.mjs +93 -65
  52. package/esm/esm.node.mjs.map +1 -1
  53. package/lib/OktaAuth.d.ts +2 -2
  54. package/lib/TransactionManager.d.ts +4 -3
  55. package/lib/errors/AuthApiError.d.ts +2 -2
  56. package/lib/errors/AuthSdkError.d.ts +2 -2
  57. package/lib/idx/authenticate.d.ts +1 -3
  58. package/lib/idx/authenticator/SecurityQuestionVerification.d.ts +1 -0
  59. package/lib/idx/cancel.d.ts +2 -3
  60. package/lib/idx/emailVerify.d.ts +1 -1
  61. package/lib/idx/idxState/v1/generateIdxAction.d.ts +2 -2
  62. package/lib/idx/interact.d.ts +1 -16
  63. package/lib/idx/introspect.d.ts +1 -7
  64. package/lib/idx/proceed.d.ts +1 -9
  65. package/lib/idx/recoverPassword.d.ts +1 -3
  66. package/lib/idx/register.d.ts +1 -3
  67. package/lib/idx/remediate.d.ts +1 -9
  68. package/lib/idx/remediators/AuthenticatorVerificationData.d.ts +1 -2
  69. package/lib/idx/remediators/Base/Remediator.d.ts +2 -2
  70. package/lib/idx/remediators/EnrollmentChannelData.d.ts +3 -3
  71. package/lib/idx/remediators/SelectEnrollmentChannel.d.ts +3 -3
  72. package/lib/idx/run.d.ts +1 -10
  73. package/lib/idx/startTransaction.d.ts +2 -3
  74. package/lib/idx/types/api.d.ts +98 -0
  75. package/lib/idx/types/idx-js.d.ts +10 -3
  76. package/lib/idx/types/index.d.ts +4 -110
  77. package/lib/idx/types/options.d.ts +44 -0
  78. package/lib/idx/unlockAccount.d.ts +1 -3
  79. package/lib/types/OAuth.d.ts +2 -0
  80. package/lib/types/OktaAuthOptions.d.ts +27 -11
  81. package/lib/types/Storage.d.ts +2 -1
  82. package/lib/types/Transaction.d.ts +8 -28
  83. package/lib/types/api.d.ts +12 -36
  84. package/package.json +4 -3
package/lib/OktaAuth.d.ts CHANGED
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
- import { OktaAuthInterface, OktaAuthOptions, AccessToken, RefreshToken, TokenAPI, FeaturesAPI, CryptoAPI, WebauthnAPI, SignoutAPI, FingerprintAPI, UserClaims, SigninWithRedirectOptions, SigninWithCredentialsOptions, SignoutOptions, Tokens, ForgotPasswordOptions, VerifyRecoveryTokenOptions, TransactionAPI, SessionAPI, SigninAPI, PkceAPI, SigninOptions, IdxAPI, SignoutRedirectUrlOptions, HttpAPI, RequestOptions, IsAuthenticatedOptions } from './types';
12
+ import { OktaAuthInterface, OktaAuthOptions, AccessToken, RefreshToken, TokenAPI, FeaturesAPI, CryptoAPI, WebauthnAPI, SignoutAPI, FingerprintAPI, UserClaims, SigninWithRedirectOptions, SigninWithCredentialsOptions, SignoutOptions, Tokens, ForgotPasswordOptions, VerifyRecoveryTokenOptions, TransactionAPI, SessionAPI, SigninAPI, PkceAPI, SigninOptions, IdxAPI, SignoutRedirectUrlOptions, HttpAPI, RequestOptions, IsAuthenticatedOptions, OAuthResponseType } from './types';
13
13
  import { AuthTransaction } from './tx';
14
14
  import { TokenManager } from './TokenManager';
15
15
  import { ServiceManager } from './ServiceManager';
@@ -70,7 +70,7 @@ declare class OktaAuth implements OktaAuthInterface, SigninAPI, SignoutAPI {
70
70
  isLoginRedirect(): boolean;
71
71
  handleLoginRedirect(tokens?: Tokens, originalUri?: string): Promise<void>;
72
72
  isPKCE(): boolean;
73
- hasResponseType(responseType: string): boolean;
73
+ hasResponseType(responseType: OAuthResponseType): boolean;
74
74
  isAuthorizationCodeFlow(): boolean;
75
75
  getIssuerOrigin(): string;
76
76
  forgotPassword(opts: any): Promise<AuthTransaction>;
@@ -10,9 +10,10 @@
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
12
  import { StorageManager } from './StorageManager';
13
- import { TransactionMeta, PKCETransactionMeta, OAuthTransactionMeta, TransactionMetaOptions, TransactionManagerOptions, SavedIdxResponse } from './types';
13
+ import { TransactionMeta, PKCETransactionMeta, OAuthTransactionMeta, TransactionMetaOptions, TransactionManagerOptions, SavedIdxResponse, IntrospectOptions } from './types';
14
14
  export interface ClearTransactionMetaOptions extends TransactionMetaOptions {
15
15
  clearSharedStorage?: boolean;
16
+ clearIdxResponse?: boolean;
16
17
  }
17
18
  export default class TransactionManager {
18
19
  options: TransactionManagerOptions;
@@ -32,7 +33,7 @@ export default class TransactionManager {
32
33
  loadLegacyPKCE(): PKCETransactionMeta;
33
34
  clearLegacyOAuthParams(): void;
34
35
  loadLegacyOAuthParams(): OAuthTransactionMeta;
35
- saveIdxResponse({ rawIdxResponse, requestDidSucceed }: SavedIdxResponse): void;
36
- loadIdxResponse(): SavedIdxResponse | null;
36
+ saveIdxResponse(data: SavedIdxResponse): void;
37
+ loadIdxResponse(options?: IntrospectOptions): SavedIdxResponse | null;
37
38
  clearIdxResponse(): void;
38
39
  }
@@ -10,13 +10,13 @@
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
12
  import CustomError from './CustomError';
13
- import { APIError, HttpResponse } from '../types';
13
+ import { APIError, FieldError, HttpResponse } from '../types';
14
14
  export default class AuthApiError extends CustomError implements APIError {
15
15
  errorSummary: string;
16
16
  errorCode?: string;
17
17
  errorLink?: string;
18
18
  errorId?: string;
19
- errorCauses?: string[];
19
+ errorCauses?: Array<FieldError>;
20
20
  xhr?: HttpResponse;
21
21
  constructor(err: APIError, xhr?: HttpResponse);
22
22
  }
@@ -10,13 +10,13 @@
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
12
  import CustomError from './CustomError';
13
- import { APIError } from '../types';
13
+ import { APIError, FieldError } from '../types';
14
14
  export default class AuthSdkError extends CustomError implements APIError {
15
15
  errorSummary: string;
16
16
  errorCode: string;
17
17
  errorLink: string;
18
18
  errorId: string;
19
- errorCauses: string[];
19
+ errorCauses: Array<FieldError>;
20
20
  xhr?: XMLHttpRequest;
21
21
  constructor(msg: string, xhr?: XMLHttpRequest);
22
22
  }
@@ -9,7 +9,5 @@
9
9
  *
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
- import { OktaAuthInterface, IdxOptions, IdxTransaction } from '../types';
13
- import { IdentifyValues, SelectAuthenticatorAuthenticateValues, ChallengeAuthenticatorValues, ReEnrollAuthenticatorValues, AuthenticatorEnrollmentDataValues, SelectAuthenticatorEnrollValues, EnrollAuthenticatorValues } from './remediators';
14
- export declare type AuthenticationOptions = IdxOptions & IdentifyValues & SelectAuthenticatorAuthenticateValues & SelectAuthenticatorEnrollValues & ChallengeAuthenticatorValues & ReEnrollAuthenticatorValues & AuthenticatorEnrollmentDataValues & EnrollAuthenticatorValues;
12
+ import { OktaAuthInterface, IdxTransaction, AuthenticationOptions } from '../types';
15
13
  export declare function authenticate(authClient: OktaAuthInterface, options?: AuthenticationOptions): Promise<IdxTransaction>;
@@ -1,6 +1,7 @@
1
1
  import { Authenticator, Credentials } from './Authenticator';
2
2
  export interface SecurityQuestionVerificationValues {
3
3
  answer?: string;
4
+ credentials?: Credentials;
4
5
  }
5
6
  export declare class SecurityQuestionVerification extends Authenticator<SecurityQuestionVerificationValues> {
6
7
  canVerify(values: SecurityQuestionVerificationValues): boolean;
@@ -9,6 +9,5 @@
9
9
  *
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
- import { OktaAuthInterface, IdxOptions } from '../types';
13
- export declare type CancelOptions = IdxOptions;
14
- export declare function cancel(authClient: OktaAuthInterface, options?: CancelOptions): Promise<import("./types").IdxTransaction>;
12
+ import { OktaAuthInterface, CancelOptions } from '../types';
13
+ export declare function cancel(authClient: OktaAuthInterface, options?: CancelOptions): Promise<import("./types/api").IdxTransaction>;
@@ -23,4 +23,4 @@ export declare class EmailVerifyCallbackError extends CustomError {
23
23
  export declare function isEmailVerifyCallbackError(error: Error): boolean;
24
24
  export declare function isEmailVerifyCallback(urlPath: string): boolean;
25
25
  export declare function parseEmailVerifyCallback(urlPath: string): EmailVerifyCallbackResponse;
26
- export declare function handleEmailVerifyCallback(authClient: OktaAuthInterface, search: string): Promise<import("./types").IdxTransaction | undefined>;
26
+ export declare function handleEmailVerifyCallback(authClient: OktaAuthInterface, search: string): Promise<import("./types/api").IdxTransaction | undefined>;
@@ -10,6 +10,6 @@
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
12
  import { OktaAuthInterface } from '../../../types';
13
- import { IdxActionParams } from '../../types/idx-js';
14
- declare const generateIdxAction: (authClient: OktaAuthInterface, actionDefinition: any, toPersist: any) => (params?: IdxActionParams) => Promise<IdxResponse>;
13
+ import { IdxActionFunction } from '../../types/idx-js';
14
+ declare const generateIdxAction: (authClient: OktaAuthInterface, actionDefinition: any, toPersist: any) => IdxActionFunction;
15
15
  export default generateIdxAction;
@@ -9,22 +9,7 @@
9
9
  *
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
- import { OktaAuthInterface, IdxTransactionMeta } from '../types';
13
- export interface InteractOptions {
14
- withCredentials?: boolean;
15
- state?: string;
16
- scopes?: string[];
17
- codeChallenge?: string;
18
- codeChallengeMethod?: string;
19
- activationToken?: string;
20
- recoveryToken?: string;
21
- clientSecret?: string;
22
- }
23
- export interface InteractResponse {
24
- state?: string;
25
- interactionHandle: string;
26
- meta: IdxTransactionMeta;
27
- }
12
+ import { OktaAuthInterface, InteractOptions, InteractResponse } from '../types';
28
13
  export interface InteractParams {
29
14
  client_id: string;
30
15
  scope: string;
@@ -9,12 +9,6 @@
9
9
  *
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
- import { OktaAuthInterface } from '../types';
12
+ import { IntrospectOptions, OktaAuthInterface } from '../types';
13
13
  import { IdxResponse } from './types/idx-js';
14
- export interface IntrospectOptions {
15
- withCredentials?: boolean;
16
- interactionHandle?: string;
17
- stateHandle?: string;
18
- version?: string;
19
- }
20
14
  export declare function introspect(authClient: OktaAuthInterface, options?: IntrospectOptions): Promise<IdxResponse>;
@@ -9,14 +9,6 @@
9
9
  *
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
- import { OktaAuthInterface, IdxTransaction } from '../types';
13
- import { AuthenticationOptions } from './authenticate';
14
- import { EnrollPollValues as EnrollPollOptions, SelectEnrollmentChannelValues as SelectEnrollmentChannelOptions } from './remediators';
15
- import { RegistrationOptions } from './register';
16
- import { PasswordRecoveryOptions } from './recoverPassword';
17
- import { AccountUnlockOptions } from './unlockAccount';
18
- export declare type ProceedOptions = AuthenticationOptions & RegistrationOptions & PasswordRecoveryOptions & AccountUnlockOptions & EnrollPollOptions & SelectEnrollmentChannelOptions & {
19
- step?: string;
20
- };
12
+ import { OktaAuthInterface, IdxTransaction, ProceedOptions } from '../types';
21
13
  export declare function canProceed(authClient: OktaAuthInterface, options?: ProceedOptions): boolean;
22
14
  export declare function proceed(authClient: OktaAuthInterface, options?: ProceedOptions): Promise<IdxTransaction>;
@@ -9,7 +9,5 @@
9
9
  *
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
- import { IdentifyValues, SelectAuthenticatorAuthenticateValues, ChallengeAuthenticatorValues, AuthenticatorVerificationDataValues, ResetAuthenticatorValues, ReEnrollAuthenticatorValues } from './remediators';
13
- import { OktaAuthInterface, IdxOptions, IdxTransaction } from '../types';
14
- export declare type PasswordRecoveryOptions = IdxOptions & IdentifyValues & SelectAuthenticatorAuthenticateValues & ChallengeAuthenticatorValues & ResetAuthenticatorValues & AuthenticatorVerificationDataValues & ReEnrollAuthenticatorValues;
12
+ import { OktaAuthInterface, PasswordRecoveryOptions, IdxTransaction } from '../types';
15
13
  export declare function recoverPassword(authClient: OktaAuthInterface, options?: PasswordRecoveryOptions): Promise<IdxTransaction>;
@@ -9,7 +9,5 @@
9
9
  *
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
- import { EnrollProfileValues, SelectAuthenticatorEnrollValues, EnrollAuthenticatorValues, AuthenticatorEnrollmentDataValues, SkipValues } from './remediators';
13
- import { IdxOptions, IdxTransaction, OktaAuthInterface } from '../types';
14
- export declare type RegistrationOptions = IdxOptions & EnrollProfileValues & SelectAuthenticatorEnrollValues & EnrollAuthenticatorValues & AuthenticatorEnrollmentDataValues & SkipValues;
12
+ import { RegistrationOptions, IdxTransaction, OktaAuthInterface } from '../types';
15
13
  export declare function register(authClient: OktaAuthInterface, options?: RegistrationOptions): Promise<IdxTransaction>;
@@ -10,19 +10,11 @@
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
12
  import { RemediationValues } from './remediators';
13
- import { FlowIdentifier, RemediationResponse } from './types';
14
- import { RemediationFlow } from './flow';
13
+ import { RemediateOptions, RemediationResponse } from './types';
15
14
  import { IdxResponse, IdxActionParams } from './types/idx-js';
16
15
  export interface RemediateActionWithOptionalParams {
17
16
  name: string;
18
17
  params?: IdxActionParams;
19
18
  }
20
19
  export declare type RemediateAction = string | RemediateActionWithOptionalParams;
21
- export interface RemediateOptions {
22
- remediators?: RemediationFlow;
23
- actions?: RemediateAction[];
24
- flow?: FlowIdentifier;
25
- step?: string;
26
- shouldProceedWithEmailAuthenticator?: boolean;
27
- }
28
20
  export declare function remediate(idxResponse: IdxResponse, values: RemediationValues, options: RemediateOptions): Promise<RemediationResponse>;
@@ -10,8 +10,7 @@
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
12
  import { AuthenticatorData, AuthenticatorDataValues } from './Base/AuthenticatorData';
13
- import { IdxRemediation } from '../types/idx-js';
14
- import { RemediateOptions } from '../remediate';
13
+ import { IdxRemediation, RemediateOptions } from '../types';
15
14
  export declare type AuthenticatorVerificationDataValues = AuthenticatorDataValues;
16
15
  export declare class AuthenticatorVerificationData extends AuthenticatorData<AuthenticatorVerificationDataValues> {
17
16
  static remediationName: string;
@@ -9,10 +9,10 @@
9
9
  *
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
- import { NextStep, IdxMessage, Authenticator, IdxOptions, RemediateOptions } from '../../types';
12
+ import { NextStep, IdxMessage, Authenticator, RemediateOptions } from '../../types';
13
13
  import { IdxAuthenticator, IdxRemediation, IdxContext } from '../../types/idx-js';
14
14
  export declare type IdxToRemediationValueMap = Record<string, string[]>;
15
- export interface RemediationValues extends IdxOptions {
15
+ export interface RemediationValues {
16
16
  stateHandle?: string;
17
17
  authenticators?: (Authenticator | string)[];
18
18
  authenticator?: string | Authenticator;
@@ -35,9 +35,9 @@ export declare class EnrollmentChannelData extends Remediator<EnrollmentChannelD
35
35
  name: string;
36
36
  canSkip?: boolean | undefined;
37
37
  canResend?: boolean | undefined;
38
- inputs?: import("../types").Input[] | undefined;
38
+ inputs?: import("../..").Input[] | undefined;
39
39
  options?: import("../types/idx-js").IdxOption[] | undefined;
40
- poll?: import("../types").IdxPollOptions | undefined;
40
+ poll?: import("../..").IdxPollOptions | undefined;
41
41
  authenticatorEnrollments?: import("../types/idx-js").IdxAuthenticator[] | undefined;
42
42
  };
43
43
  getData(): {
@@ -45,5 +45,5 @@ export declare class EnrollmentChannelData extends Remediator<EnrollmentChannelD
45
45
  email: string | undefined;
46
46
  phoneNumber: string | undefined;
47
47
  };
48
- getValuesAfterProceed(): {};
48
+ getValuesAfterProceed(): EnrollmentChannelDataValues;
49
49
  }
@@ -23,8 +23,8 @@ export declare class SelectEnrollmentChannel extends Remediator<SelectEnrollment
23
23
  name: string;
24
24
  canSkip?: boolean | undefined;
25
25
  canResend?: boolean | undefined;
26
- inputs?: import("../types").Input[] | undefined;
27
- poll?: import("../types").IdxPollOptions | undefined;
26
+ inputs?: import("../..").Input[] | undefined;
27
+ poll?: import("../..").IdxPollOptions | undefined;
28
28
  authenticatorEnrollments?: import("../types/idx-js").IdxAuthenticator[] | undefined;
29
29
  };
30
30
  private getChannels;
@@ -35,5 +35,5 @@ export declare class SelectEnrollmentChannel extends Remediator<SelectEnrollment
35
35
  };
36
36
  stateHandle: string | undefined;
37
37
  };
38
- getValuesAfterProceed(): {};
38
+ getValuesAfterProceed(): SelectEnrollmentChannelValues;
39
39
  }
package/lib/idx/run.d.ts CHANGED
@@ -9,14 +9,5 @@
9
9
  *
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
- import { RemediateOptions } from './remediate';
13
- import { RemediationFlow } from './flow';
14
- import { OktaAuthInterface, IdxTransaction, FlowIdentifier } from '../types';
15
- import { ProceedOptions } from './proceed';
16
- export declare type RunOptions = ProceedOptions & RemediateOptions & {
17
- flow?: FlowIdentifier;
18
- remediators?: RemediationFlow;
19
- actions?: string[];
20
- withCredentials?: boolean;
21
- };
12
+ import { OktaAuthInterface, IdxTransaction, RunOptions } from '../types';
22
13
  export declare function run(authClient: OktaAuthInterface, options?: RunOptions): Promise<IdxTransaction>;
@@ -9,6 +9,5 @@
9
9
  *
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
- import { RunOptions } from './run';
13
- import { OktaAuthInterface, IdxTransaction } from '../types';
14
- export declare function startTransaction(authClient: OktaAuthInterface, options?: RunOptions): Promise<IdxTransaction>;
12
+ import { OktaAuthInterface, IdxTransaction, StartOptions } from '../types';
13
+ export declare function startTransaction(authClient: OktaAuthInterface, options?: StartOptions): Promise<IdxTransaction>;
@@ -0,0 +1,98 @@
1
+ import { APIError } from '../../types/api';
2
+ import { Tokens } from '../../types/Token';
3
+ import { PKCETransactionMeta } from '../../types/Transaction';
4
+ import { FlowIdentifier } from './FlowIdentifier';
5
+ import { IdxActions, IdxAuthenticator, IdxContext, IdxForm, IdxMessage, IdxOption, IdxRemediation, IdxResponse, RawIdxResponse } from './idx-js';
6
+ export declare enum IdxStatus {
7
+ SUCCESS = "SUCCESS",
8
+ PENDING = "PENDING",
9
+ FAILURE = "FAILURE",
10
+ TERMINAL = "TERMINAL",
11
+ CANCELED = "CANCELED"
12
+ }
13
+ export declare enum AuthenticatorKey {
14
+ OKTA_PASSWORD = "okta_password",
15
+ OKTA_EMAIL = "okta_email",
16
+ PHONE_NUMBER = "phone_number",
17
+ GOOGLE_AUTHENTICATOR = "google_otp",
18
+ SECURITY_QUESTION = "security_question",
19
+ OKTA_VERIFY = "okta_verify",
20
+ WEBAUTHN = "webauthn"
21
+ }
22
+ export declare type Input = {
23
+ name: string;
24
+ key?: string;
25
+ type?: string;
26
+ label?: string;
27
+ value?: string | {
28
+ form: IdxForm;
29
+ };
30
+ minLength?: number;
31
+ maxLength?: number;
32
+ secret?: boolean;
33
+ required?: boolean;
34
+ };
35
+ export interface IdxPollOptions {
36
+ required?: boolean;
37
+ refresh?: number;
38
+ }
39
+ export declare type NextStep = {
40
+ name: string;
41
+ authenticator?: IdxAuthenticator;
42
+ canSkip?: boolean;
43
+ canResend?: boolean;
44
+ inputs?: Input[];
45
+ options?: IdxOption[];
46
+ poll?: IdxPollOptions;
47
+ authenticatorEnrollments?: IdxAuthenticator[];
48
+ };
49
+ export declare enum IdxFeature {
50
+ PASSWORD_RECOVERY = "recover-password",
51
+ REGISTRATION = "enroll-profile",
52
+ SOCIAL_IDP = "redirect-idp",
53
+ ACCOUNT_UNLOCK = "unlock-account"
54
+ }
55
+ export interface IdxTransactionMeta extends PKCETransactionMeta {
56
+ interactionHandle?: string;
57
+ remediations?: string[];
58
+ flow?: FlowIdentifier;
59
+ withCredentials?: boolean;
60
+ activationToken?: string;
61
+ recoveryToken?: string;
62
+ }
63
+ export interface IdxTransaction {
64
+ status: IdxStatus;
65
+ tokens?: Tokens;
66
+ nextStep?: NextStep;
67
+ messages?: IdxMessage[];
68
+ error?: APIError | IdxResponse;
69
+ meta?: IdxTransactionMeta;
70
+ enabledFeatures?: IdxFeature[];
71
+ availableSteps?: NextStep[];
72
+ requestDidSucceed?: boolean;
73
+ proceed: (remediationName: string, params: unknown) => Promise<IdxResponse>;
74
+ neededToProceed: IdxRemediation[];
75
+ rawIdxState: RawIdxResponse;
76
+ interactionCode?: string;
77
+ actions: IdxActions;
78
+ context: IdxContext;
79
+ }
80
+ export declare type Authenticator = {
81
+ id?: string;
82
+ key?: string;
83
+ methodType?: string;
84
+ phoneNumber?: string;
85
+ };
86
+ export declare function isAuthenticator(obj: any): obj is Authenticator;
87
+ export interface RemediationResponse {
88
+ idxResponse: IdxResponse;
89
+ nextStep?: NextStep;
90
+ messages?: IdxMessage[];
91
+ terminal?: boolean;
92
+ canceled?: boolean;
93
+ }
94
+ export interface InteractResponse {
95
+ state?: string;
96
+ interactionHandle: string;
97
+ meta: IdxTransactionMeta;
98
+ }
@@ -190,16 +190,23 @@ export interface IdxActionParams {
190
190
  export interface IdxActions {
191
191
  [key: string]: (params?: IdxActionParams) => Promise<IdxResponse>;
192
192
  }
193
+ export interface IdxToPersist {
194
+ interactionHandle?: string;
195
+ withCredentials?: boolean;
196
+ }
197
+ export interface IdxActionFunction {
198
+ (params: IdxActionParams): Promise<IdxResponse>;
199
+ neededParams?: Array<Array<IdxRemediationValue>>;
200
+ }
193
201
  export interface IdxResponse {
194
202
  proceed: (remediationName: string, params: unknown) => Promise<IdxResponse>;
195
203
  neededToProceed: IdxRemediation[];
196
204
  rawIdxState: RawIdxResponse;
197
205
  interactionCode?: string;
198
206
  actions: IdxActions;
199
- toPersist: {
200
- interactionHandle?: string;
201
- };
207
+ toPersist: IdxToPersist;
202
208
  context?: IdxContext;
203
209
  requestDidSucceed?: boolean;
210
+ stepUp?: boolean;
204
211
  }
205
212
  export declare function isIdxResponse(obj: any): obj is IdxResponse;
@@ -9,116 +9,10 @@
9
9
  *
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
- import { InteractOptions } from '../interact';
13
- import { IntrospectOptions } from '../introspect';
14
- import { APIError, Tokens } from '../../types';
15
- import { PKCETransactionMeta } from '../../types/Transaction';
16
- import { IdxActions, IdxAuthenticator, IdxContext, IdxForm, IdxMessage, IdxOption, IdxRemediation, IdxResponse, RawIdxResponse } from './idx-js';
17
- import { FlowIdentifier } from './FlowIdentifier';
18
- export type { IdxMessage, IdxMessages, ChallengeData, ActivationData, IdxResponse, IdxContext, RawIdxResponse } from './idx-js';
19
- export type { AuthenticationOptions } from '../authenticate';
20
- export type { RegistrationOptions } from '../register';
21
- export type { PasswordRecoveryOptions } from '../recoverPassword';
22
- export type { AccountUnlockOptions } from '../unlockAccount';
23
- export type { ProceedOptions } from '../proceed';
24
- export type { CancelOptions } from '../cancel';
25
- export type { RemediateOptions } from '../remediate';
26
- export type { FlowIdentifier };
27
- export type { IdxAuthenticator };
12
+ export * from './api';
13
+ export * from './options';
14
+ export type { IdxMessage, IdxMessages, ChallengeData, ActivationData, IdxResponse, IdxContext, RawIdxResponse, IdxRemediation, IdxAuthenticator } from './idx-js';
15
+ export type { FlowIdentifier } from './FlowIdentifier';
28
16
  export type { EmailVerifyCallbackResponse } from '../emailVerify';
29
17
  export type { WebauthnEnrollValues } from '../authenticator/WebauthnEnrollment';
30
18
  export type { WebauthnVerificationValues } from '../authenticator/WebauthnVerification';
31
- export declare enum IdxStatus {
32
- SUCCESS = "SUCCESS",
33
- PENDING = "PENDING",
34
- FAILURE = "FAILURE",
35
- TERMINAL = "TERMINAL",
36
- CANCELED = "CANCELED"
37
- }
38
- export declare enum AuthenticatorKey {
39
- OKTA_PASSWORD = "okta_password",
40
- OKTA_EMAIL = "okta_email",
41
- PHONE_NUMBER = "phone_number",
42
- GOOGLE_AUTHENTICATOR = "google_otp",
43
- SECURITY_QUESTION = "security_question",
44
- OKTA_VERIFY = "okta_verify",
45
- WEBAUTHN = "webauthn"
46
- }
47
- export declare type Input = {
48
- name: string;
49
- key?: string;
50
- type?: string;
51
- label?: string;
52
- value?: string | {
53
- form: IdxForm;
54
- };
55
- minLength?: number;
56
- maxLength?: number;
57
- secret?: boolean;
58
- required?: boolean;
59
- };
60
- export interface IdxPollOptions {
61
- required?: boolean;
62
- refresh?: number;
63
- }
64
- export declare type NextStep = {
65
- name: string;
66
- authenticator?: IdxAuthenticator;
67
- canSkip?: boolean;
68
- canResend?: boolean;
69
- inputs?: Input[];
70
- options?: IdxOption[];
71
- poll?: IdxPollOptions;
72
- authenticatorEnrollments?: IdxAuthenticator[];
73
- };
74
- export declare enum IdxFeature {
75
- PASSWORD_RECOVERY = "recover-password",
76
- REGISTRATION = "enroll-profile",
77
- SOCIAL_IDP = "redirect-idp",
78
- ACCOUNT_UNLOCK = "unlock-account"
79
- }
80
- export interface IdxTransactionMeta extends PKCETransactionMeta {
81
- interactionHandle?: string;
82
- remediations?: string[];
83
- flow?: FlowIdentifier;
84
- withCredentials?: boolean;
85
- activationToken?: string;
86
- recoveryToken?: string;
87
- }
88
- export interface IdxTransaction {
89
- status: IdxStatus;
90
- tokens?: Tokens;
91
- nextStep?: NextStep;
92
- messages?: IdxMessage[];
93
- error?: APIError | IdxResponse;
94
- meta?: IdxTransactionMeta;
95
- enabledFeatures?: IdxFeature[];
96
- availableSteps?: NextStep[];
97
- requestDidSucceed?: boolean;
98
- proceed: (remediationName: string, params: unknown) => Promise<IdxResponse>;
99
- neededToProceed: IdxRemediation[];
100
- rawIdxState: RawIdxResponse;
101
- interactionCode?: string;
102
- actions: IdxActions;
103
- context: IdxContext;
104
- }
105
- export declare type IdxOptions = InteractOptions & IntrospectOptions & {
106
- flow?: FlowIdentifier;
107
- exchangeCodeForTokens?: boolean;
108
- autoRemediate?: boolean;
109
- step?: string;
110
- };
111
- export declare type Authenticator = {
112
- id?: string;
113
- key?: string;
114
- methodType?: string;
115
- phoneNumber?: string;
116
- };
117
- export declare function isAuthenticator(obj: any): obj is Authenticator;
118
- export interface RemediationResponse {
119
- idxResponse: IdxResponse;
120
- nextStep?: NextStep;
121
- messages?: IdxMessage[];
122
- terminal?: boolean;
123
- canceled?: boolean;
124
- }
@@ -0,0 +1,44 @@
1
+ import { RemediationFlow } from '../flow';
2
+ import { RemediateAction } from '../remediate';
3
+ import { FlowIdentifier } from './FlowIdentifier';
4
+ import { AuthenticatorVerificationDataValues, EnrollProfileValues, ResetAuthenticatorValues, SelectAuthenticatorUnlockAccountValues, SkipValues, EnrollPollValues as EnrollPollOptions, SelectEnrollmentChannelValues as SelectEnrollmentChannelOptions, IdentifyValues, SelectAuthenticatorAuthenticateValues, ChallengeAuthenticatorValues, ReEnrollAuthenticatorValues, AuthenticatorEnrollmentDataValues, SelectAuthenticatorEnrollValues, EnrollAuthenticatorValues } from '../remediators';
5
+ export interface IdxOptions {
6
+ flow?: FlowIdentifier;
7
+ exchangeCodeForTokens?: boolean;
8
+ autoRemediate?: boolean;
9
+ step?: string;
10
+ withCredentials?: boolean;
11
+ }
12
+ export interface InteractOptions extends IdxOptions {
13
+ state?: string;
14
+ scopes?: string[];
15
+ codeChallenge?: string;
16
+ codeChallengeMethod?: string;
17
+ activationToken?: string;
18
+ recoveryToken?: string;
19
+ clientSecret?: string;
20
+ }
21
+ export interface IntrospectOptions extends IdxOptions {
22
+ interactionHandle?: string;
23
+ stateHandle?: string;
24
+ version?: string;
25
+ }
26
+ export interface RemediateOptions extends IdxOptions {
27
+ remediators?: RemediationFlow;
28
+ actions?: RemediateAction[];
29
+ shouldProceedWithEmailAuthenticator?: boolean;
30
+ }
31
+ export interface RunOptions extends RemediateOptions, InteractOptions, IntrospectOptions {
32
+ }
33
+ export interface AuthenticationOptions extends RunOptions, IdentifyValues, SelectAuthenticatorAuthenticateValues, SelectAuthenticatorEnrollValues, ChallengeAuthenticatorValues, ReEnrollAuthenticatorValues, AuthenticatorEnrollmentDataValues, EnrollAuthenticatorValues {
34
+ }
35
+ export interface RegistrationOptions extends RunOptions, IdentifyValues, EnrollProfileValues, SelectAuthenticatorEnrollValues, EnrollAuthenticatorValues, AuthenticatorEnrollmentDataValues, SkipValues {
36
+ }
37
+ export interface PasswordRecoveryOptions extends RunOptions, IdentifyValues, SelectAuthenticatorAuthenticateValues, ChallengeAuthenticatorValues, ResetAuthenticatorValues, AuthenticatorVerificationDataValues, ReEnrollAuthenticatorValues {
38
+ }
39
+ export interface AccountUnlockOptions extends RunOptions, IdentifyValues, SelectAuthenticatorUnlockAccountValues, SelectAuthenticatorAuthenticateValues, ChallengeAuthenticatorValues, AuthenticatorVerificationDataValues {
40
+ }
41
+ export interface ProceedOptions extends AuthenticationOptions, RegistrationOptions, PasswordRecoveryOptions, AccountUnlockOptions, EnrollPollOptions, SelectEnrollmentChannelOptions {
42
+ }
43
+ export declare type CancelOptions = IdxOptions;
44
+ export declare type StartOptions = RunOptions;
@@ -9,7 +9,5 @@
9
9
  *
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
- import { IdentifyValues, SelectAuthenticatorUnlockAccountValues, SelectAuthenticatorAuthenticateValues, ChallengeAuthenticatorValues, AuthenticatorVerificationDataValues } from './remediators';
13
- import { OktaAuthInterface, IdxOptions, IdxTransaction } from '../types';
14
- export declare type AccountUnlockOptions = IdxOptions & IdentifyValues & SelectAuthenticatorUnlockAccountValues & SelectAuthenticatorAuthenticateValues & ChallengeAuthenticatorValues & AuthenticatorVerificationDataValues;
12
+ import { OktaAuthInterface, AccountUnlockOptions, IdxTransaction } from '../types';
15
13
  export declare function unlockAccount(authClient: OktaAuthInterface, options?: AccountUnlockOptions): Promise<IdxTransaction>;
@@ -56,3 +56,5 @@ export interface WellKnownResponse {
56
56
  scopes_supported: string[];
57
57
  claims_supported: string[];
58
58
  }
59
+ export declare type OAuthResponseMode = 'okta_post_message' | 'fragment' | 'query' | 'form_post';
60
+ export declare type OAuthResponseType = 'code' | 'token' | 'id_token' | 'refresh_token';