@okta/okta-auth-js 6.0.0 → 6.1.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 (344) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +5 -4
  3. package/cjs/AuthStateManager.js +9 -2
  4. package/cjs/AuthStateManager.js.map +1 -1
  5. package/cjs/OktaAuth.js +67 -27
  6. package/cjs/OktaAuth.js.map +1 -1
  7. package/cjs/OktaUserAgent.js +2 -2
  8. package/cjs/PromiseQueue.js +5 -1
  9. package/cjs/PromiseQueue.js.map +1 -1
  10. package/cjs/SavedObject.js +4 -2
  11. package/cjs/SavedObject.js.map +1 -1
  12. package/cjs/StorageManager.js +13 -8
  13. package/cjs/StorageManager.js.map +1 -1
  14. package/cjs/TokenManager.js +29 -19
  15. package/cjs/TokenManager.js.map +1 -1
  16. package/cjs/TransactionManager.js +9 -3
  17. package/cjs/TransactionManager.js.map +1 -1
  18. package/cjs/browser/browserStorage.js +18 -9
  19. package/cjs/browser/browserStorage.js.map +1 -1
  20. package/cjs/browser/fingerprint.js +9 -3
  21. package/cjs/browser/fingerprint.js.map +1 -1
  22. package/cjs/builderUtil.js +4 -2
  23. package/cjs/builderUtil.js.map +1 -1
  24. package/cjs/clock.js +5 -1
  25. package/cjs/clock.js.map +1 -1
  26. package/cjs/crypto/base64.js +18 -0
  27. package/cjs/crypto/base64.js.map +1 -1
  28. package/cjs/crypto/index.js +6 -4
  29. package/cjs/crypto/index.js.map +1 -1
  30. package/cjs/crypto/oidcHash.js +5 -1
  31. package/cjs/crypto/oidcHash.js.map +1 -1
  32. package/cjs/crypto/webauthn.js +101 -0
  33. package/cjs/crypto/webauthn.js.map +1 -0
  34. package/cjs/crypto/webcrypto.js +3 -1
  35. package/cjs/crypto/webcrypto.js.map +1 -1
  36. package/cjs/errors/AuthApiError.js +1 -1
  37. package/cjs/errors/AuthPollStopError.js +1 -1
  38. package/cjs/errors/AuthSdkError.js +1 -1
  39. package/cjs/errors/CustomError.js +5 -1
  40. package/cjs/errors/CustomError.js.map +1 -1
  41. package/cjs/errors/OAuthError.js +1 -1
  42. package/cjs/errors/index.js +1 -1
  43. package/cjs/fetch/fetchRequest.js +18 -6
  44. package/cjs/fetch/fetchRequest.js.map +1 -1
  45. package/cjs/http/headers.js.map +1 -1
  46. package/cjs/http/index.js +4 -2
  47. package/cjs/http/index.js.map +1 -1
  48. package/cjs/http/request.js +9 -5
  49. package/cjs/http/request.js.map +1 -1
  50. package/cjs/idx/authenticate.js.map +1 -1
  51. package/cjs/idx/authenticator/Authenticator.js.map +1 -1
  52. package/cjs/idx/authenticator/OktaPassword.js.map +1 -1
  53. package/cjs/idx/authenticator/SecurityQuestionEnrollment.js +1 -1
  54. package/cjs/idx/authenticator/SecurityQuestionEnrollment.js.map +1 -1
  55. package/cjs/idx/authenticator/SecurityQuestionVerification.js +1 -1
  56. package/cjs/idx/authenticator/SecurityQuestionVerification.js.map +1 -1
  57. package/cjs/idx/authenticator/VerificationCodeAuthenticator.js +1 -1
  58. package/cjs/idx/authenticator/VerificationCodeAuthenticator.js.map +1 -1
  59. package/cjs/idx/authenticator/WebauthnEnrollment.js +46 -0
  60. package/cjs/idx/authenticator/WebauthnEnrollment.js.map +1 -0
  61. package/cjs/idx/authenticator/WebauthnVerification.js +55 -0
  62. package/cjs/idx/authenticator/WebauthnVerification.js.map +1 -0
  63. package/cjs/idx/authenticator/getAuthenticator.js +13 -1
  64. package/cjs/idx/authenticator/getAuthenticator.js.map +1 -1
  65. package/cjs/idx/authenticator/index.js +34 -6
  66. package/cjs/idx/authenticator/index.js.map +1 -1
  67. package/cjs/idx/cancel.js.map +1 -1
  68. package/cjs/idx/emailVerify.js +1 -1
  69. package/cjs/idx/emailVerify.js.map +1 -1
  70. package/cjs/idx/flow/AccountUnlockFlow.js +30 -0
  71. package/cjs/idx/flow/AccountUnlockFlow.js.map +1 -0
  72. package/cjs/idx/flow/FlowSpecification.js +8 -0
  73. package/cjs/idx/flow/FlowSpecification.js.map +1 -1
  74. package/cjs/idx/flow/PasswordRecoveryFlow.js +4 -1
  75. package/cjs/idx/flow/PasswordRecoveryFlow.js.map +1 -1
  76. package/cjs/idx/flow/index.js +20 -5
  77. package/cjs/idx/flow/index.js.map +1 -1
  78. package/cjs/idx/handleInteractionCodeRedirect.js +5 -1
  79. package/cjs/idx/handleInteractionCodeRedirect.js.map +1 -1
  80. package/cjs/idx/headers.js +21 -5
  81. package/cjs/idx/headers.js.map +1 -1
  82. package/cjs/idx/idx-js/client.js +91 -0
  83. package/cjs/idx/idx-js/client.js.map +1 -0
  84. package/cjs/idx/idx-js/index.js +162 -0
  85. package/cjs/idx/idx-js/index.js.map +1 -0
  86. package/cjs/idx/idx-js/interact.js +83 -0
  87. package/cjs/idx/idx-js/interact.js.map +1 -0
  88. package/cjs/idx/idx-js/introspect.js +58 -0
  89. package/cjs/idx/idx-js/introspect.js.map +1 -0
  90. package/cjs/idx/idx-js/parsers.js +41 -0
  91. package/cjs/idx/idx-js/parsers.js.map +1 -0
  92. package/cjs/idx/idx-js/util.js +34 -0
  93. package/cjs/idx/idx-js/util.js.map +1 -0
  94. package/cjs/idx/idx-js/v1/actionParser.js +90 -0
  95. package/cjs/idx/idx-js/v1/actionParser.js.map +1 -0
  96. package/cjs/idx/idx-js/v1/generateIdxAction.js +117 -0
  97. package/cjs/idx/idx-js/v1/generateIdxAction.js.map +1 -0
  98. package/cjs/idx/idx-js/v1/idxResponseParser.js +137 -0
  99. package/cjs/idx/idx-js/v1/idxResponseParser.js.map +1 -0
  100. package/cjs/idx/idx-js/v1/makeIdxState.js +64 -0
  101. package/cjs/idx/idx-js/v1/makeIdxState.js.map +1 -0
  102. package/cjs/idx/idx-js/v1/parsers.js +24 -0
  103. package/cjs/idx/idx-js/v1/parsers.js.map +1 -0
  104. package/cjs/idx/idx-js/v1/remediationParser.js +32 -0
  105. package/cjs/idx/idx-js/v1/remediationParser.js.map +1 -0
  106. package/cjs/idx/index.js +120 -121
  107. package/cjs/idx/index.js.map +1 -1
  108. package/cjs/idx/interact.js +9 -4
  109. package/cjs/idx/interact.js.map +1 -1
  110. package/cjs/idx/introspect.js +6 -6
  111. package/cjs/idx/introspect.js.map +1 -1
  112. package/cjs/idx/poll.js +13 -3
  113. package/cjs/idx/poll.js.map +1 -1
  114. package/cjs/idx/proceed.js.map +1 -1
  115. package/cjs/idx/recoverPassword.js.map +1 -1
  116. package/cjs/idx/register.js +5 -1
  117. package/cjs/idx/register.js.map +1 -1
  118. package/cjs/idx/remediate.js +60 -29
  119. package/cjs/idx/remediate.js.map +1 -1
  120. package/cjs/idx/remediators/AuthenticatorEnrollmentData.js +10 -4
  121. package/cjs/idx/remediators/AuthenticatorEnrollmentData.js.map +1 -1
  122. package/cjs/idx/remediators/AuthenticatorVerificationData.js +10 -6
  123. package/cjs/idx/remediators/AuthenticatorVerificationData.js.map +1 -1
  124. package/cjs/idx/remediators/Base/AuthenticatorData.js +28 -12
  125. package/cjs/idx/remediators/Base/AuthenticatorData.js.map +1 -1
  126. package/cjs/idx/remediators/Base/Remediator.js +65 -31
  127. package/cjs/idx/remediators/Base/Remediator.js.map +1 -1
  128. package/cjs/idx/remediators/Base/SelectAuthenticator.js +42 -27
  129. package/cjs/idx/remediators/Base/SelectAuthenticator.js.map +1 -1
  130. package/cjs/idx/remediators/Base/VerifyAuthenticator.js +16 -4
  131. package/cjs/idx/remediators/Base/VerifyAuthenticator.js.map +1 -1
  132. package/cjs/idx/remediators/ChallengeAuthenticator.js +2 -2
  133. package/cjs/idx/remediators/ChallengePoll.js +2 -2
  134. package/cjs/idx/remediators/EnrollAuthenticator.js +2 -2
  135. package/cjs/idx/remediators/EnrollPoll.js +16 -6
  136. package/cjs/idx/remediators/EnrollPoll.js.map +1 -1
  137. package/cjs/idx/remediators/EnrollProfile.js +20 -8
  138. package/cjs/idx/remediators/EnrollProfile.js.map +1 -1
  139. package/cjs/idx/remediators/EnrollmentChannelData.js +25 -9
  140. package/cjs/idx/remediators/EnrollmentChannelData.js.map +1 -1
  141. package/cjs/idx/remediators/Identify.js +5 -3
  142. package/cjs/idx/remediators/Identify.js.map +1 -1
  143. package/cjs/idx/remediators/ReEnrollAuthenticator.js +5 -3
  144. package/cjs/idx/remediators/ReEnrollAuthenticator.js.map +1 -1
  145. package/cjs/idx/remediators/RedirectIdp.js +2 -2
  146. package/cjs/idx/remediators/ResetAuthenticator.js +2 -2
  147. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js +6 -4
  148. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js.map +1 -1
  149. package/cjs/idx/remediators/SelectAuthenticatorEnroll.js +2 -2
  150. package/cjs/idx/remediators/SelectAuthenticatorUnlockAccount.js +72 -0
  151. package/cjs/idx/remediators/SelectAuthenticatorUnlockAccount.js.map +1 -0
  152. package/cjs/idx/remediators/SelectEnrollProfile.js +2 -2
  153. package/cjs/idx/remediators/SelectEnrollmentChannel.js +22 -10
  154. package/cjs/idx/remediators/SelectEnrollmentChannel.js.map +1 -1
  155. package/cjs/idx/remediators/Skip.js +5 -3
  156. package/cjs/idx/remediators/Skip.js.map +1 -1
  157. package/cjs/idx/remediators/index.js +33 -18
  158. package/cjs/idx/remediators/index.js.map +1 -1
  159. package/cjs/idx/remediators/util.js +13 -3
  160. package/cjs/idx/remediators/util.js.map +1 -1
  161. package/cjs/idx/run.js +30 -6
  162. package/cjs/idx/run.js.map +1 -1
  163. package/cjs/idx/startTransaction.js.map +1 -1
  164. package/cjs/idx/transactionMeta.js.map +1 -1
  165. package/cjs/idx/types/idx-js.js.map +1 -1
  166. package/cjs/idx/types/index.js +45 -9
  167. package/cjs/idx/types/index.js.map +1 -1
  168. package/cjs/idx/unlockAccount.js +48 -0
  169. package/cjs/idx/unlockAccount.js.map +1 -0
  170. package/cjs/index.js +20 -14
  171. package/cjs/index.js.map +1 -1
  172. package/cjs/oidc/endpoints/authorize.js +8 -2
  173. package/cjs/oidc/endpoints/authorize.js.map +1 -1
  174. package/cjs/oidc/endpoints/index.js +5 -3
  175. package/cjs/oidc/endpoints/index.js.map +1 -1
  176. package/cjs/oidc/endpoints/token.js +15 -3
  177. package/cjs/oidc/endpoints/token.js.map +1 -1
  178. package/cjs/oidc/endpoints/well-known.js +7 -3
  179. package/cjs/oidc/endpoints/well-known.js.map +1 -1
  180. package/cjs/oidc/exchangeCodeForTokens.js +10 -2
  181. package/cjs/oidc/exchangeCodeForTokens.js.map +1 -1
  182. package/cjs/oidc/getToken.js +9 -5
  183. package/cjs/oidc/getToken.js.map +1 -1
  184. package/cjs/oidc/getUserInfo.js +7 -3
  185. package/cjs/oidc/getUserInfo.js.map +1 -1
  186. package/cjs/oidc/getWithPopup.js +8 -2
  187. package/cjs/oidc/getWithPopup.js.map +1 -1
  188. package/cjs/oidc/getWithRedirect.js +5 -1
  189. package/cjs/oidc/getWithRedirect.js.map +1 -1
  190. package/cjs/oidc/getWithoutPrompt.js +8 -2
  191. package/cjs/oidc/getWithoutPrompt.js.map +1 -1
  192. package/cjs/oidc/handleOAuthResponse.js +9 -3
  193. package/cjs/oidc/handleOAuthResponse.js.map +1 -1
  194. package/cjs/oidc/index.js +4 -2
  195. package/cjs/oidc/index.js.map +1 -1
  196. package/cjs/oidc/parseFromUrl.js +9 -3
  197. package/cjs/oidc/parseFromUrl.js.map +1 -1
  198. package/cjs/oidc/renewToken.js.map +1 -1
  199. package/cjs/oidc/renewTokens.js +5 -1
  200. package/cjs/oidc/renewTokens.js.map +1 -1
  201. package/cjs/oidc/renewTokensWithRefresh.js +5 -1
  202. package/cjs/oidc/renewTokensWithRefresh.js.map +1 -1
  203. package/cjs/oidc/revokeToken.js +7 -3
  204. package/cjs/oidc/revokeToken.js.map +1 -1
  205. package/cjs/oidc/util/browser.js +5 -1
  206. package/cjs/oidc/util/browser.js.map +1 -1
  207. package/cjs/oidc/util/defaultTokenParams.js.map +1 -1
  208. package/cjs/oidc/util/errors.js.map +1 -1
  209. package/cjs/oidc/util/index.js +14 -12
  210. package/cjs/oidc/util/index.js.map +1 -1
  211. package/cjs/oidc/util/loginRedirect.js +5 -1
  212. package/cjs/oidc/util/loginRedirect.js.map +1 -1
  213. package/cjs/oidc/util/oauth.js +4 -2
  214. package/cjs/oidc/util/oauth.js.map +1 -1
  215. package/cjs/oidc/util/oauthMeta.js.map +1 -1
  216. package/cjs/oidc/util/pkce.js +11 -3
  217. package/cjs/oidc/util/pkce.js.map +1 -1
  218. package/cjs/oidc/util/prepareTokenParams.js +7 -5
  219. package/cjs/oidc/util/prepareTokenParams.js.map +1 -1
  220. package/cjs/oidc/util/validateClaims.js +1 -1
  221. package/cjs/oidc/util/validateClaims.js.map +1 -1
  222. package/cjs/oidc/verifyToken.js +11 -3
  223. package/cjs/oidc/verifyToken.js.map +1 -1
  224. package/cjs/options.js +6 -4
  225. package/cjs/options.js.map +1 -1
  226. package/cjs/server/serverStorage.js +1 -0
  227. package/cjs/server/serverStorage.js.map +1 -1
  228. package/cjs/tx/AuthTransaction.js +15 -9
  229. package/cjs/tx/AuthTransaction.js.map +1 -1
  230. package/cjs/tx/api.js +8 -4
  231. package/cjs/tx/api.js.map +1 -1
  232. package/cjs/tx/index.js +7 -5
  233. package/cjs/tx/index.js.map +1 -1
  234. package/cjs/tx/poll.js +6 -4
  235. package/cjs/tx/poll.js.map +1 -1
  236. package/cjs/tx/util.js +5 -1
  237. package/cjs/tx/util.js.map +1 -1
  238. package/cjs/types/Transaction.js +10 -2
  239. package/cjs/types/Transaction.js.map +1 -1
  240. package/cjs/types/index.js +16 -14
  241. package/cjs/types/index.js.map +1 -1
  242. package/cjs/util/index.js +7 -5
  243. package/cjs/util/index.js.map +1 -1
  244. package/cjs/util/misc.js +5 -1
  245. package/cjs/util/misc.js.map +1 -1
  246. package/cjs/util/object.js +16 -6
  247. package/cjs/util/object.js.map +1 -1
  248. package/cjs/util/sharedStorage.js +5 -1
  249. package/cjs/util/sharedStorage.js.map +1 -1
  250. package/dist/okta-auth-js.min.js +1 -1
  251. package/dist/okta-auth-js.min.js.LICENSE.txt +0 -12
  252. package/dist/okta-auth-js.min.js.map +1 -1
  253. package/dist/okta-auth-js.polyfill.js +1 -1
  254. package/dist/okta-auth-js.polyfill.js.map +1 -1
  255. package/dist/okta-auth-js.umd.js +1 -1
  256. package/dist/okta-auth-js.umd.js.LICENSE.txt +0 -12
  257. package/dist/okta-auth-js.umd.js.map +1 -1
  258. package/esm/index.js +1601 -377
  259. package/esm/index.js.map +1 -1
  260. package/lib/OktaAuth.d.ts +6 -3
  261. package/lib/StorageManager.d.ts +1 -1
  262. package/lib/TokenManager.d.ts +2 -2
  263. package/lib/TransactionManager.d.ts +1 -1
  264. package/lib/browser/fingerprint.d.ts +2 -3
  265. package/lib/crypto/base64.d.ts +2 -0
  266. package/lib/crypto/webauthn.d.ts +25 -0
  267. package/lib/http/headers.d.ts +2 -2
  268. package/lib/http/request.d.ts +4 -4
  269. package/lib/idx/authenticate.d.ts +2 -2
  270. package/lib/idx/authenticator/Authenticator.d.ts +4 -5
  271. package/lib/idx/authenticator/OktaPassword.d.ts +7 -9
  272. package/lib/idx/authenticator/SecurityQuestionEnrollment.d.ts +9 -8
  273. package/lib/idx/authenticator/SecurityQuestionVerification.d.ts +7 -7
  274. package/lib/idx/authenticator/VerificationCodeAuthenticator.d.ts +6 -2
  275. package/lib/idx/authenticator/WebauthnEnrollment.d.ts +16 -0
  276. package/lib/idx/authenticator/WebauthnVerification.d.ts +17 -0
  277. package/lib/idx/authenticator/getAuthenticator.d.ts +1 -1
  278. package/lib/idx/authenticator/index.d.ts +9 -0
  279. package/lib/idx/cancel.d.ts +2 -2
  280. package/lib/idx/emailVerify.d.ts +2 -2
  281. package/lib/idx/flow/AccountUnlockFlow.d.ts +13 -0
  282. package/lib/idx/flow/FlowSpecification.d.ts +2 -2
  283. package/lib/idx/flow/index.d.ts +1 -0
  284. package/lib/idx/headers.d.ts +3 -2
  285. package/lib/idx/idx-js/client.d.ts +36 -0
  286. package/lib/idx/idx-js/index.d.ts +51 -0
  287. package/lib/idx/idx-js/interact.d.ts +25 -0
  288. package/lib/idx/idx-js/introspect.d.ts +20 -0
  289. package/lib/idx/idx-js/parsers.d.ts +15 -0
  290. package/lib/idx/idx-js/util.d.ts +12 -0
  291. package/lib/idx/idx-js/v1/actionParser.d.ts +16 -0
  292. package/lib/idx/idx-js/v1/generateIdxAction.d.ts +13 -0
  293. package/lib/idx/idx-js/v1/idxResponseParser.d.ts +20 -0
  294. package/lib/idx/idx-js/v1/makeIdxState.d.ts +13 -0
  295. package/lib/idx/idx-js/v1/parsers.d.ts +16 -0
  296. package/lib/idx/idx-js/v1/remediationParser.d.ts +12 -0
  297. package/lib/idx/index.d.ts +12 -11
  298. package/lib/idx/interact.d.ts +3 -2
  299. package/lib/idx/introspect.d.ts +2 -2
  300. package/lib/idx/poll.d.ts +2 -2
  301. package/lib/idx/proceed.d.ts +5 -4
  302. package/lib/idx/recoverPassword.d.ts +2 -2
  303. package/lib/idx/register.d.ts +2 -2
  304. package/lib/idx/remediators/Base/AuthenticatorData.d.ts +2 -1
  305. package/lib/idx/remediators/Base/Remediator.d.ts +1 -1
  306. package/lib/idx/remediators/Base/SelectAuthenticator.d.ts +3 -0
  307. package/lib/idx/remediators/Base/VerifyAuthenticator.d.ts +7 -12
  308. package/lib/idx/remediators/EnrollmentChannelData.d.ts +1 -0
  309. package/lib/idx/remediators/SelectAuthenticatorUnlockAccount.d.ts +38 -0
  310. package/lib/idx/remediators/SelectEnrollmentChannel.d.ts +1 -0
  311. package/lib/idx/remediators/index.d.ts +1 -0
  312. package/lib/idx/run.d.ts +2 -2
  313. package/lib/idx/startTransaction.d.ts +2 -2
  314. package/lib/idx/transactionMeta.d.ts +7 -7
  315. package/lib/idx/types/FlowIdentifier.d.ts +1 -1
  316. package/lib/idx/types/idx-js.d.ts +36 -0
  317. package/lib/idx/types/index.d.ts +21 -5
  318. package/lib/idx/unlockAccount.d.ts +15 -0
  319. package/lib/oidc/endpoints/well-known.d.ts +3 -3
  320. package/lib/oidc/exchangeCodeForTokens.d.ts +2 -2
  321. package/lib/oidc/getToken.d.ts +2 -2
  322. package/lib/oidc/getWithPopup.d.ts +2 -2
  323. package/lib/oidc/getWithRedirect.d.ts +2 -2
  324. package/lib/oidc/getWithoutPrompt.d.ts +2 -2
  325. package/lib/oidc/handleOAuthResponse.d.ts +2 -2
  326. package/lib/oidc/renewToken.d.ts +2 -2
  327. package/lib/oidc/renewTokensWithRefresh.d.ts +2 -2
  328. package/lib/oidc/revokeToken.d.ts +2 -2
  329. package/lib/oidc/util/browser.d.ts +2 -2
  330. package/lib/oidc/util/defaultTokenParams.d.ts +2 -2
  331. package/lib/oidc/util/errors.d.ts +2 -2
  332. package/lib/oidc/util/loginRedirect.d.ts +4 -4
  333. package/lib/oidc/util/oauth.d.ts +4 -4
  334. package/lib/oidc/util/oauthMeta.d.ts +2 -2
  335. package/lib/oidc/util/prepareTokenParams.d.ts +5 -5
  336. package/lib/oidc/util/validateClaims.d.ts +2 -2
  337. package/lib/oidc/verifyToken.d.ts +2 -2
  338. package/lib/types/OktaAuthOptions.d.ts +1 -2
  339. package/lib/types/Transaction.d.ts +2 -10
  340. package/lib/types/api.d.ts +17 -5
  341. package/lib/types/index.d.ts +0 -1
  342. package/lib/util/sharedStorage.d.ts +1 -1
  343. package/package.json +10 -7
  344. package/polyfill/index.js +1 -0
package/cjs/idx/index.js CHANGED
@@ -1,152 +1,151 @@
1
1
  "use strict";
2
2
 
3
- var _authenticate = require("./authenticate");
4
-
5
- Object.keys(_authenticate).forEach(function (key) {
6
- if (key === "default" || key === "__esModule") return;
7
- if (key in exports && exports[key] === _authenticate[key]) return;
8
- Object.defineProperty(exports, key, {
9
- enumerable: true,
10
- get: function () {
11
- return _authenticate[key];
12
- }
13
- });
3
+ var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
4
+
5
+ var _exportNames = {
6
+ authenticate: true,
7
+ cancel: true,
8
+ handleEmailVerifyCallback: true,
9
+ isEmailVerifyCallback: true,
10
+ parseEmailVerifyCallback: true,
11
+ isEmailVerifyCallbackError: true,
12
+ interact: true,
13
+ introspect: true,
14
+ poll: true,
15
+ proceed: true,
16
+ canProceed: true,
17
+ register: true,
18
+ recoverPassword: true,
19
+ handleInteractionCodeRedirect: true,
20
+ startTransaction: true,
21
+ unlockAccount: true
22
+ };
23
+ Object.defineProperty(exports, "authenticate", {
24
+ enumerable: true,
25
+ get: function () {
26
+ return _authenticate.authenticate;
27
+ }
28
+ });
29
+ Object.defineProperty(exports, "cancel", {
30
+ enumerable: true,
31
+ get: function () {
32
+ return _cancel.cancel;
33
+ }
34
+ });
35
+ Object.defineProperty(exports, "handleEmailVerifyCallback", {
36
+ enumerable: true,
37
+ get: function () {
38
+ return _emailVerify.handleEmailVerifyCallback;
39
+ }
40
+ });
41
+ Object.defineProperty(exports, "isEmailVerifyCallback", {
42
+ enumerable: true,
43
+ get: function () {
44
+ return _emailVerify.isEmailVerifyCallback;
45
+ }
46
+ });
47
+ Object.defineProperty(exports, "parseEmailVerifyCallback", {
48
+ enumerable: true,
49
+ get: function () {
50
+ return _emailVerify.parseEmailVerifyCallback;
51
+ }
52
+ });
53
+ Object.defineProperty(exports, "isEmailVerifyCallbackError", {
54
+ enumerable: true,
55
+ get: function () {
56
+ return _emailVerify.isEmailVerifyCallbackError;
57
+ }
58
+ });
59
+ Object.defineProperty(exports, "interact", {
60
+ enumerable: true,
61
+ get: function () {
62
+ return _interact.interact;
63
+ }
64
+ });
65
+ Object.defineProperty(exports, "introspect", {
66
+ enumerable: true,
67
+ get: function () {
68
+ return _introspect.introspect;
69
+ }
70
+ });
71
+ Object.defineProperty(exports, "poll", {
72
+ enumerable: true,
73
+ get: function () {
74
+ return _poll.poll;
75
+ }
76
+ });
77
+ Object.defineProperty(exports, "proceed", {
78
+ enumerable: true,
79
+ get: function () {
80
+ return _proceed.proceed;
81
+ }
82
+ });
83
+ Object.defineProperty(exports, "canProceed", {
84
+ enumerable: true,
85
+ get: function () {
86
+ return _proceed.canProceed;
87
+ }
88
+ });
89
+ Object.defineProperty(exports, "register", {
90
+ enumerable: true,
91
+ get: function () {
92
+ return _register.register;
93
+ }
94
+ });
95
+ Object.defineProperty(exports, "recoverPassword", {
96
+ enumerable: true,
97
+ get: function () {
98
+ return _recoverPassword.recoverPassword;
99
+ }
100
+ });
101
+ Object.defineProperty(exports, "handleInteractionCodeRedirect", {
102
+ enumerable: true,
103
+ get: function () {
104
+ return _handleInteractionCodeRedirect.handleInteractionCodeRedirect;
105
+ }
106
+ });
107
+ Object.defineProperty(exports, "startTransaction", {
108
+ enumerable: true,
109
+ get: function () {
110
+ return _startTransaction.startTransaction;
111
+ }
112
+ });
113
+ Object.defineProperty(exports, "unlockAccount", {
114
+ enumerable: true,
115
+ get: function () {
116
+ return _unlockAccount.unlockAccount;
117
+ }
14
118
  });
15
119
 
16
- var _cancel = require("./cancel");
120
+ var _authenticate = require("./authenticate");
17
121
 
18
- Object.keys(_cancel).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _cancel[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function () {
24
- return _cancel[key];
25
- }
26
- });
27
- });
122
+ var _cancel = require("./cancel");
28
123
 
29
124
  var _emailVerify = require("./emailVerify");
30
125
 
31
- Object.keys(_emailVerify).forEach(function (key) {
32
- if (key === "default" || key === "__esModule") return;
33
- if (key in exports && exports[key] === _emailVerify[key]) return;
34
- Object.defineProperty(exports, key, {
35
- enumerable: true,
36
- get: function () {
37
- return _emailVerify[key];
38
- }
39
- });
40
- });
41
-
42
126
  var _interact = require("./interact");
43
127
 
44
- Object.keys(_interact).forEach(function (key) {
45
- if (key === "default" || key === "__esModule") return;
46
- if (key in exports && exports[key] === _interact[key]) return;
47
- Object.defineProperty(exports, key, {
48
- enumerable: true,
49
- get: function () {
50
- return _interact[key];
51
- }
52
- });
53
- });
54
-
55
128
  var _introspect = require("./introspect");
56
129
 
57
- Object.keys(_introspect).forEach(function (key) {
58
- if (key === "default" || key === "__esModule") return;
59
- if (key in exports && exports[key] === _introspect[key]) return;
60
- Object.defineProperty(exports, key, {
61
- enumerable: true,
62
- get: function () {
63
- return _introspect[key];
64
- }
65
- });
66
- });
67
-
68
130
  var _poll = require("./poll");
69
131
 
70
- Object.keys(_poll).forEach(function (key) {
71
- if (key === "default" || key === "__esModule") return;
72
- if (key in exports && exports[key] === _poll[key]) return;
73
- Object.defineProperty(exports, key, {
74
- enumerable: true,
75
- get: function () {
76
- return _poll[key];
77
- }
78
- });
79
- });
80
-
81
132
  var _proceed = require("./proceed");
82
133
 
83
- Object.keys(_proceed).forEach(function (key) {
84
- if (key === "default" || key === "__esModule") return;
85
- if (key in exports && exports[key] === _proceed[key]) return;
86
- Object.defineProperty(exports, key, {
87
- enumerable: true,
88
- get: function () {
89
- return _proceed[key];
90
- }
91
- });
92
- });
93
-
94
134
  var _register = require("./register");
95
135
 
96
- Object.keys(_register).forEach(function (key) {
97
- if (key === "default" || key === "__esModule") return;
98
- if (key in exports && exports[key] === _register[key]) return;
99
- Object.defineProperty(exports, key, {
100
- enumerable: true,
101
- get: function () {
102
- return _register[key];
103
- }
104
- });
105
- });
106
-
107
136
  var _recoverPassword = require("./recoverPassword");
108
137
 
109
- Object.keys(_recoverPassword).forEach(function (key) {
110
- if (key === "default" || key === "__esModule") return;
111
- if (key in exports && exports[key] === _recoverPassword[key]) return;
112
- Object.defineProperty(exports, key, {
113
- enumerable: true,
114
- get: function () {
115
- return _recoverPassword[key];
116
- }
117
- });
118
- });
119
-
120
138
  var _handleInteractionCodeRedirect = require("./handleInteractionCodeRedirect");
121
139
 
122
- Object.keys(_handleInteractionCodeRedirect).forEach(function (key) {
123
- if (key === "default" || key === "__esModule") return;
124
- if (key in exports && exports[key] === _handleInteractionCodeRedirect[key]) return;
125
- Object.defineProperty(exports, key, {
126
- enumerable: true,
127
- get: function () {
128
- return _handleInteractionCodeRedirect[key];
129
- }
130
- });
131
- });
132
-
133
140
  var _startTransaction = require("./startTransaction");
134
141
 
135
- Object.keys(_startTransaction).forEach(function (key) {
136
- if (key === "default" || key === "__esModule") return;
137
- if (key in exports && exports[key] === _startTransaction[key]) return;
138
- Object.defineProperty(exports, key, {
139
- enumerable: true,
140
- get: function () {
141
- return _startTransaction[key];
142
- }
143
- });
144
- });
142
+ var _unlockAccount = require("./unlockAccount");
145
143
 
146
144
  var _transactionMeta = require("./transactionMeta");
147
145
 
148
- Object.keys(_transactionMeta).forEach(function (key) {
146
+ _Object$keys(_transactionMeta).forEach(function (key) {
149
147
  if (key === "default" || key === "__esModule") return;
148
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
150
149
  if (key in exports && exports[key] === _transactionMeta[key]) return;
151
150
  Object.defineProperty(exports, key, {
152
151
  enumerable: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/idx/index.ts"],"names":[],"mappings":";;AAaA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nexport * from './authenticate';\nexport * from './cancel';\nexport * from './emailVerify';\nexport * from './interact';\nexport * from './introspect';\nexport * from './poll';\nexport * from './proceed';\nexport * from './register';\nexport * from './recoverPassword';\nexport * from './handleInteractionCodeRedirect';\nexport * from './startTransaction';\nexport * from './transactionMeta';\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../lib/idx/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nexport { authenticate } from './authenticate';\nexport { cancel } from './cancel';\nexport { \n handleEmailVerifyCallback, \n isEmailVerifyCallback, \n parseEmailVerifyCallback, \n isEmailVerifyCallbackError, \n} from './emailVerify';\nexport { interact } from './interact';\nexport { introspect } from './introspect';\nexport { poll } from './poll';\nexport { proceed, canProceed } from './proceed';\nexport { register } from './register';\nexport { recoverPassword } from './recoverPassword';\nexport { handleInteractionCodeRedirect } from './handleInteractionCodeRedirect';\nexport { startTransaction } from './startTransaction';\nexport { unlockAccount } from './unlockAccount';\nexport * from './transactionMeta';\n"],"file":"index.js"}
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
4
 
5
5
  exports.interact = interact;
6
6
 
7
- var _oktaIdxJs = _interopRequireDefault(require("@okta/okta-idx-js"));
7
+ var _idxJs = _interopRequireDefault(require("./idx-js"));
8
8
 
9
9
  var _transactionMeta = require("./transactionMeta");
10
10
 
@@ -64,7 +64,8 @@ async function interact(authClient, options = {}) {
64
64
  activationToken,
65
65
  recoveryToken
66
66
  } = meta;
67
- const interactionHandle = await _oktaIdxJs.default.interact({
67
+ const clientSecret = options.clientSecret || authClient.options.clientSecret;
68
+ const interactionHandle = await _idxJs.default.interact({
68
69
  withCredentials,
69
70
  // OAuth
70
71
  clientId,
@@ -78,7 +79,11 @@ async function interact(authClient, options = {}) {
78
79
  // Activation
79
80
  activationToken,
80
81
  // Recovery
81
- recoveryToken
82
+ recoveryToken,
83
+ // X-Device-Token header need to pair with `client_secret`
84
+ // eslint-disable-next-line max-len
85
+ // https://oktawiki.atlassian.net/wiki/spaces/eng/pages/2445902453/Support+Device+Binding+in+interact#Scenario-1%3A-Non-User-Agent-with-Confidential-Client-(top-priority)
86
+ clientSecret
82
87
  });
83
88
  const newMeta = { ...meta,
84
89
  interactionHandle,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/idx/interact.ts"],"names":["getResponse","meta","interactionHandle","state","interact","authClient","options","baseUrl","clientId","redirectUri","scopes","withCredentials","codeChallenge","codeChallengeMethod","activationToken","recoveryToken","idx","newMeta"],"mappings":";;;;;;AAaA;;AAEA;;AACA;;AACA;;AACA;;AAlBA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AAwBA,SAASA,WAAT,CAAqBC,IAArB,EAAiE;AAC/D,SAAO;AACLA,IAAAA,IADK;AAELC,IAAAA,iBAAiB,EAAED,IAAI,CAACC,iBAFnB;AAGLC,IAAAA,KAAK,EAAEF,IAAI,CAACE;AAHP,GAAP;AAKD,C,CAED;;;AACO,eAAeC,QAAf,CAAyBC,UAAzB,EAA+CC,OAAwB,GAAG,EAA1E,EAAyG;AAAA;;AAC9GA,EAAAA,OAAO,GAAG,sBAAWA,OAAX,CAAV;AAEA,MAAIL,IAAI,GAAG,8CAAwBI,UAAxB,EAAoCC,OAApC,CAAX,CAH8G,CAI9G;;AAEA,eAAIL,IAAJ,kCAAI,MAAMC,iBAAV,EAA6B;AAC3B,WAAOF,WAAW,CAACC,IAAD,CAAlB,CAD2B,CACD;AAC3B,GAR6G,CAU9G;;;AACAA,EAAAA,IAAI,GAAG,MAAM,6BAAsBI,UAAtB,EAAkC,EAAE,GAAGJ,IAAL;AAAW,OAAGK;AAAd,GAAlC,CAAb;AACA,QAAMC,OAAO,GAAG,2BAAgBF,UAAhB,CAAhB;AACA,MAAI;AACFG,IAAAA,QADE;AAEFC,IAAAA,WAFE;AAGFN,IAAAA,KAHE;AAIFO,IAAAA,MAJE;AAKFC,IAAAA,eALE;AAMFC,IAAAA,aANE;AAOFC,IAAAA,mBAPE;AAQFC,IAAAA,eARE;AASFC,IAAAA;AATE,MAUAd,IAVJ;AAYA,QAAMC,iBAAiB,GAAG,MAAMc,mBAAIZ,QAAJ,CAAa;AAC3CO,IAAAA,eAD2C;AAG3C;AACAH,IAAAA,QAJ2C;AAK3CD,IAAAA,OAL2C;AAM3CG,IAAAA,MAN2C;AAO3CP,IAAAA,KAP2C;AAQ3CM,IAAAA,WAR2C;AAU3C;AACAG,IAAAA,aAX2C;AAY3CC,IAAAA,mBAZ2C;AAc3C;AACAC,IAAAA,eAf2C;AAiB3C;AACAC,IAAAA;AAlB2C,GAAb,CAAhC;AAoBA,QAAME,OAAO,GAAG,EACd,GAAGhB,IADW;AAEdC,IAAAA,iBAFc;AAId;AACAS,IAAAA,eALc;AAMdR,IAAAA,KANc;AAOdO,IAAAA,MAPc;AAQdK,IAAAA,aARc;AASdD,IAAAA;AATc,GAAhB,CA7C8G,CAwD9G;;AACA,4CAAoBT,UAApB,EAAgCY,OAAhC;AAEA,SAAOjB,WAAW,CAACiB,OAAD,CAAlB;AACD","sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-assertion */\n/*!\n * Copyright (c) 2021, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n/* eslint complexity:[0,8] */\nimport idx from '@okta/okta-idx-js';\nimport { OktaAuth, IdxTransactionMeta } from '../types';\nimport { getSavedTransactionMeta, saveTransactionMeta } from './transactionMeta';\nimport { getOAuthBaseUrl } from '../oidc';\nimport { createTransactionMeta } from '.';\nimport { removeNils } from '../util';\n\nexport interface InteractOptions {\n withCredentials?: boolean;\n state?: string;\n scopes?: string[];\n codeChallenge?: string;\n codeChallengeMethod?: string;\n activationToken?: string;\n recoveryToken?: string;\n}\n\nexport interface InteractResponse {\n state?: string;\n interactionHandle: string;\n meta: IdxTransactionMeta;\n}\n\nfunction getResponse(meta: IdxTransactionMeta): InteractResponse {\n return {\n meta,\n interactionHandle: meta.interactionHandle!,\n state: meta.state\n };\n}\n\n// Begin or resume a transaction. Returns an interaction handle\nexport async function interact (authClient: OktaAuth, options: InteractOptions = {}): Promise<InteractResponse> {\n options = removeNils(options);\n\n let meta = getSavedTransactionMeta(authClient, options);\n // If meta exists, it has been validated against all options\n\n if (meta?.interactionHandle) {\n return getResponse(meta); // Saved transaction, return meta\n }\n\n // Create new meta, respecting previous meta if it has been set and is not overridden\n meta = await createTransactionMeta(authClient, { ...meta, ...options });\n const baseUrl = getOAuthBaseUrl(authClient);\n let {\n clientId,\n redirectUri,\n state,\n scopes,\n withCredentials,\n codeChallenge,\n codeChallengeMethod,\n activationToken,\n recoveryToken\n } = meta as IdxTransactionMeta;\n\n const interactionHandle = await idx.interact({\n withCredentials,\n\n // OAuth\n clientId, \n baseUrl,\n scopes,\n state,\n redirectUri,\n\n // PKCE\n codeChallenge,\n codeChallengeMethod,\n\n // Activation\n activationToken,\n \n // Recovery\n recoveryToken\n });\n const newMeta = {\n ...meta,\n interactionHandle,\n \n // Options which can be passed into interact() should be saved in the meta\n withCredentials,\n state,\n scopes,\n recoveryToken,\n activationToken\n };\n // Save transaction meta so it can be resumed\n saveTransactionMeta(authClient, newMeta);\n\n return getResponse(newMeta);\n}\n"],"file":"interact.js"}
1
+ {"version":3,"sources":["../../../lib/idx/interact.ts"],"names":["getResponse","meta","interactionHandle","state","interact","authClient","options","baseUrl","clientId","redirectUri","scopes","withCredentials","codeChallenge","codeChallengeMethod","activationToken","recoveryToken","clientSecret","idx","newMeta"],"mappings":";;;;;;AAaA;;AAEA;;AACA;;AACA;;AACA;;AAlBA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AAyBA,SAASA,WAAT,CAAqBC,IAArB,EAAiE;AAC/D,SAAO;AACLA,IAAAA,IADK;AAELC,IAAAA,iBAAiB,EAAED,IAAI,CAACC,iBAFnB;AAGLC,IAAAA,KAAK,EAAEF,IAAI,CAACE;AAHP,GAAP;AAKD,C,CAED;;;AACO,eAAeC,QAAf,CACLC,UADK,EAELC,OAAwB,GAAG,EAFtB,EAGsB;AAAA;;AAC3BA,EAAAA,OAAO,GAAG,sBAAWA,OAAX,CAAV;AAEA,MAAIL,IAAI,GAAG,8CAAwBI,UAAxB,EAAoCC,OAApC,CAAX,CAH2B,CAI3B;;AAEA,eAAIL,IAAJ,kCAAI,MAAMC,iBAAV,EAA6B;AAC3B,WAAOF,WAAW,CAACC,IAAD,CAAlB,CAD2B,CACD;AAC3B,GAR0B,CAU3B;;;AACAA,EAAAA,IAAI,GAAG,MAAM,6BAAsBI,UAAtB,EAAkC,EAAE,GAAGJ,IAAL;AAAW,OAAGK;AAAd,GAAlC,CAAb;AACA,QAAMC,OAAO,GAAG,2BAAgBF,UAAhB,CAAhB;AACA,MAAI;AACFG,IAAAA,QADE;AAEFC,IAAAA,WAFE;AAGFN,IAAAA,KAHE;AAIFO,IAAAA,MAJE;AAKFC,IAAAA,eALE;AAMFC,IAAAA,aANE;AAOFC,IAAAA,mBAPE;AAQFC,IAAAA,eARE;AASFC,IAAAA;AATE,MAUAd,IAVJ;AAWA,QAAMe,YAAY,GAAGV,OAAO,CAACU,YAAR,IAAwBX,UAAU,CAACC,OAAX,CAAmBU,YAAhE;AAEA,QAAMd,iBAAiB,GAAG,MAAMe,eAAIb,QAAJ,CAAa;AAC3CO,IAAAA,eAD2C;AAG3C;AACAH,IAAAA,QAJ2C;AAK3CD,IAAAA,OAL2C;AAM3CG,IAAAA,MAN2C;AAO3CP,IAAAA,KAP2C;AAQ3CM,IAAAA,WAR2C;AAU3C;AACAG,IAAAA,aAX2C;AAY3CC,IAAAA,mBAZ2C;AAc3C;AACAC,IAAAA,eAf2C;AAiB3C;AACAC,IAAAA,aAlB2C;AAoB3C;AACA;AACA;AACAC,IAAAA;AAvB2C,GAAb,CAAhC;AAyBA,QAAME,OAAO,GAAG,EACd,GAAGjB,IADW;AAEdC,IAAAA,iBAFc;AAId;AACAS,IAAAA,eALc;AAMdR,IAAAA,KANc;AAOdO,IAAAA,MAPc;AAQdK,IAAAA,aARc;AASdD,IAAAA;AATc,GAAhB,CAnD2B,CA8D3B;;AACA,4CAAoBT,UAApB,EAAgCa,OAAhC;AAEA,SAAOlB,WAAW,CAACkB,OAAD,CAAlB;AACD","sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-assertion */\n/*!\n * Copyright (c) 2021, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n/* eslint complexity:[0,8] */\nimport idx from './idx-js';\nimport { OktaAuthInterface, IdxTransactionMeta } from '../types';\nimport { getSavedTransactionMeta, saveTransactionMeta } from './transactionMeta';\nimport { getOAuthBaseUrl } from '../oidc';\nimport { createTransactionMeta } from '.';\nimport { removeNils } from '../util';\n\nexport interface InteractOptions {\n withCredentials?: boolean;\n state?: string;\n scopes?: string[];\n codeChallenge?: string;\n codeChallengeMethod?: string;\n activationToken?: string;\n recoveryToken?: string;\n clientSecret?: string;\n}\n\nexport interface InteractResponse {\n state?: string;\n interactionHandle: string;\n meta: IdxTransactionMeta;\n}\n\nfunction getResponse(meta: IdxTransactionMeta): InteractResponse {\n return {\n meta,\n interactionHandle: meta.interactionHandle!,\n state: meta.state\n };\n}\n\n// Begin or resume a transaction. Returns an interaction handle\nexport async function interact (\n authClient: OktaAuthInterface, \n options: InteractOptions = {}\n): Promise<InteractResponse> {\n options = removeNils(options);\n\n let meta = getSavedTransactionMeta(authClient, options);\n // If meta exists, it has been validated against all options\n\n if (meta?.interactionHandle) {\n return getResponse(meta); // Saved transaction, return meta\n }\n\n // Create new meta, respecting previous meta if it has been set and is not overridden\n meta = await createTransactionMeta(authClient, { ...meta, ...options });\n const baseUrl = getOAuthBaseUrl(authClient);\n let {\n clientId,\n redirectUri,\n state,\n scopes,\n withCredentials,\n codeChallenge,\n codeChallengeMethod,\n activationToken,\n recoveryToken,\n } = meta as IdxTransactionMeta;\n const clientSecret = options.clientSecret || authClient.options.clientSecret;\n\n const interactionHandle = await idx.interact({\n withCredentials,\n\n // OAuth\n clientId, \n baseUrl,\n scopes,\n state,\n redirectUri,\n\n // PKCE\n codeChallenge,\n codeChallengeMethod,\n\n // Activation\n activationToken,\n \n // Recovery\n recoveryToken,\n\n // X-Device-Token header need to pair with `client_secret`\n // eslint-disable-next-line max-len\n // https://oktawiki.atlassian.net/wiki/spaces/eng/pages/2445902453/Support+Device+Binding+in+interact#Scenario-1%3A-Non-User-Agent-with-Confidential-Client-(top-priority)\n clientSecret\n });\n const newMeta = {\n ...meta,\n interactionHandle,\n \n // Options which can be passed into interact() should be saved in the meta\n withCredentials,\n state,\n scopes,\n recoveryToken,\n activationToken\n };\n // Save transaction meta so it can be resumed\n saveTransactionMeta(authClient, newMeta);\n\n return getResponse(newMeta);\n}\n"],"file":"interact.js"}
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
4
 
5
5
  exports.introspect = introspect;
6
6
 
7
- var _oktaIdxJs = _interopRequireDefault(require("@okta/okta-idx-js"));
7
+ var _idxJs = _interopRequireDefault(require("./idx-js"));
8
8
 
9
- var _idxJs = require("./types/idx-js");
9
+ var _idxJs2 = require("./types/idx-js");
10
10
 
11
11
  var _oidc = require("../oidc");
12
12
 
@@ -32,13 +32,13 @@ async function introspect(authClient, options = {}) {
32
32
  const domain = (0, _oidc.getOAuthDomain)(authClient);
33
33
 
34
34
  try {
35
- rawIdxResponse = await _oktaIdxJs.default.introspect({
35
+ rawIdxResponse = await _idxJs.default.introspect({
36
36
  domain,
37
37
  ...options,
38
38
  version
39
39
  });
40
40
  } catch (err) {
41
- if ((0, _idxJs.isRawIdxResponse)(err)) {
41
+ if ((0, _idxJs2.isRawIdxResponse)(err)) {
42
42
  rawIdxResponse = err;
43
43
  } else {
44
44
  throw err;
@@ -49,7 +49,7 @@ async function introspect(authClient, options = {}) {
49
49
  const {
50
50
  withCredentials
51
51
  } = options;
52
- return _oktaIdxJs.default.makeIdxState(rawIdxResponse, {
52
+ return _idxJs.default.makeIdxState(rawIdxResponse, {
53
53
  withCredentials
54
54
  });
55
55
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/idx/introspect.ts"],"names":["introspect","authClient","options","rawIdxResponse","transactionManager","loadIdxResponse","version","IDX_API_VERSION","domain","idx","err","withCredentials","makeIdxState"],"mappings":";;;;;;AAYA;;AAEA;;AACA;;AACA;;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAeO,eAAeA,UAAf,CAA2BC,UAA3B,EAAiDC,OAA0B,GAAG,EAA9E,EAAwG;AAC7G;AACA,MAAIC,cAAc,GAAGF,UAAU,CAACG,kBAAX,CAA8BC,eAA9B,EAArB,CAF6G,CAI7G;;AACA,MAAI,CAACF,cAAL,EAAqB;AACnB,UAAMG,OAAO,GAAGJ,OAAO,CAACI,OAAR,IAAmBC,0BAAnC;AACA,UAAMC,MAAM,GAAG,0BAAeP,UAAf,CAAf;;AACA,QAAI;AACFE,MAAAA,cAAc,GAAG,MAAMM,mBAAIT,UAAJ,CAAe;AAAEQ,QAAAA,MAAF;AAAU,WAAGN,OAAb;AAAsBI,QAAAA;AAAtB,OAAf,CAAvB;AACD,KAFD,CAEE,OAAOI,GAAP,EAAY;AACZ,UAAI,6BAAiBA,GAAjB,CAAJ,EAA2B;AACzBP,QAAAA,cAAc,GAAGO,GAAjB;AACD,OAFD,MAEO;AACL,cAAMA,GAAN;AACD;AACF;AACF;;AAED,QAAM;AAAEC,IAAAA;AAAF,MAAsBT,OAA5B;AACA,SAAOO,mBAAIG,YAAJ,CAAiBT,cAAjB,EAAiC;AAAEQ,IAAAA;AAAF,GAAjC,CAAP;AACD","sourcesContent":["/*!\n * Copyright (c) 2021, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport idx from '@okta/okta-idx-js';\nimport { OktaAuth } from '../types';\nimport { IdxResponse, isRawIdxResponse } from './types/idx-js';\nimport { getOAuthDomain } from '../oidc';\nimport { IDX_API_VERSION } from '../constants';\n\nexport interface IntrospectOptions {\n withCredentials?: boolean;\n interactionHandle?: string;\n stateHandle?: string;\n version?: string;\n}\n\nexport async function introspect (authClient: OktaAuth, options: IntrospectOptions = {}): Promise<IdxResponse> {\n // try load from storage first\n let rawIdxResponse = authClient.transactionManager.loadIdxResponse();\n \n // call idx.introspect if no existing idx response available in storage\n if (!rawIdxResponse) {\n const version = options.version || IDX_API_VERSION;\n const domain = getOAuthDomain(authClient);\n try {\n rawIdxResponse = await idx.introspect({ domain, ...options, version });\n } catch (err) {\n if (isRawIdxResponse(err)) {\n rawIdxResponse = err;\n } else {\n throw err;\n }\n }\n }\n\n const { withCredentials } = options;\n return idx.makeIdxState(rawIdxResponse, { withCredentials });\n}\n"],"file":"introspect.js"}
1
+ {"version":3,"sources":["../../../lib/idx/introspect.ts"],"names":["introspect","authClient","options","rawIdxResponse","transactionManager","loadIdxResponse","version","IDX_API_VERSION","domain","idx","err","withCredentials","makeIdxState"],"mappings":";;;;;;AAYA;;AAEA;;AACA;;AACA;;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAeO,eAAeA,UAAf,CACLC,UADK,EAELC,OAA0B,GAAG,EAFxB,EAGiB;AACtB;AACA,MAAIC,cAAc,GAAGF,UAAU,CAACG,kBAAX,CAA8BC,eAA9B,EAArB,CAFsB,CAItB;;AACA,MAAI,CAACF,cAAL,EAAqB;AACnB,UAAMG,OAAO,GAAGJ,OAAO,CAACI,OAAR,IAAmBC,0BAAnC;AACA,UAAMC,MAAM,GAAG,0BAAeP,UAAf,CAAf;;AACA,QAAI;AACFE,MAAAA,cAAc,GAAG,MAAMM,eAAIT,UAAJ,CAAe;AAAEQ,QAAAA,MAAF;AAAU,WAAGN,OAAb;AAAsBI,QAAAA;AAAtB,OAAf,CAAvB;AACD,KAFD,CAEE,OAAOI,GAAP,EAAY;AACZ,UAAI,8BAAiBA,GAAjB,CAAJ,EAA2B;AACzBP,QAAAA,cAAc,GAAGO,GAAjB;AACD,OAFD,MAEO;AACL,cAAMA,GAAN;AACD;AACF;AACF;;AAED,QAAM;AAAEC,IAAAA;AAAF,MAAsBT,OAA5B;AACA,SAAOO,eAAIG,YAAJ,CAAiBT,cAAjB,EAAiC;AAAEQ,IAAAA;AAAF,GAAjC,CAAP;AACD","sourcesContent":["/*!\n * Copyright (c) 2021, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport idx from './idx-js';\nimport { OktaAuthInterface } from '../types';\nimport { IdxResponse, isRawIdxResponse } from './types/idx-js';\nimport { getOAuthDomain } from '../oidc';\nimport { IDX_API_VERSION } from '../constants';\n\nexport interface IntrospectOptions {\n withCredentials?: boolean;\n interactionHandle?: string;\n stateHandle?: string;\n version?: string;\n}\n\nexport async function introspect (\n authClient: OktaAuthInterface, \n options: IntrospectOptions = {}\n): Promise<IdxResponse> {\n // try load from storage first\n let rawIdxResponse = authClient.transactionManager.loadIdxResponse();\n \n // call idx.introspect if no existing idx response available in storage\n if (!rawIdxResponse) {\n const version = options.version || IDX_API_VERSION;\n const domain = getOAuthDomain(authClient);\n try {\n rawIdxResponse = await idx.introspect({ domain, ...options, version });\n } catch (err) {\n if (isRawIdxResponse(err)) {\n rawIdxResponse = err;\n } else {\n throw err;\n }\n }\n }\n\n const { withCredentials } = options;\n return idx.makeIdxState(rawIdxResponse, { withCredentials });\n}\n"],"file":"introspect.js"}
package/cjs/idx/poll.js CHANGED
@@ -1,7 +1,17 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
+
3
5
  exports.poll = poll;
4
6
 
7
+ var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
8
+
9
+ var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
10
+
11
+ var _isInteger = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/number/is-integer"));
12
+
13
+ var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
14
+
5
15
  var _proceed = require("./proceed");
6
16
 
7
17
  var _transactionMeta = require("./transactionMeta");
@@ -26,14 +36,14 @@ async function poll(authClient, options = {}) {
26
36
  startPolling: true
27
37
  });
28
38
  const meta = (0, _transactionMeta.getSavedTransactionMeta)(authClient);
29
- let availablePollingRemeditaions = meta === null || meta === void 0 ? void 0 : (_meta$remediations = meta.remediations) === null || _meta$remediations === void 0 ? void 0 : _meta$remediations.find(remediation => remediation.includes('poll'));
39
+ let availablePollingRemeditaions = meta === null || meta === void 0 ? void 0 : (_meta$remediations = meta.remediations) === null || _meta$remediations === void 0 ? void 0 : (0, _find.default)(_meta$remediations).call(_meta$remediations, remediation => (0, _includes.default)(remediation).call(remediation, 'poll'));
30
40
 
31
41
  if (!(availablePollingRemeditaions !== null && availablePollingRemeditaions !== void 0 && availablePollingRemeditaions.length)) {
32
42
  (0, _util.warn)('No polling remediations available at the current IDX flow stage');
33
43
  }
34
44
 
35
- if (Number.isInteger(options.refresh)) {
36
- return new Promise(function (resolve, reject) {
45
+ if ((0, _isInteger.default)(options.refresh)) {
46
+ return new _promise.default(function (resolve, reject) {
37
47
  setTimeout(async function () {
38
48
  try {
39
49
  var _transaction$nextStep, _transaction$nextStep2;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/idx/poll.ts"],"names":["poll","authClient","options","transaction","startPolling","meta","availablePollingRemeditaions","remediations","find","remediation","includes","length","Number","isInteger","refresh","Promise","resolve","reject","setTimeout","nextStep","err"],"mappings":";;;;AAYA;;AAOA;;AACA;;AApBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAYO,eAAeA,IAAf,CAAoBC,UAApB,EAA0CC,OAAuB,GAAG,EAApE,EAAiG;AAAA;;AACtG,MAAIC,WAAW,GAAG,MAAM,sBAAQF,UAAR,EAAoB;AAC1CG,IAAAA,YAAY,EAAE;AAD4B,GAApB,CAAxB;AAIA,QAAMC,IAAI,GAAG,8CAAwBJ,UAAxB,CAAb;AACA,MAAIK,4BAA4B,GAAGD,IAAH,aAAGA,IAAH,6CAAGA,IAAI,CAAEE,YAAT,uDAAG,mBAAoBC,IAApB,CAAyBC,WAAW,IAAIA,WAAW,CAACC,QAAZ,CAAqB,MAArB,CAAxC,CAAnC;;AACA,MAAI,EAACJ,4BAAD,aAACA,4BAAD,eAACA,4BAA4B,CAAEK,MAA/B,CAAJ,EAA2C;AACzC,oBAAK,iEAAL;AACD;;AAED,MAAIC,MAAM,CAACC,SAAP,CAAiBX,OAAO,CAACY,OAAzB,CAAJ,EAAuC;AACrC,WAAO,IAAIC,OAAJ,CAAY,UAAUC,OAAV,EAAmBC,MAAnB,EAA2B;AAC5CC,MAAAA,UAAU,CAAC,kBAAkB;AAC3B,YAAI;AAAA;;AACF,gBAAMJ,OAAO,4BAAGX,WAAW,CAACgB,QAAf,oFAAG,sBAAsBnB,IAAzB,2DAAG,uBAA4Bc,OAA5C;;AACA,cAAIA,OAAJ,EAAa;AACXE,YAAAA,OAAO,CAAChB,IAAI,CAACC,UAAD,EAAa;AACvBa,cAAAA;AADuB,aAAb,CAAL,CAAP;AAGD,WAJD,MAIO;AACLE,YAAAA,OAAO,CAACb,WAAD,CAAP;AACD;AACF,SATD,CASE,OAAOiB,GAAP,EAAY;AACZH,UAAAA,MAAM,CAACG,GAAD,CAAN;AACD;AACF,OAbS,EAaPlB,OAAO,CAACY,OAbD,CAAV;AAcD,KAfM,CAAP;AAgBD;;AAED,SAAOX,WAAP;AACD","sourcesContent":["/*!\n * Copyright (c) 2021-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { proceed } from './proceed';\n\nimport { \n IdxPollOptions,\n IdxTransaction,\n OktaAuth,\n} from '../types';\nimport { getSavedTransactionMeta } from './transactionMeta';\nimport { warn } from '../util';\n\nexport async function poll(authClient: OktaAuth, options: IdxPollOptions = {}): Promise<IdxTransaction> {\n let transaction = await proceed(authClient, {\n startPolling: true\n });\n\n const meta = getSavedTransactionMeta(authClient);\n let availablePollingRemeditaions = meta?.remediations?.find(remediation => remediation.includes('poll'));\n if (!availablePollingRemeditaions?.length) {\n warn('No polling remediations available at the current IDX flow stage');\n }\n\n if (Number.isInteger(options.refresh)) {\n return new Promise(function (resolve, reject) {\n setTimeout(async function () {\n try {\n const refresh = transaction.nextStep?.poll?.refresh;\n if (refresh) {\n resolve(poll(authClient, {\n refresh\n }));\n } else {\n resolve(transaction);\n }\n } catch (err) {\n reject(err);\n }\n }, options.refresh);\n });\n }\n\n return transaction;\n}\n"],"file":"poll.js"}
1
+ {"version":3,"sources":["../../../lib/idx/poll.ts"],"names":["poll","authClient","options","transaction","startPolling","meta","availablePollingRemeditaions","remediations","remediation","length","refresh","resolve","reject","setTimeout","nextStep","err"],"mappings":";;;;;;;;;;;;;;AAYA;;AAOA;;AACA;;AApBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAYO,eAAeA,IAAf,CAAoBC,UAApB,EAAmDC,OAAuB,GAAG,EAA7E,EAA0G;AAAA;;AAC/G,MAAIC,WAAW,GAAG,MAAM,sBAAQF,UAAR,EAAoB;AAC1CG,IAAAA,YAAY,EAAE;AAD4B,GAApB,CAAxB;AAIA,QAAMC,IAAI,GAAG,8CAAwBJ,UAAxB,CAAb;AACA,MAAIK,4BAA4B,GAAGD,IAAH,aAAGA,IAAH,6CAAGA,IAAI,CAAEE,YAAT,uDAAG,gEAAyBC,WAAW,IAAI,uBAAAA,WAAW,MAAX,CAAAA,WAAW,EAAU,MAAV,CAAnD,CAAnC;;AACA,MAAI,EAACF,4BAAD,aAACA,4BAAD,eAACA,4BAA4B,CAAEG,MAA/B,CAAJ,EAA2C;AACzC,oBAAK,iEAAL;AACD;;AAED,MAAI,wBAAiBP,OAAO,CAACQ,OAAzB,CAAJ,EAAuC;AACrC,WAAO,qBAAY,UAAUC,OAAV,EAAmBC,MAAnB,EAA2B;AAC5CC,MAAAA,UAAU,CAAC,kBAAkB;AAC3B,YAAI;AAAA;;AACF,gBAAMH,OAAO,4BAAGP,WAAW,CAACW,QAAf,oFAAG,sBAAsBd,IAAzB,2DAAG,uBAA4BU,OAA5C;;AACA,cAAIA,OAAJ,EAAa;AACXC,YAAAA,OAAO,CAACX,IAAI,CAACC,UAAD,EAAa;AACvBS,cAAAA;AADuB,aAAb,CAAL,CAAP;AAGD,WAJD,MAIO;AACLC,YAAAA,OAAO,CAACR,WAAD,CAAP;AACD;AACF,SATD,CASE,OAAOY,GAAP,EAAY;AACZH,UAAAA,MAAM,CAACG,GAAD,CAAN;AACD;AACF,OAbS,EAaPb,OAAO,CAACQ,OAbD,CAAV;AAcD,KAfM,CAAP;AAgBD;;AAED,SAAOP,WAAP;AACD","sourcesContent":["/*!\n * Copyright (c) 2021-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { proceed } from './proceed';\n\nimport { \n IdxPollOptions,\n IdxTransaction,\n OktaAuthInterface,\n} from '../types';\nimport { getSavedTransactionMeta } from './transactionMeta';\nimport { warn } from '../util';\n\nexport async function poll(authClient: OktaAuthInterface, options: IdxPollOptions = {}): Promise<IdxTransaction> {\n let transaction = await proceed(authClient, {\n startPolling: true\n });\n\n const meta = getSavedTransactionMeta(authClient);\n let availablePollingRemeditaions = meta?.remediations?.find(remediation => remediation.includes('poll'));\n if (!availablePollingRemeditaions?.length) {\n warn('No polling remediations available at the current IDX flow stage');\n }\n\n if (Number.isInteger(options.refresh)) {\n return new Promise(function (resolve, reject) {\n setTimeout(async function () {\n try {\n const refresh = transaction.nextStep?.poll?.refresh;\n if (refresh) {\n resolve(poll(authClient, {\n refresh\n }));\n } else {\n resolve(transaction);\n }\n } catch (err) {\n reject(err);\n }\n }, options.refresh);\n });\n }\n\n return transaction;\n}\n"],"file":"poll.js"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/idx/proceed.ts"],"names":["canProceed","authClient","options","meta","proceed","state","AuthSdkError","flow"],"mappings":";;;;;AAiBA;;AAQA;;AACA;;AA1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAyBO,SAASA,UAAT,CAAoBC,UAApB,EAA0CC,OAA1C,EAAwE;AAC7E,QAAMC,IAAI,GAAG,8CAAwBF,UAAxB,EAAoCC,OAApC,CAAb;AACA,SAAO,CAAC,CAACC,IAAT;AACD;;AAEM,eAAeC,OAAf,CACLH,UADK,EAELC,OAAuB,GAAG,EAFrB,EAGoB;AACzB,QAAM;AAAEG,IAAAA;AAAF,MAAYH,OAAlB;AACA,QAAMC,IAAI,GAAG,8CAAwBF,UAAxB,EAAoC;AAAEI,IAAAA;AAAF,GAApC,CAAb,CAFyB,CAIzB;;AACA,MAAI,CAACF,IAAL,EAAW;AACT,UAAM,IAAIG,oBAAJ,CAAiB,0DAAjB,CAAN;AACD,GAPwB,CASzB;;;AACA,QAAMC,IAAI,GAAGJ,IAAH,aAAGA,IAAH,uBAAGA,IAAI,CAAEI,IAAnB;AAEA,SAAO,cAAIN,UAAJ,EAAgB,EACrB,GAAGC,OADkB;AAErBK,IAAAA;AAFqB,GAAhB,CAAP;AAID","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { \n OktaAuth,\n IdxTransaction,\n} from '../types';\nimport { run } from './run';\nimport { AuthenticationOptions } from './authenticate';\nimport {\n EnrollPollValues as EnrollPollOptions,\n SelectEnrollmentChannelValues as SelectEnrollmentChannelOptions\n} from './remediators';\nimport { RegistrationOptions } from './register';\nimport { PasswordRecoveryOptions } from './recoverPassword';\nimport { getSavedTransactionMeta } from './transactionMeta';\nimport { AuthSdkError } from '../errors';\n\nexport type ProceedOptions = AuthenticationOptions\n & RegistrationOptions\n & PasswordRecoveryOptions\n & EnrollPollOptions\n & SelectEnrollmentChannelOptions\n & { step?: string };\n\nexport function canProceed(authClient: OktaAuth, options?: { state?: string }) {\n const meta = getSavedTransactionMeta(authClient, options);\n return !!meta;\n}\n\nexport async function proceed(\n authClient: OktaAuth,\n options: ProceedOptions = {}\n): Promise<IdxTransaction> {\n const { state } = options;\n const meta = getSavedTransactionMeta(authClient, { state });\n\n // Proceed always needs saved transaction meta\n if (!meta) {\n throw new AuthSdkError('Unable to proceed: saved transaction could not be loaded');\n }\n\n // Determine the flow specification based on the saved flow\n const flow = meta?.flow;\n\n return run(authClient, { \n ...options, \n flow\n });\n}\n"],"file":"proceed.js"}
1
+ {"version":3,"sources":["../../../lib/idx/proceed.ts"],"names":["canProceed","authClient","options","meta","proceed","state","AuthSdkError","flow"],"mappings":";;;;;AAiBA;;AASA;;AACA;;AA3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA2BO,SAASA,UAAT,CAAoBC,UAApB,EAAmDC,OAAnD,EAAiF;AACtF,QAAMC,IAAI,GAAG,8CAAwBF,UAAxB,EAAoCC,OAApC,CAAb;AACA,SAAO,CAAC,CAACC,IAAT;AACD;;AAEM,eAAeC,OAAf,CACLH,UADK,EAELC,OAAuB,GAAG,EAFrB,EAGoB;AACzB,QAAM;AAAEG,IAAAA;AAAF,MAAYH,OAAlB;AACA,QAAMC,IAAI,GAAG,8CAAwBF,UAAxB,EAAoC;AAAEI,IAAAA;AAAF,GAApC,CAAb,CAFyB,CAIzB;;AACA,MAAI,CAACF,IAAL,EAAW;AACT,UAAM,IAAIG,oBAAJ,CAAiB,0DAAjB,CAAN;AACD,GAPwB,CASzB;;;AACA,QAAMC,IAAI,GAAGJ,IAAH,aAAGA,IAAH,uBAAGA,IAAI,CAAEI,IAAnB;AAEA,SAAO,cAAIN,UAAJ,EAAgB,EACrB,GAAGC,OADkB;AAErBK,IAAAA;AAFqB,GAAhB,CAAP;AAID","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { \n OktaAuthInterface,\n IdxTransaction,\n} from '../types';\nimport { run } from './run';\nimport { AuthenticationOptions } from './authenticate';\nimport {\n EnrollPollValues as EnrollPollOptions,\n SelectEnrollmentChannelValues as SelectEnrollmentChannelOptions\n} from './remediators';\nimport { RegistrationOptions } from './register';\nimport { PasswordRecoveryOptions } from './recoverPassword';\nimport { AccountUnlockOptions } from './unlockAccount';\nimport { getSavedTransactionMeta } from './transactionMeta';\nimport { AuthSdkError } from '../errors';\n\nexport type ProceedOptions = AuthenticationOptions\n & RegistrationOptions\n & PasswordRecoveryOptions\n & AccountUnlockOptions\n & EnrollPollOptions\n & SelectEnrollmentChannelOptions\n & { step?: string };\n\nexport function canProceed(authClient: OktaAuthInterface, options?: { state?: string }) {\n const meta = getSavedTransactionMeta(authClient, options);\n return !!meta;\n}\n\nexport async function proceed(\n authClient: OktaAuthInterface,\n options: ProceedOptions = {}\n): Promise<IdxTransaction> {\n const { state } = options;\n const meta = getSavedTransactionMeta(authClient, { state });\n\n // Proceed always needs saved transaction meta\n if (!meta) {\n throw new AuthSdkError('Unable to proceed: saved transaction could not be loaded');\n }\n\n // Determine the flow specification based on the saved flow\n const flow = meta?.flow;\n\n return run(authClient, { \n ...options, \n flow\n });\n}\n"],"file":"proceed.js"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/idx/recoverPassword.ts"],"names":["recoverPassword","authClient","options","flowSpec"],"mappings":";;;;AAaA;;AASA;;AAtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA2BO,eAAeA,eAAf,CACLC,UADK,EACiBC,OAAgC,GAAG,EADpD,EAEoB;AACzB,QAAMC,QAAQ,GAAG,gCAAqBF,UAArB,EAAiC,iBAAjC,CAAjB;AACA,SAAO,cACLA,UADK,EAEL,EACE,GAAGC,OADL;AAEE,OAAGC;AAFL,GAFK,CAAP;AAOD","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { run } from './run';\nimport {\n IdentifyValues,\n SelectAuthenticatorAuthenticateValues,\n ChallengeAuthenticatorValues,\n AuthenticatorVerificationDataValues,\n ResetAuthenticatorValues,\n ReEnrollAuthenticatorValues,\n} from './remediators';\nimport { getFlowSpecification } from './flow';\nimport { \n OktaAuth, \n IdxOptions, \n IdxTransaction,\n} from '../types';\n\nexport type PasswordRecoveryOptions = IdxOptions \n & IdentifyValues \n & SelectAuthenticatorAuthenticateValues \n & ChallengeAuthenticatorValues \n & ResetAuthenticatorValues\n & AuthenticatorVerificationDataValues\n & ReEnrollAuthenticatorValues;\n\nexport async function recoverPassword(\n authClient: OktaAuth, options: PasswordRecoveryOptions = {}\n): Promise<IdxTransaction> {\n const flowSpec = getFlowSpecification(authClient, 'recoverPassword');\n return run(\n authClient, \n { \n ...options,\n ...flowSpec,\n }\n );\n}\n"],"file":"recoverPassword.js"}
1
+ {"version":3,"sources":["../../../lib/idx/recoverPassword.ts"],"names":["recoverPassword","authClient","options","flowSpec"],"mappings":";;;;AAaA;;AASA;;AAtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA2BO,eAAeA,eAAf,CACLC,UADK,EAC0BC,OAAgC,GAAG,EAD7D,EAEoB;AACzB,QAAMC,QAAQ,GAAG,gCAAqBF,UAArB,EAAiC,iBAAjC,CAAjB;AACA,SAAO,cACLA,UADK,EAEL,EACE,GAAGC,OADL;AAEE,OAAGC;AAFL,GAFK,CAAP;AAOD","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { run } from './run';\nimport {\n IdentifyValues,\n SelectAuthenticatorAuthenticateValues,\n ChallengeAuthenticatorValues,\n AuthenticatorVerificationDataValues,\n ResetAuthenticatorValues,\n ReEnrollAuthenticatorValues,\n} from './remediators';\nimport { getFlowSpecification } from './flow';\nimport { \n OktaAuthInterface, \n IdxOptions, \n IdxTransaction,\n} from '../types';\n\nexport type PasswordRecoveryOptions = IdxOptions \n & IdentifyValues \n & SelectAuthenticatorAuthenticateValues \n & ChallengeAuthenticatorValues \n & ResetAuthenticatorValues\n & AuthenticatorVerificationDataValues\n & ReEnrollAuthenticatorValues;\n\nexport async function recoverPassword(\n authClient: OktaAuthInterface, options: PasswordRecoveryOptions = {}\n): Promise<IdxTransaction> {\n const flowSpec = getFlowSpecification(authClient, 'recoverPassword');\n return run(\n authClient, \n { \n ...options,\n ...flowSpec,\n }\n );\n}\n"],"file":"recoverPassword.js"}
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
+
3
5
  exports.register = register;
4
6
 
7
+ var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
8
+
5
9
  var _run = require("./run");
6
10
 
7
11
  var _transactionMeta = require("./transactionMeta");
@@ -34,7 +38,7 @@ async function register(authClient, options = {}) {
34
38
  autoRemediate: false
35
39
  });
36
40
 
37
- if (!options.activationToken && enabledFeatures && !enabledFeatures.includes(_types.IdxFeature.REGISTRATION)) {
41
+ if (!options.activationToken && enabledFeatures && !(0, _includes.default)(enabledFeatures).call(enabledFeatures, _types.IdxFeature.REGISTRATION)) {
38
42
  const error = new _errors.AuthSdkError('Registration is not supported based on your current org configuration.');
39
43
  throw error; // return { status: IdxStatus.FAILURE, error } as unknown as IdxTransaction; // TODO: wny not just throw the error?
40
44
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/idx/register.ts"],"names":["register","authClient","options","enabledFeatures","availableSteps","flow","autoRemediate","activationToken","includes","IdxFeature","REGISTRATION","error","AuthSdkError","some","name"],"mappings":";;;;AAaA;;AACA;;AACA;;AAQA;;AACA;;AAxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA4BO,eAAeA,QAAf,CACLC,UADK,EACiBC,OAA4B,GAAG,EADhD,EAEoB;AAEzB;AACA,MAAI,CAAC,gDAA0BD,UAA1B,CAAL,EAA4C;AAC1C,UAAM;AAAEE,MAAAA,eAAF;AAAmBC,MAAAA;AAAnB,QAAsC,MAAM,wCAAiBH,UAAjB,EAA6B,EAC7E,GAAGC,OAD0E;AAE7EG,MAAAA,IAAI,EAAE,UAFuE;AAG7EC,MAAAA,aAAa,EAAE;AAH8D,KAA7B,CAAlD;;AAKA,QAAI,CAACJ,OAAO,CAACK,eAAT,IAA4BJ,eAA5B,IAA+C,CAACA,eAAe,CAACK,QAAhB,CAAyBC,kBAAWC,YAApC,CAApD,EAAuG;AACrG,YAAMC,KAAK,GAAG,IAAIC,oBAAJ,CAAiB,wEAAjB,CAAd;AACA,YAAMD,KAAN,CAFqG,CAGvG;AACC;;AACD,QAAIT,OAAO,CAACK,eAAR,IAA2BH,cAA3B,aAA2BA,cAA3B,eAA2BA,cAAc,CAAES,IAAhB,CAAqB,CAAC;AAAEC,MAAAA;AAAF,KAAD,KAAcA,IAAI,KAAK,UAA5C,CAA/B,EAAwF;AACtF,YAAMH,KAAK,GAAG,IAAIC,oBAAJ,CAAiB,2EAAjB,CAAd;AACA,YAAMD,KAAN,CAFsF,CAGxF;AACC;AACF;;AAED,SAAO,cAAIV,UAAJ,EAAgB,EACrB,GAAGC,OADkB;AAErBG,IAAAA,IAAI,EAAE;AAFe,GAAhB,CAAP;AAID","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { run } from './run';\nimport { hasSavedInteractionHandle } from './transactionMeta';\nimport { startTransaction } from './startTransaction';\nimport { \n EnrollProfileValues,\n SelectAuthenticatorEnrollValues,\n EnrollAuthenticatorValues,\n AuthenticatorEnrollmentDataValues,\n SkipValues,\n} from './remediators';\nimport { AuthSdkError } from '../errors';\nimport { \n IdxOptions, \n IdxTransaction, \n OktaAuth, \n IdxFeature,\n} from '../types';\n\nexport type RegistrationOptions = IdxOptions \n & EnrollProfileValues \n & SelectAuthenticatorEnrollValues \n & EnrollAuthenticatorValues \n & AuthenticatorEnrollmentDataValues \n & SkipValues;\n\nexport async function register(\n authClient: OktaAuth, options: RegistrationOptions = {}\n): Promise<IdxTransaction> {\n\n // Only check at the beginning of the transaction\n if (!hasSavedInteractionHandle(authClient)) {\n const { enabledFeatures, availableSteps } = await startTransaction(authClient, {\n ...options,\n flow: 'register',\n autoRemediate: false\n });\n if (!options.activationToken && enabledFeatures && !enabledFeatures.includes(IdxFeature.REGISTRATION)) {\n const error = new AuthSdkError('Registration is not supported based on your current org configuration.');\n throw error;\n // return { status: IdxStatus.FAILURE, error } as unknown as IdxTransaction; // TODO: wny not just throw the error?\n }\n if (options.activationToken && availableSteps?.some(({ name }) => name === 'identify')) {\n const error = new AuthSdkError('activationToken is not supported based on your current org configuration.');\n throw error;\n // return { status: IdxStatus.FAILURE, error } as unknown as IdxTransaction; // TODO: wny not just throw the error?\n }\n }\n\n return run(authClient, {\n ...options,\n flow: 'register'\n });\n}\n"],"file":"register.js"}
1
+ {"version":3,"sources":["../../../lib/idx/register.ts"],"names":["register","authClient","options","enabledFeatures","availableSteps","flow","autoRemediate","activationToken","IdxFeature","REGISTRATION","error","AuthSdkError","some","name"],"mappings":";;;;;;;;AAaA;;AACA;;AACA;;AAQA;;AACA;;AAxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA4BO,eAAeA,QAAf,CACLC,UADK,EAC0BC,OAA4B,GAAG,EADzD,EAEoB;AAEzB;AACA,MAAI,CAAC,gDAA0BD,UAA1B,CAAL,EAA4C;AAC1C,UAAM;AAAEE,MAAAA,eAAF;AAAmBC,MAAAA;AAAnB,QAAsC,MAAM,wCAAiBH,UAAjB,EAA6B,EAC7E,GAAGC,OAD0E;AAE7EG,MAAAA,IAAI,EAAE,UAFuE;AAG7EC,MAAAA,aAAa,EAAE;AAH8D,KAA7B,CAAlD;;AAKA,QAAI,CAACJ,OAAO,CAACK,eAAT,IAA4BJ,eAA5B,IAA+C,CAAC,uBAAAA,eAAe,MAAf,CAAAA,eAAe,EAAUK,kBAAWC,YAArB,CAAnE,EAAuG;AACrG,YAAMC,KAAK,GAAG,IAAIC,oBAAJ,CAAiB,wEAAjB,CAAd;AACA,YAAMD,KAAN,CAFqG,CAGvG;AACC;;AACD,QAAIR,OAAO,CAACK,eAAR,IAA2BH,cAA3B,aAA2BA,cAA3B,eAA2BA,cAAc,CAAEQ,IAAhB,CAAqB,CAAC;AAAEC,MAAAA;AAAF,KAAD,KAAcA,IAAI,KAAK,UAA5C,CAA/B,EAAwF;AACtF,YAAMH,KAAK,GAAG,IAAIC,oBAAJ,CAAiB,2EAAjB,CAAd;AACA,YAAMD,KAAN,CAFsF,CAGxF;AACC;AACF;;AAED,SAAO,cAAIT,UAAJ,EAAgB,EACrB,GAAGC,OADkB;AAErBG,IAAAA,IAAI,EAAE;AAFe,GAAhB,CAAP;AAID","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { run } from './run';\nimport { hasSavedInteractionHandle } from './transactionMeta';\nimport { startTransaction } from './startTransaction';\nimport { \n EnrollProfileValues,\n SelectAuthenticatorEnrollValues,\n EnrollAuthenticatorValues,\n AuthenticatorEnrollmentDataValues,\n SkipValues,\n} from './remediators';\nimport { AuthSdkError } from '../errors';\nimport { \n IdxOptions, \n IdxTransaction, \n OktaAuthInterface, \n IdxFeature,\n} from '../types';\n\nexport type RegistrationOptions = IdxOptions \n & EnrollProfileValues \n & SelectAuthenticatorEnrollValues \n & EnrollAuthenticatorValues \n & AuthenticatorEnrollmentDataValues \n & SkipValues;\n\nexport async function register(\n authClient: OktaAuthInterface, options: RegistrationOptions = {}\n): Promise<IdxTransaction> {\n\n // Only check at the beginning of the transaction\n if (!hasSavedInteractionHandle(authClient)) {\n const { enabledFeatures, availableSteps } = await startTransaction(authClient, {\n ...options,\n flow: 'register',\n autoRemediate: false\n });\n if (!options.activationToken && enabledFeatures && !enabledFeatures.includes(IdxFeature.REGISTRATION)) {\n const error = new AuthSdkError('Registration is not supported based on your current org configuration.');\n throw error;\n // return { status: IdxStatus.FAILURE, error } as unknown as IdxTransaction; // TODO: wny not just throw the error?\n }\n if (options.activationToken && availableSteps?.some(({ name }) => name === 'identify')) {\n const error = new AuthSdkError('activationToken is not supported based on your current org configuration.');\n throw error;\n // return { status: IdxStatus.FAILURE, error } as unknown as IdxTransaction; // TODO: wny not just throw the error?\n }\n }\n\n return run(authClient, {\n ...options,\n flow: 'register'\n });\n}\n"],"file":"register.js"}