@okta/okta-auth-js 5.9.1 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/README.md +16 -3
  3. package/cjs/AuthStateManager.js +2 -1
  4. package/cjs/AuthStateManager.js.map +1 -1
  5. package/cjs/OktaAuth.js +95 -78
  6. package/cjs/OktaAuth.js.map +1 -1
  7. package/cjs/OktaUserAgent.js +2 -2
  8. package/cjs/OktaUserAgent.js.map +1 -1
  9. package/cjs/PromiseQueue.js +6 -1
  10. package/cjs/PromiseQueue.js.map +1 -1
  11. package/cjs/StorageManager.js +3 -1
  12. package/cjs/StorageManager.js.map +1 -1
  13. package/cjs/TokenManager.js +33 -5
  14. package/cjs/TokenManager.js.map +1 -1
  15. package/cjs/TransactionManager.js +17 -4
  16. package/cjs/TransactionManager.js.map +1 -1
  17. package/cjs/browser/browserStorage.js +7 -5
  18. package/cjs/browser/browserStorage.js.map +1 -1
  19. package/cjs/browser/fingerprint.js +3 -1
  20. package/cjs/browser/fingerprint.js.map +1 -1
  21. package/cjs/builderUtil.js +3 -17
  22. package/cjs/builderUtil.js.map +1 -1
  23. package/cjs/crypto/oidcHash.js.map +1 -1
  24. package/cjs/features.js +9 -3
  25. package/cjs/features.js.map +1 -1
  26. package/cjs/fetch/fetchRequest.js +2 -1
  27. package/cjs/fetch/fetchRequest.js.map +1 -1
  28. package/cjs/http/request.js +2 -0
  29. package/cjs/http/request.js.map +1 -1
  30. package/cjs/idx/authenticate.js +8 -5
  31. package/cjs/idx/authenticate.js.map +1 -1
  32. package/cjs/idx/authenticator/Authenticator.js +14 -0
  33. package/cjs/idx/authenticator/Authenticator.js.map +1 -0
  34. package/cjs/idx/authenticator/OktaPassword.js +31 -0
  35. package/cjs/idx/authenticator/OktaPassword.js.map +1 -0
  36. package/cjs/idx/authenticator/OktaVerifyTotp.js +17 -0
  37. package/cjs/idx/authenticator/OktaVerifyTotp.js.map +1 -0
  38. package/cjs/idx/authenticator/SecurityQuestionEnrollment.js +50 -0
  39. package/cjs/idx/authenticator/SecurityQuestionEnrollment.js.map +1 -0
  40. package/cjs/idx/authenticator/SecurityQuestionVerification.js +32 -0
  41. package/cjs/idx/authenticator/SecurityQuestionVerification.js.map +1 -0
  42. package/cjs/idx/authenticator/VerificationCodeAuthenticator.js +34 -0
  43. package/cjs/idx/authenticator/VerificationCodeAuthenticator.js.map +1 -0
  44. package/cjs/idx/authenticator/getAuthenticator.js +41 -0
  45. package/cjs/idx/authenticator/getAuthenticator.js.map +1 -0
  46. package/cjs/idx/authenticator/index.js +80 -0
  47. package/cjs/idx/authenticator/index.js.map +1 -0
  48. package/cjs/idx/cancel.js +5 -0
  49. package/cjs/idx/cancel.js.map +1 -1
  50. package/cjs/idx/emailVerify.js +73 -0
  51. package/cjs/idx/emailVerify.js.map +1 -0
  52. package/cjs/idx/flow/AuthenticationFlow.js +4 -1
  53. package/cjs/idx/flow/AuthenticationFlow.js.map +1 -1
  54. package/cjs/idx/flow/FlowSpecification.js +16 -14
  55. package/cjs/idx/flow/FlowSpecification.js.map +1 -1
  56. package/cjs/idx/flow/RegistrationFlow.js +3 -0
  57. package/cjs/idx/flow/RegistrationFlow.js.map +1 -1
  58. package/cjs/idx/flow/index.js +0 -52
  59. package/cjs/idx/flow/index.js.map +1 -1
  60. package/cjs/idx/handleInteractionCodeRedirect.js +1 -0
  61. package/cjs/idx/handleInteractionCodeRedirect.js.map +1 -1
  62. package/cjs/idx/index.js +26 -0
  63. package/cjs/idx/index.js.map +1 -1
  64. package/cjs/idx/interact.js +47 -29
  65. package/cjs/idx/interact.js.map +1 -1
  66. package/cjs/idx/introspect.js +12 -14
  67. package/cjs/idx/introspect.js.map +1 -1
  68. package/cjs/idx/poll.js +59 -0
  69. package/cjs/idx/poll.js.map +1 -0
  70. package/cjs/idx/proceed.js +4 -7
  71. package/cjs/idx/proceed.js.map +1 -1
  72. package/cjs/idx/recoverPassword.js +1 -1
  73. package/cjs/idx/recoverPassword.js.map +1 -1
  74. package/cjs/idx/register.js +16 -14
  75. package/cjs/idx/register.js.map +1 -1
  76. package/cjs/idx/remediate.js +55 -92
  77. package/cjs/idx/remediate.js.map +1 -1
  78. package/cjs/idx/remediators/AuthenticatorEnrollmentData.js +11 -12
  79. package/cjs/idx/remediators/AuthenticatorEnrollmentData.js.map +1 -1
  80. package/cjs/idx/remediators/AuthenticatorVerificationData.js +8 -9
  81. package/cjs/idx/remediators/AuthenticatorVerificationData.js.map +1 -1
  82. package/cjs/idx/remediators/Base/AuthenticatorData.js +48 -35
  83. package/cjs/idx/remediators/Base/AuthenticatorData.js.map +1 -1
  84. package/cjs/idx/remediators/Base/Remediator.js +53 -20
  85. package/cjs/idx/remediators/Base/Remediator.js.map +1 -1
  86. package/cjs/idx/remediators/Base/SelectAuthenticator.js +20 -19
  87. package/cjs/idx/remediators/Base/SelectAuthenticator.js.map +1 -1
  88. package/cjs/idx/remediators/Base/VerifyAuthenticator.js +8 -28
  89. package/cjs/idx/remediators/Base/VerifyAuthenticator.js.map +1 -1
  90. package/cjs/idx/remediators/ChallengeAuthenticator.js.map +1 -1
  91. package/cjs/idx/remediators/ChallengePoll.js +26 -0
  92. package/cjs/idx/remediators/ChallengePoll.js.map +1 -0
  93. package/cjs/idx/remediators/EnrollAuthenticator.js.map +1 -1
  94. package/cjs/idx/remediators/EnrollPoll.js +55 -0
  95. package/cjs/idx/remediators/EnrollPoll.js.map +1 -0
  96. package/cjs/idx/remediators/EnrollProfile.js +4 -1
  97. package/cjs/idx/remediators/EnrollProfile.js.map +1 -1
  98. package/cjs/idx/remediators/EnrollmentChannelData.js +80 -0
  99. package/cjs/idx/remediators/EnrollmentChannelData.js.map +1 -0
  100. package/cjs/idx/remediators/Identify.js +2 -35
  101. package/cjs/idx/remediators/Identify.js.map +1 -1
  102. package/cjs/idx/remediators/ReEnrollAuthenticator.js +1 -0
  103. package/cjs/idx/remediators/ReEnrollAuthenticator.js.map +1 -1
  104. package/cjs/idx/remediators/ResetAuthenticator.js.map +1 -1
  105. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js +23 -2
  106. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js.map +1 -1
  107. package/cjs/idx/remediators/SelectAuthenticatorEnroll.js.map +1 -1
  108. package/cjs/idx/remediators/SelectEnrollProfile.js.map +1 -1
  109. package/cjs/idx/remediators/SelectEnrollmentChannel.js +74 -0
  110. package/cjs/idx/remediators/SelectEnrollmentChannel.js.map +1 -0
  111. package/cjs/idx/remediators/Skip.js +7 -0
  112. package/cjs/idx/remediators/Skip.js.map +1 -1
  113. package/cjs/idx/remediators/index.js +52 -0
  114. package/cjs/idx/remediators/index.js.map +1 -1
  115. package/cjs/idx/remediators/util.js +7 -2
  116. package/cjs/idx/remediators/util.js.map +1 -1
  117. package/cjs/idx/run.js +110 -52
  118. package/cjs/idx/run.js.map +1 -1
  119. package/cjs/idx/startTransaction.js +4 -2
  120. package/cjs/idx/startTransaction.js.map +1 -1
  121. package/cjs/idx/transactionMeta.js +82 -69
  122. package/cjs/idx/transactionMeta.js.map +1 -1
  123. package/cjs/idx/types/idx-js.js.map +1 -1
  124. package/cjs/idx/types/index.js +21 -4
  125. package/cjs/idx/types/index.js.map +1 -1
  126. package/cjs/index.js +14 -0
  127. package/cjs/index.js.map +1 -1
  128. package/cjs/oidc/endpoints/authorize.js +2 -0
  129. package/cjs/oidc/endpoints/authorize.js.map +1 -1
  130. package/cjs/oidc/endpoints/token.js +1 -0
  131. package/cjs/oidc/endpoints/token.js.map +1 -1
  132. package/cjs/oidc/exchangeCodeForTokens.js +3 -3
  133. package/cjs/oidc/exchangeCodeForTokens.js.map +1 -1
  134. package/cjs/oidc/getToken.js +3 -1
  135. package/cjs/oidc/getToken.js.map +1 -1
  136. package/cjs/oidc/getWithRedirect.js +10 -37
  137. package/cjs/oidc/getWithRedirect.js.map +1 -1
  138. package/cjs/oidc/handleOAuthResponse.js +80 -86
  139. package/cjs/oidc/handleOAuthResponse.js.map +1 -1
  140. package/cjs/oidc/parseFromUrl.js.map +1 -1
  141. package/cjs/oidc/renewToken.js.map +1 -1
  142. package/cjs/oidc/renewTokens.js +1 -1
  143. package/cjs/oidc/renewTokens.js.map +1 -1
  144. package/cjs/oidc/revokeToken.js +28 -29
  145. package/cjs/oidc/revokeToken.js.map +1 -1
  146. package/cjs/oidc/util/index.js +14 -0
  147. package/cjs/oidc/util/index.js.map +1 -1
  148. package/cjs/oidc/util/loginRedirect.js +6 -1
  149. package/cjs/oidc/util/loginRedirect.js.map +1 -1
  150. package/cjs/oidc/util/oauth.js.map +1 -1
  151. package/cjs/oidc/util/oauthMeta.js +36 -0
  152. package/cjs/oidc/util/oauthMeta.js.map +1 -0
  153. package/cjs/oidc/util/pkce.js.map +1 -1
  154. package/cjs/oidc/util/prepareTokenParams.js +57 -36
  155. package/cjs/oidc/util/prepareTokenParams.js.map +1 -1
  156. package/cjs/oidc/util/validateClaims.js +2 -0
  157. package/cjs/oidc/util/validateClaims.js.map +1 -1
  158. package/cjs/oidc/verifyToken.js +2 -1
  159. package/cjs/oidc/verifyToken.js.map +1 -1
  160. package/cjs/options.js +6 -2
  161. package/cjs/options.js.map +1 -1
  162. package/cjs/server/serverStorage.js +1 -1
  163. package/cjs/server/serverStorage.js.map +1 -1
  164. package/cjs/services/TokenService.js +3 -0
  165. package/cjs/services/TokenService.js.map +1 -1
  166. package/cjs/tx/AuthTransaction.js +3 -0
  167. package/cjs/tx/AuthTransaction.js.map +1 -1
  168. package/cjs/tx/TransactionState.js +0 -17
  169. package/cjs/tx/TransactionState.js.map +1 -1
  170. package/cjs/tx/api.js +3 -2
  171. package/cjs/tx/api.js.map +1 -1
  172. package/cjs/types/Token.js.map +1 -1
  173. package/cjs/types/Transaction.js.map +1 -1
  174. package/cjs/util/index.js +0 -13
  175. package/cjs/util/index.js.map +1 -1
  176. package/cjs/util/url.js.map +1 -1
  177. package/dist/okta-auth-js.min.js +1 -1
  178. package/dist/okta-auth-js.min.js.map +1 -1
  179. package/dist/okta-auth-js.umd.js +1 -1
  180. package/dist/okta-auth-js.umd.js.map +1 -1
  181. package/esm/index.js +2603 -1814
  182. package/esm/index.js.map +1 -1
  183. package/lib/AuthStateManager.d.ts +1 -2
  184. package/lib/OktaAuth.d.ts +4 -10
  185. package/lib/StorageManager.d.ts +1 -1
  186. package/lib/TokenManager.d.ts +4 -2
  187. package/lib/TransactionManager.d.ts +3 -2
  188. package/lib/browser/fingerprint.d.ts +1 -1
  189. package/lib/builderUtil.d.ts +1 -2
  190. package/lib/crypto/browser.d.ts +1 -1
  191. package/lib/features.d.ts +1 -1
  192. package/lib/idx/authenticate.d.ts +1 -1
  193. package/lib/idx/authenticator/Authenticator.d.ts +12 -0
  194. package/lib/idx/authenticator/OktaPassword.d.ts +11 -0
  195. package/lib/idx/authenticator/OktaVerifyTotp.d.ts +9 -0
  196. package/lib/idx/authenticator/SecurityQuestionEnrollment.d.ts +28 -0
  197. package/lib/idx/authenticator/SecurityQuestionVerification.d.ts +14 -0
  198. package/lib/idx/authenticator/VerificationCodeAuthenticator.d.ts +10 -0
  199. package/lib/idx/authenticator/getAuthenticator.d.ts +3 -0
  200. package/lib/idx/authenticator/index.d.ts +6 -0
  201. package/lib/idx/cancel.d.ts +1 -1
  202. package/lib/{util → idx}/emailVerify.d.ts +10 -1
  203. package/lib/idx/flow/FlowSpecification.d.ts +1 -2
  204. package/lib/idx/flow/index.d.ts +0 -4
  205. package/lib/idx/index.d.ts +2 -0
  206. package/lib/idx/interact.d.ts +5 -11
  207. package/lib/idx/introspect.d.ts +3 -2
  208. package/lib/idx/{flow/AuthenticationFlowMonitor.d.ts → poll.d.ts} +3 -5
  209. package/lib/idx/proceed.d.ts +4 -1
  210. package/lib/idx/recoverPassword.d.ts +1 -1
  211. package/lib/idx/register.d.ts +1 -1
  212. package/lib/idx/remediate.d.ts +10 -4
  213. package/lib/idx/remediators/AuthenticatorEnrollmentData.d.ts +12 -8
  214. package/lib/idx/remediators/AuthenticatorVerificationData.d.ts +3 -4
  215. package/lib/idx/remediators/Base/AuthenticatorData.d.ts +13 -8
  216. package/lib/idx/remediators/Base/Remediator.d.ts +9 -6
  217. package/lib/idx/remediators/Base/SelectAuthenticator.d.ts +9 -8
  218. package/lib/idx/remediators/Base/VerifyAuthenticator.d.ts +10 -5
  219. package/lib/idx/{flow/RegistrationFlowMonitor.d.ts → remediators/ChallengePoll.d.ts} +3 -3
  220. package/lib/idx/{flow/PasswordRecoveryFlowMonitor.d.ts → remediators/EnrollPoll.d.ts} +12 -4
  221. package/lib/idx/remediators/EnrollProfile.d.ts +1 -1
  222. package/lib/idx/remediators/EnrollmentChannelData.d.ts +53 -0
  223. package/lib/idx/remediators/Identify.d.ts +2 -5
  224. package/lib/idx/remediators/ReEnrollAuthenticator.d.ts +2 -2
  225. package/lib/idx/remediators/RedirectIdp.d.ts +3 -3
  226. package/lib/idx/remediators/SelectAuthenticatorAuthenticate.d.ts +6 -2
  227. package/lib/idx/remediators/SelectEnrollmentChannel.d.ts +39 -0
  228. package/lib/idx/remediators/Skip.d.ts +3 -0
  229. package/lib/idx/remediators/index.d.ts +4 -0
  230. package/lib/idx/remediators/util.d.ts +2 -2
  231. package/lib/idx/run.d.ts +4 -3
  232. package/lib/idx/startTransaction.d.ts +3 -2
  233. package/lib/idx/transactionMeta.d.ts +6 -27
  234. package/lib/idx/types/idx-js.d.ts +57 -2
  235. package/lib/idx/types/index.d.ts +25 -8
  236. package/lib/index.d.ts +1 -0
  237. package/lib/oidc/exchangeCodeForTokens.d.ts +12 -0
  238. package/lib/oidc/getWithRedirect.d.ts +1 -1
  239. package/lib/oidc/handleOAuthResponse.d.ts +1 -1
  240. package/lib/oidc/parseFromUrl.d.ts +1 -1
  241. package/lib/oidc/renewToken.d.ts +1 -1
  242. package/lib/oidc/renewTokens.d.ts +1 -1
  243. package/lib/oidc/util/browser.d.ts +1 -1
  244. package/lib/oidc/util/errors.d.ts +1 -1
  245. package/lib/oidc/util/index.d.ts +1 -0
  246. package/lib/oidc/util/oauth.d.ts +1 -8
  247. package/lib/oidc/util/oauthMeta.d.ts +2 -0
  248. package/lib/oidc/util/prepareTokenParams.d.ts +3 -0
  249. package/lib/server/serverStorage.d.ts +1 -1
  250. package/lib/services/TokenService.d.ts +2 -2
  251. package/lib/tx/AuthTransaction.d.ts +2 -2
  252. package/lib/tx/TransactionState.d.ts +11 -1
  253. package/lib/tx/api.d.ts +6 -6
  254. package/lib/types/OktaAuthOptions.d.ts +6 -6
  255. package/lib/types/Storage.d.ts +3 -3
  256. package/lib/types/Token.d.ts +1 -0
  257. package/lib/types/Transaction.d.ts +11 -0
  258. package/lib/types/UserClaims.d.ts +3 -3
  259. package/lib/types/api.d.ts +31 -17
  260. package/lib/util/console.d.ts +1 -1
  261. package/lib/util/index.d.ts +0 -1
  262. package/lib/util/types.d.ts +1 -1
  263. package/lib/util/url.d.ts +2 -2
  264. package/package.json +6 -8
  265. package/cjs/idx/flow/AuthenticationFlowMonitor.js +0 -45
  266. package/cjs/idx/flow/AuthenticationFlowMonitor.js.map +0 -1
  267. package/cjs/idx/flow/FlowMonitor.js +0 -69
  268. package/cjs/idx/flow/FlowMonitor.js.map +0 -1
  269. package/cjs/idx/flow/PasswordRecoveryFlowMonitor.js +0 -55
  270. package/cjs/idx/flow/PasswordRecoveryFlowMonitor.js.map +0 -1
  271. package/cjs/idx/flow/RegistrationFlowMonitor.js +0 -35
  272. package/cjs/idx/flow/RegistrationFlowMonitor.js.map +0 -1
  273. package/cjs/util/emailVerify.js +0 -28
  274. package/cjs/util/emailVerify.js.map +0 -1
  275. package/lib/idx/flow/FlowMonitor.d.ts +0 -23
@@ -10,19 +10,24 @@
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
12
  import { Remediator, RemediationValues } from './Remediator';
13
+ import { Authenticator } from '../../authenticator';
14
+ import { IdxRemediation } from '../../types/idx-js';
13
15
  export interface VerifyAuthenticatorValues extends RemediationValues {
14
16
  verificationCode?: string;
15
17
  password?: string;
18
+ questionKey?: string;
19
+ question?: string;
20
+ answer?: string;
21
+ otp?: string;
16
22
  }
17
23
  export declare class VerifyAuthenticator extends Remediator {
24
+ authenticator: Authenticator;
18
25
  values: VerifyAuthenticatorValues;
19
26
  map: {
20
- credentials: any[];
27
+ credentials: never[];
21
28
  };
29
+ constructor(remediation: IdxRemediation, values?: RemediationValues);
22
30
  canRemediate(): boolean;
23
- mapCredentials(): {
24
- passcode: string;
25
- };
31
+ mapCredentials(): import("../../authenticator").Credentials;
26
32
  getInputCredentials(input: any): any;
27
- getValuesAfterProceed(): VerifyAuthenticatorValues;
28
33
  }
@@ -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 { FlowMonitor } from './FlowMonitor';
13
- export declare class RegistrationFlowMonitor extends FlowMonitor {
14
- isRemediatorCandidate(remediator: any, remediations?: any, values?: any): boolean;
12
+ import { EnrollPoll } from './EnrollPoll';
13
+ export declare class ChallengePoll extends EnrollPoll {
14
+ static remediationName: string;
15
15
  }
@@ -9,8 +9,16 @@
9
9
  *
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
- import { FlowMonitor } from './FlowMonitor';
13
- export declare class PasswordRecoveryFlowMonitor extends FlowMonitor {
14
- isRemediatorCandidate(remediator: any, remediations?: any, values?: any): boolean;
15
- isFinished(): Promise<boolean>;
12
+ import { Remediator, RemediationValues } from './Base/Remediator';
13
+ import { NextStep } from '../../types';
14
+ import { IdxContext } from '../types/idx-js';
15
+ export interface EnrollPollValues extends RemediationValues {
16
+ startPolling?: boolean;
17
+ }
18
+ export declare class EnrollPoll extends Remediator {
19
+ static remediationName: string;
20
+ values: EnrollPollValues;
21
+ canRemediate(): boolean;
22
+ getNextStep(context?: IdxContext): NextStep;
23
+ getValuesAfterProceed(): EnrollPollValues;
16
24
  }
@@ -19,7 +19,7 @@ export declare class EnrollProfile extends Remediator {
19
19
  static remediationName: string;
20
20
  values: EnrollProfileValues;
21
21
  map: {
22
- userProfile: any[];
22
+ userProfile: never[];
23
23
  };
24
24
  canRemediate(): boolean;
25
25
  mapUserProfile({ form: { value: profileAttributes } }: {
@@ -0,0 +1,53 @@
1
+ /*!
2
+ * Copyright (c) 2021-present, Okta, Inc. and/or its affiliates. All rights reserved.
3
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
+ *
5
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
+ * Unless required by applicable law or agreed to in writing, software
7
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
+ *
10
+ * See the License for the specific language governing permissions and limitations under the License.
11
+ */
12
+ import { Remediator, RemediationValues } from './Base/Remediator';
13
+ import { IdxContext } from '../types/idx-js';
14
+ export declare type EnrollmentChannelDataValues = RemediationValues & {
15
+ email?: string;
16
+ phoneNumber?: string;
17
+ };
18
+ export declare class EnrollmentChannelData extends Remediator {
19
+ static remediationName: string;
20
+ values: EnrollmentChannelDataValues;
21
+ map: {
22
+ email: never[];
23
+ phoneNumber: never[];
24
+ };
25
+ getInputEmail(): {
26
+ name: string;
27
+ type: string;
28
+ required: boolean;
29
+ label: string;
30
+ }[];
31
+ getInputPhoneNumber(): {
32
+ name: string;
33
+ type: string;
34
+ required: boolean;
35
+ label: string;
36
+ }[];
37
+ canRemediate(): boolean;
38
+ getNextStep(context: IdxContext): {
39
+ authenticator: import("../types/idx-js").IdxAuthenticator;
40
+ name: string;
41
+ canSkip?: boolean | undefined;
42
+ canResend?: boolean | undefined;
43
+ inputs?: import("../types").Input[] | undefined;
44
+ options?: import("../types/idx-js").IdxOption[] | undefined;
45
+ poll?: import("../types").IdxPollOptions | undefined;
46
+ };
47
+ getData(): {
48
+ stateHandle: string | undefined;
49
+ email: string | undefined;
50
+ phoneNumber: string | undefined;
51
+ };
52
+ getValuesAfterProceed(): {};
53
+ }
@@ -10,7 +10,6 @@
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
12
  import { Remediator, RemediationValues } from './Base/Remediator';
13
- import { IdxRemediation } from '../types/idx-js';
14
13
  export interface IdentifyValues extends RemediationValues {
15
14
  username?: string;
16
15
  password?: string;
@@ -20,14 +19,12 @@ export declare class Identify extends Remediator {
20
19
  values: IdentifyValues;
21
20
  map: {
22
21
  identifier: string[];
23
- credentials: any[];
22
+ credentials: never[];
24
23
  rememberMe: string[];
25
24
  };
26
- constructor(remediation: IdxRemediation, values?: IdentifyValues);
27
25
  canRemediate(): boolean;
28
26
  mapCredentials(): {
29
- passcode: string;
27
+ passcode: string | undefined;
30
28
  };
31
29
  getInputCredentials(input: any): any;
32
- getValuesAfterProceed(): unknown;
33
30
  }
@@ -17,10 +17,10 @@ export declare class ReEnrollAuthenticator extends Remediator {
17
17
  static remediationName: string;
18
18
  values: ReEnrollAuthenticatorValues;
19
19
  map: {
20
- credentials: any[];
20
+ credentials: never[];
21
21
  };
22
22
  mapCredentials(): {
23
- passcode: string;
23
+ passcode: string | undefined;
24
24
  };
25
25
  getInputCredentials(input: any): any;
26
26
  }
@@ -15,8 +15,8 @@ export declare class RedirectIdp extends Remediator {
15
15
  canRemediate(): boolean;
16
16
  getNextStep(): {
17
17
  name: string;
18
- type: string;
19
- idp: import("../types/idx-js").IdpConfig;
20
- href: string;
18
+ type: string | undefined;
19
+ idp: import("../types/idx-js").IdpConfig | undefined;
20
+ href: string | undefined;
21
21
  };
22
22
  }
@@ -9,9 +9,13 @@
9
9
  *
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
- import { SelectAuthenticator, SelectAuthenticatorValues } from './/Base/SelectAuthenticator';
13
- export declare type SelectAuthenticatorAuthenticateValues = SelectAuthenticatorValues;
12
+ import { SelectAuthenticator, SelectAuthenticatorValues } from './Base/SelectAuthenticator';
13
+ import { IdxRemediation } from '../types/idx-js';
14
+ export declare type SelectAuthenticatorAuthenticateValues = SelectAuthenticatorValues & {
15
+ password?: string;
16
+ };
14
17
  export declare class SelectAuthenticatorAuthenticate extends SelectAuthenticator {
15
18
  static remediationName: string;
16
19
  values: SelectAuthenticatorAuthenticateValues;
20
+ constructor(remediation: IdxRemediation, values?: SelectAuthenticatorValues);
17
21
  }
@@ -0,0 +1,39 @@
1
+ /*!
2
+ * Copyright (c) 2021-present, Okta, Inc. and/or its affiliates. All rights reserved.
3
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
+ *
5
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
+ * Unless required by applicable law or agreed to in writing, software
7
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
+ *
10
+ * See the License for the specific language governing permissions and limitations under the License.
11
+ */
12
+ import { Remediator, RemediationValues } from './Base/Remediator';
13
+ import { IdxRemediationValueForm, IdxOption, IdxContext } from '../types/idx-js';
14
+ export declare type SelectEnrollmentChannelValues = RemediationValues & {
15
+ channel?: string;
16
+ };
17
+ export declare class SelectEnrollmentChannel extends Remediator {
18
+ static remediationName: string;
19
+ values: SelectEnrollmentChannelValues;
20
+ canRemediate(): boolean;
21
+ getNextStep(context: IdxContext): {
22
+ authenticator: import("../types/idx-js").IdxAuthenticator;
23
+ options?: IdxOption[] | undefined;
24
+ name: string;
25
+ canSkip?: boolean | undefined;
26
+ canResend?: boolean | undefined;
27
+ inputs?: import("../types").Input[] | undefined;
28
+ poll?: import("../types").IdxPollOptions | undefined;
29
+ };
30
+ private getChannels;
31
+ getData(): {
32
+ authenticator: {
33
+ id: string | IdxRemediationValueForm | undefined;
34
+ channel: string | undefined;
35
+ };
36
+ stateHandle: string | undefined;
37
+ };
38
+ getValuesAfterProceed(): {};
39
+ }
@@ -16,5 +16,8 @@ export interface SkipValues extends RemediationValues {
16
16
  export declare class Skip extends Remediator {
17
17
  static remediationName: string;
18
18
  values: SkipValues;
19
+ map: {
20
+ skip: string[];
21
+ };
19
22
  canRemediate(): boolean;
20
23
  }
@@ -11,7 +11,11 @@
11
11
  */
12
12
  export * from './Base/Remediator';
13
13
  export * from './EnrollAuthenticator';
14
+ export * from './EnrollPoll';
15
+ export * from './SelectEnrollmentChannel';
16
+ export * from './EnrollmentChannelData';
14
17
  export * from './ChallengeAuthenticator';
18
+ export * from './ChallengePoll';
15
19
  export * from './ResetAuthenticator';
16
20
  export * from './EnrollProfile';
17
21
  export * from './Identify';
@@ -10,7 +10,7 @@
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
12
  import { IdxRemediation, IdxRemediationValue } from '../types/idx-js';
13
- export declare function getAllValues(idxRemediation: IdxRemediation): string[];
14
- export declare function getRequiredValues(idxRemediation: IdxRemediation): any[];
13
+ export declare function getAllValues(idxRemediation: IdxRemediation): string[] | undefined;
14
+ export declare function getRequiredValues(idxRemediation: IdxRemediation): never[] | undefined;
15
15
  export declare function titleCase(str: string): string;
16
16
  export declare function getAuthenticatorFromRemediation(remediation: IdxRemediation): IdxRemediationValue;
package/lib/idx/run.d.ts CHANGED
@@ -9,13 +9,14 @@
9
9
  *
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
- import { FlowMonitor, RemediationFlow } from './flow';
12
+ import { RemediateOptions } from './remediate';
13
+ import { RemediationFlow } from './flow';
13
14
  import { OktaAuth, IdxTransaction, FlowIdentifier } from '../types';
14
15
  import { ProceedOptions } from './proceed';
15
- export declare type RunOptions = ProceedOptions & {
16
+ export declare type RunOptions = ProceedOptions & RemediateOptions & {
16
17
  flow?: FlowIdentifier;
17
18
  remediators?: RemediationFlow;
18
- flowMonitor?: FlowMonitor;
19
19
  actions?: string[];
20
+ withCredentials?: boolean;
20
21
  };
21
22
  export declare function run(authClient: OktaAuth, options?: RunOptions): Promise<IdxTransaction>;
@@ -9,5 +9,6 @@
9
9
  *
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
- import { OktaAuth, IdxOptions, IdxTransaction } from '../types';
13
- export declare function startTransaction(authClient: OktaAuth, options?: IdxOptions): Promise<IdxTransaction>;
12
+ import { RunOptions } from './run';
13
+ import { OktaAuth, IdxTransaction } from '../types';
14
+ export declare function startTransaction(authClient: OktaAuth, options?: RunOptions): Promise<IdxTransaction>;
@@ -10,33 +10,12 @@
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
12
  import { OktaAuth, IdxTransactionMeta, TransactionMetaOptions } from '../types';
13
- export declare function createTransactionMeta(authClient: OktaAuth, options?: TransactionMetaOptions): Promise<{
14
- flow: import("./types/FlowIdentifier").FlowIdentifier;
15
- issuer: string;
16
- pkce: boolean;
17
- clientId: string;
18
- redirectUri: string;
19
- responseType: string | string[];
20
- responseMode: string;
21
- scopes: string[];
22
- state: string;
23
- nonce: string;
24
- urls: {
25
- issuer: any;
26
- authorizeUrl: any;
27
- userinfoUrl: any;
28
- tokenUrl: any;
29
- revokeUrl: any;
30
- logoutUrl: any;
31
- };
32
- ignoreSignature: boolean;
33
- codeVerifier: string;
34
- codeChallengeMethod: string;
35
- codeChallenge: string;
36
- }>;
37
- export declare function transactionMetaExist(authClient: OktaAuth, options?: TransactionMetaOptions): boolean;
38
- export declare function getSavedTransactionMeta(authClient: OktaAuth, options?: TransactionMetaOptions): IdxTransactionMeta;
13
+ export declare function createTransactionMeta(authClient: OktaAuth, options?: TransactionMetaOptions): Promise<IdxTransactionMeta>;
14
+ export declare function hasSavedInteractionHandle(authClient: OktaAuth, options?: TransactionMetaOptions): boolean;
15
+ export declare function getSavedTransactionMeta(authClient: OktaAuth, options?: TransactionMetaOptions): IdxTransactionMeta | undefined;
39
16
  export declare function getTransactionMeta(authClient: OktaAuth, options?: TransactionMetaOptions): Promise<IdxTransactionMeta>;
40
17
  export declare function saveTransactionMeta(authClient: OktaAuth, meta: any): void;
41
18
  export declare function clearTransactionMeta(authClient: OktaAuth): void;
42
- export declare function isTransactionMetaValid(authClient: OktaAuth, meta: any): boolean;
19
+ export declare function isTransactionMetaValid(meta: any, options?: TransactionMetaOptions): boolean;
20
+ export declare function isTransactionMetaValidForFlow(meta: any, flow: any): boolean;
21
+ export declare function isTransactionMetaValidForOptions(meta: any, options: any, keys: any): boolean;
@@ -22,7 +22,24 @@ export interface IdxAuthenticator {
22
22
  complexity?: unknown;
23
23
  age?: unknown;
24
24
  };
25
- contextualData?: unknown;
25
+ contextualData?: {
26
+ enrolledQuestion?: {
27
+ question: string;
28
+ questionKey: string;
29
+ };
30
+ qrcode?: {
31
+ href: string;
32
+ method: string;
33
+ type: string;
34
+ };
35
+ sharedSecret?: string;
36
+ questions?: {
37
+ questionKey: string;
38
+ question: string;
39
+ }[];
40
+ questionKeys?: string[];
41
+ selectedChannel?: string;
42
+ };
26
43
  }
27
44
  export interface IdxForm {
28
45
  value: IdxRemediationValue[];
@@ -38,6 +55,9 @@ export interface IdpConfig {
38
55
  id: string;
39
56
  name: string;
40
57
  }
58
+ export interface IdxRemediationValueForm {
59
+ form: IdxForm;
60
+ }
41
61
  export interface IdxRemediationValue {
42
62
  name: string;
43
63
  type?: string;
@@ -45,7 +65,7 @@ export interface IdxRemediationValue {
45
65
  secret?: boolean;
46
66
  visible?: boolean;
47
67
  mutable?: boolean;
48
- value?: string;
68
+ value?: string | IdxRemediationValueForm;
49
69
  label?: string;
50
70
  form?: IdxForm;
51
71
  options?: IdxOption[];
@@ -66,6 +86,40 @@ export interface IdxRemediation {
66
86
  method?: string;
67
87
  type?: string;
68
88
  accepts?: string;
89
+ refresh?: number;
90
+ }
91
+ export interface IdxContext {
92
+ version: string;
93
+ stateHandle: string;
94
+ expiresAt: string;
95
+ intent: string;
96
+ currentAuthenticator: {
97
+ type: string;
98
+ value: IdxAuthenticator;
99
+ };
100
+ authenticators: {
101
+ type: string;
102
+ value: IdxAuthenticator[];
103
+ };
104
+ authenticatorEnrollments: {
105
+ type: string;
106
+ value: IdxAuthenticator[];
107
+ };
108
+ enrollmentAuthenticator: {
109
+ type: string;
110
+ value: IdxAuthenticator;
111
+ };
112
+ user: {
113
+ type: string;
114
+ value: Record<string, unknown>;
115
+ };
116
+ app: {
117
+ type: string;
118
+ value: Record<string, unknown>;
119
+ };
120
+ messages?: IdxMessages;
121
+ success?: IdxRemediation;
122
+ failure?: IdxRemediation;
69
123
  }
70
124
  export interface IdxMessage {
71
125
  message: string;
@@ -103,5 +157,6 @@ export interface IdxResponse {
103
157
  toPersist: {
104
158
  interactionHandle?: string;
105
159
  };
160
+ context?: IdxContext;
106
161
  }
107
162
  export declare function isIdxResponse(obj: any): obj is IdxResponse;
@@ -13,7 +13,7 @@ import { InteractOptions } from '../interact';
13
13
  import { IntrospectOptions } from '../introspect';
14
14
  import { APIError, Tokens } from '../../types';
15
15
  import { IdxTransactionMeta } from '../../types/Transaction';
16
- import { IdxAuthenticator, IdxMessage, IdxOption, IdxResponse } from './idx-js';
16
+ import { IdxActions, IdxAuthenticator, IdxContext, IdxForm, IdxMessage, IdxOption, IdxRemediation, IdxResponse, RawIdxResponse } from './idx-js';
17
17
  import { FlowIdentifier } from './FlowIdentifier';
18
18
  export { IdxMessage } from './idx-js';
19
19
  export { AuthenticationOptions } from '../authenticate';
@@ -22,6 +22,8 @@ export { PasswordRecoveryOptions } from '../recoverPassword';
22
22
  export { ProceedOptions } from '../proceed';
23
23
  export { CancelOptions } from '../cancel';
24
24
  export { FlowIdentifier };
25
+ export { IdxTransactionMeta };
26
+ export { EmailVerifyCallbackResponse } from '../emailVerify';
25
27
  export declare enum IdxStatus {
26
28
  SUCCESS = "SUCCESS",
27
29
  PENDING = "PENDING",
@@ -32,15 +34,18 @@ export declare enum IdxStatus {
32
34
  export declare enum AuthenticatorKey {
33
35
  OKTA_PASSWORD = "okta_password",
34
36
  OKTA_EMAIL = "okta_email",
35
- OKTA_VERIFIER = "okta_verifier",
36
37
  PHONE_NUMBER = "phone_number",
37
- GOOGLE_AUTHENTICATOR = "google_otp"
38
+ GOOGLE_AUTHENTICATOR = "google_otp",
39
+ SECURITY_QUESTION = "security_question",
40
+ OKTA_VERIFY = "okta_verify"
38
41
  }
39
42
  export declare type Input = {
40
43
  name: string;
41
44
  type?: string;
42
45
  label?: string;
43
- value?: string;
46
+ value?: string | {
47
+ form: IdxForm;
48
+ };
44
49
  secret?: boolean;
45
50
  required?: boolean;
46
51
  };
@@ -51,11 +56,12 @@ export declare type NextStep = {
51
56
  canResend?: boolean;
52
57
  inputs?: Input[];
53
58
  options?: IdxOption[];
59
+ poll?: IdxPollOptions;
54
60
  };
55
61
  export declare enum IdxFeature {
56
- PASSWORD_RECOVERY = 0,
57
- REGISTRATION = 1,
58
- SOCIAL_IDP = 2
62
+ PASSWORD_RECOVERY = "recover-password",
63
+ REGISTRATION = "enroll-profile",
64
+ SOCIAL_IDP = "redirect-idp"
59
65
  }
60
66
  export interface IdxTransaction {
61
67
  status: IdxStatus;
@@ -66,11 +72,22 @@ export interface IdxTransaction {
66
72
  meta?: IdxTransactionMeta;
67
73
  enabledFeatures?: IdxFeature[];
68
74
  availableSteps?: NextStep[];
69
- _idxResponse?: IdxResponse;
75
+ proceed: (remediationName: string, params: unknown) => Promise<IdxResponse>;
76
+ neededToProceed: IdxRemediation[];
77
+ rawIdxState: RawIdxResponse;
78
+ interactionCode?: string;
79
+ actions: IdxActions;
80
+ context: IdxContext;
70
81
  }
71
82
  export declare type IdxOptions = InteractOptions & IntrospectOptions & {
72
83
  flow?: FlowIdentifier;
84
+ exchangeCodeForTokens?: boolean;
85
+ autoRemediate?: boolean;
73
86
  };
87
+ export interface IdxPollOptions {
88
+ required?: boolean;
89
+ refresh?: number;
90
+ }
74
91
  export declare type Authenticator = {
75
92
  key: string;
76
93
  methodType?: string;
package/lib/index.d.ts CHANGED
@@ -13,6 +13,7 @@
13
13
  import * as crypto from './crypto';
14
14
  export { default as OktaAuth } from './OktaAuth';
15
15
  export * from './constants';
16
+ export * from './idx';
16
17
  export * from './types';
17
18
  export * from './tx';
18
19
  export * from './errors';
@@ -1,2 +1,14 @@
1
+ /*!
2
+ * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
3
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
+ *
5
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
+ * Unless required by applicable law or agreed to in writing, software
7
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
+ *
10
+ * See the License for the specific language governing permissions and limitations under the License.
11
+ *
12
+ */
1
13
  import { CustomUrls, OktaAuth, TokenParams, TokenResponse } from '../types';
2
14
  export declare function exchangeCodeForTokens(sdk: OktaAuth, tokenParams: TokenParams, urls?: CustomUrls): Promise<TokenResponse>;
@@ -1,2 +1,2 @@
1
1
  import { OktaAuth, TokenParams } from '../types';
2
- export declare function getWithRedirect(sdk: OktaAuth, options: TokenParams): Promise<void>;
2
+ export declare function getWithRedirect(sdk: OktaAuth, options?: TokenParams): Promise<void>;
@@ -1,2 +1,2 @@
1
1
  import { OktaAuth, OAuthResponse, TokenParams, TokenResponse, CustomUrls } from '../types';
2
- export declare function handleOAuthResponse(sdk: OktaAuth, tokenParams: TokenParams, res: OAuthResponse, urls: CustomUrls): Promise<TokenResponse>;
2
+ export declare function handleOAuthResponse(sdk: OktaAuth, tokenParams: TokenParams, res: OAuthResponse, urls?: CustomUrls): Promise<TokenResponse>;
@@ -2,4 +2,4 @@ import { ParseFromUrlOptions, TokenResponse, OAuthResponse } from '../types';
2
2
  export declare function getResponseMode(sdk: any): 'query' | 'fragment';
3
3
  export declare function parseOAuthResponseFromUrl(sdk: any, options: string | ParseFromUrlOptions): OAuthResponse;
4
4
  export declare function cleanOAuthResponseFromUrl(sdk: any, options: ParseFromUrlOptions): void;
5
- export declare function parseFromUrl(sdk: any, options: string | ParseFromUrlOptions): Promise<TokenResponse>;
5
+ export declare function parseFromUrl(sdk: any, options?: string | ParseFromUrlOptions): Promise<TokenResponse>;
@@ -1,2 +1,2 @@
1
1
  import { OktaAuth, Token } from '../types';
2
- export declare function renewToken(sdk: OktaAuth, token: Token): Promise<Token>;
2
+ export declare function renewToken(sdk: OktaAuth, token: Token): Promise<Token | undefined>;
@@ -1,2 +1,2 @@
1
1
  import { TokenParams, Tokens } from '../types';
2
- export declare function renewTokens(sdk: any, options: TokenParams): Promise<Tokens>;
2
+ export declare function renewTokens(sdk: any, options?: TokenParams): Promise<Tokens>;
@@ -2,5 +2,5 @@ import { OktaAuth } from '../../types';
2
2
  export declare function addListener(eventTarget: any, name: any, fn: any): void;
3
3
  export declare function removeListener(eventTarget: any, name: any, fn: any): void;
4
4
  export declare function loadFrame(src: any): HTMLIFrameElement;
5
- export declare function loadPopup(src: any, options: any): Window;
5
+ export declare function loadPopup(src: any, options: any): Window | null;
6
6
  export declare function addPostMessageListener(sdk: OktaAuth, timeout: any, state: any): Promise<unknown>;
@@ -11,4 +11,4 @@
11
11
  */
12
12
  import { OktaAuth } from '../../types';
13
13
  export declare function isInteractionRequiredError(error: Error): boolean;
14
- export declare function isAuthorizationCodeError(sdk: OktaAuth, error: Error): boolean;
14
+ export declare function isAuthorizationCodeError(sdk: OktaAuth, error: Error): boolean | undefined;
@@ -15,6 +15,7 @@ export * from './defaultTokenParams';
15
15
  export * from './errors';
16
16
  export * from './loginRedirect';
17
17
  export * from './oauth';
18
+ export * from './oauthMeta';
18
19
  import pkce from './pkce';
19
20
  export { pkce };
20
21
  export * from './prepareTokenParams';
@@ -3,11 +3,4 @@ export declare function generateState(): string;
3
3
  export declare function generateNonce(): string;
4
4
  export declare function getOAuthBaseUrl(sdk: OktaAuth, options?: CustomUrls): any;
5
5
  export declare function getOAuthDomain(sdk: OktaAuth, options?: CustomUrls): any;
6
- export declare function getOAuthUrls(sdk: OktaAuth, options?: CustomUrls): {
7
- issuer: any;
8
- authorizeUrl: any;
9
- userinfoUrl: any;
10
- tokenUrl: any;
11
- revokeUrl: any;
12
- logoutUrl: any;
13
- };
6
+ export declare function getOAuthUrls(sdk: OktaAuth, options?: CustomUrls): CustomUrls;
@@ -0,0 +1,2 @@
1
+ import { OAuthTransactionMeta, OktaAuth, PKCETransactionMeta, TokenParams } from '../../types';
2
+ export declare function createOAuthMeta(sdk: OktaAuth, tokenParams: TokenParams): OAuthTransactionMeta | PKCETransactionMeta;
@@ -1,2 +1,5 @@
1
1
  import { OktaAuth, TokenParams } from '../../types';
2
+ export declare function assertPKCESupport(sdk: OktaAuth): void;
3
+ export declare function validateCodeChallengeMethod(sdk: OktaAuth, codeChallengeMethod?: string): Promise<string>;
4
+ export declare function preparePKCE(sdk: OktaAuth, tokenParams: TokenParams): Promise<TokenParams>;
2
5
  export declare function prepareTokenParams(sdk: OktaAuth, tokenParams?: TokenParams): Promise<TokenParams>;
@@ -18,7 +18,7 @@ declare class ServerStorage implements StorageUtil {
18
18
  testStorageType(storageType: StorageType): boolean;
19
19
  getStorageByType(storageType: StorageType): SimpleStorage;
20
20
  findStorageType(): StorageType;
21
- getHttpCache(): any;
21
+ getHttpCache(): null;
22
22
  getStorage(): SimpleStorage;
23
23
  }
24
24
  declare const _default: ServerStorage;
@@ -14,8 +14,8 @@ import { TokenManagerOptions } from '../types';
14
14
  export declare class TokenService {
15
15
  private tokenManager;
16
16
  private options;
17
- private storageListener;
18
- private onTokenExpiredHandler;
17
+ private storageListener?;
18
+ private onTokenExpiredHandler?;
19
19
  private syncTimeout;
20
20
  constructor(tokenManager: TokenManager, options?: TokenManagerOptions);
21
21
  start(): void;