@okta/okta-auth-js 6.0.0 → 6.3.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 (398) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/README.md +58 -27
  3. package/cjs/AuthStateManager.js +21 -7
  4. package/cjs/AuthStateManager.js.map +1 -1
  5. package/cjs/OktaAuth.js +96 -40
  6. package/cjs/OktaAuth.js.map +1 -1
  7. package/cjs/OktaUserAgent.js +2 -2
  8. package/cjs/PromiseQueue.js +14 -3
  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/ServiceManager.js +195 -0
  13. package/cjs/ServiceManager.js.map +1 -0
  14. package/cjs/StorageManager.js +13 -8
  15. package/cjs/StorageManager.js.map +1 -1
  16. package/cjs/TokenManager.js +34 -32
  17. package/cjs/TokenManager.js.map +1 -1
  18. package/cjs/TransactionManager.js +17 -5
  19. package/cjs/TransactionManager.js.map +1 -1
  20. package/cjs/browser/browserStorage.js +48 -33
  21. package/cjs/browser/browserStorage.js.map +1 -1
  22. package/cjs/browser/fingerprint.js +9 -3
  23. package/cjs/browser/fingerprint.js.map +1 -1
  24. package/cjs/builderUtil.js +4 -2
  25. package/cjs/builderUtil.js.map +1 -1
  26. package/cjs/clock.js +5 -1
  27. package/cjs/clock.js.map +1 -1
  28. package/cjs/crypto/base64.js +18 -0
  29. package/cjs/crypto/base64.js.map +1 -1
  30. package/cjs/crypto/index.js +6 -4
  31. package/cjs/crypto/index.js.map +1 -1
  32. package/cjs/crypto/node.js +19 -13
  33. package/cjs/crypto/node.js.map +1 -1
  34. package/cjs/crypto/oidcHash.js +5 -1
  35. package/cjs/crypto/oidcHash.js.map +1 -1
  36. package/cjs/crypto/webauthn.js +101 -0
  37. package/cjs/crypto/webauthn.js.map +1 -0
  38. package/cjs/crypto/webcrypto.js +3 -1
  39. package/cjs/crypto/webcrypto.js.map +1 -1
  40. package/cjs/errors/AuthApiError.js +1 -1
  41. package/cjs/errors/AuthPollStopError.js +1 -1
  42. package/cjs/errors/AuthSdkError.js +1 -1
  43. package/cjs/errors/CustomError.js +5 -1
  44. package/cjs/errors/CustomError.js.map +1 -1
  45. package/cjs/errors/OAuthError.js +1 -1
  46. package/cjs/errors/index.js +1 -1
  47. package/cjs/fetch/fetchRequest.js +18 -6
  48. package/cjs/fetch/fetchRequest.js.map +1 -1
  49. package/cjs/http/headers.js.map +1 -1
  50. package/cjs/http/index.js +4 -2
  51. package/cjs/http/index.js.map +1 -1
  52. package/cjs/http/request.js +9 -5
  53. package/cjs/http/request.js.map +1 -1
  54. package/cjs/idx/authenticate.js.map +1 -1
  55. package/cjs/idx/authenticator/Authenticator.js.map +1 -1
  56. package/cjs/idx/authenticator/OktaPassword.js +12 -3
  57. package/cjs/idx/authenticator/OktaPassword.js.map +1 -1
  58. package/cjs/idx/authenticator/OktaVerifyTotp.js +9 -1
  59. package/cjs/idx/authenticator/OktaVerifyTotp.js.map +1 -1
  60. package/cjs/idx/authenticator/SecurityQuestionEnrollment.js +15 -2
  61. package/cjs/idx/authenticator/SecurityQuestionEnrollment.js.map +1 -1
  62. package/cjs/idx/authenticator/SecurityQuestionVerification.js +10 -2
  63. package/cjs/idx/authenticator/SecurityQuestionVerification.js.map +1 -1
  64. package/cjs/idx/authenticator/VerificationCodeAuthenticator.js +13 -3
  65. package/cjs/idx/authenticator/VerificationCodeAuthenticator.js.map +1 -1
  66. package/cjs/idx/authenticator/WebauthnEnrollment.js +51 -0
  67. package/cjs/idx/authenticator/WebauthnEnrollment.js.map +1 -0
  68. package/cjs/idx/authenticator/WebauthnVerification.js +60 -0
  69. package/cjs/idx/authenticator/WebauthnVerification.js.map +1 -0
  70. package/cjs/idx/authenticator/getAuthenticator.js +13 -1
  71. package/cjs/idx/authenticator/getAuthenticator.js.map +1 -1
  72. package/cjs/idx/authenticator/index.js +34 -6
  73. package/cjs/idx/authenticator/index.js.map +1 -1
  74. package/cjs/idx/authenticator/util.js +64 -0
  75. package/cjs/idx/authenticator/util.js.map +1 -0
  76. package/cjs/idx/cancel.js.map +1 -1
  77. package/cjs/idx/emailVerify.js +1 -1
  78. package/cjs/idx/emailVerify.js.map +1 -1
  79. package/cjs/idx/flow/AccountUnlockFlow.js +30 -0
  80. package/cjs/idx/flow/AccountUnlockFlow.js.map +1 -0
  81. package/cjs/idx/flow/FlowSpecification.js +8 -0
  82. package/cjs/idx/flow/FlowSpecification.js.map +1 -1
  83. package/cjs/idx/flow/PasswordRecoveryFlow.js +4 -1
  84. package/cjs/idx/flow/PasswordRecoveryFlow.js.map +1 -1
  85. package/cjs/idx/flow/index.js +20 -5
  86. package/cjs/idx/flow/index.js.map +1 -1
  87. package/cjs/idx/handleInteractionCodeRedirect.js +5 -1
  88. package/cjs/idx/handleInteractionCodeRedirect.js.map +1 -1
  89. package/cjs/idx/headers.js +21 -5
  90. package/cjs/idx/headers.js.map +1 -1
  91. package/cjs/idx/idx-js/client.js +91 -0
  92. package/cjs/idx/idx-js/client.js.map +1 -0
  93. package/cjs/idx/idx-js/index.js +40 -0
  94. package/cjs/idx/idx-js/index.js.map +1 -0
  95. package/cjs/idx/idx-js/interact.js +83 -0
  96. package/cjs/idx/idx-js/interact.js.map +1 -0
  97. package/cjs/idx/idx-js/introspect.js +62 -0
  98. package/cjs/idx/idx-js/introspect.js.map +1 -0
  99. package/cjs/idx/idx-js/parsers.js +41 -0
  100. package/cjs/idx/idx-js/parsers.js.map +1 -0
  101. package/cjs/idx/idx-js/util.js +34 -0
  102. package/cjs/idx/idx-js/util.js.map +1 -0
  103. package/cjs/idx/idx-js/v1/actionParser.js +90 -0
  104. package/cjs/idx/idx-js/v1/actionParser.js.map +1 -0
  105. package/cjs/idx/idx-js/v1/generateIdxAction.js +111 -0
  106. package/cjs/idx/idx-js/v1/generateIdxAction.js.map +1 -0
  107. package/cjs/idx/idx-js/v1/idxResponseParser.js +137 -0
  108. package/cjs/idx/idx-js/v1/idxResponseParser.js.map +1 -0
  109. package/cjs/idx/idx-js/v1/makeIdxState.js +65 -0
  110. package/cjs/idx/idx-js/v1/makeIdxState.js.map +1 -0
  111. package/cjs/idx/idx-js/v1/parsers.js +24 -0
  112. package/cjs/idx/idx-js/v1/parsers.js.map +1 -0
  113. package/cjs/idx/idx-js/v1/remediationParser.js +32 -0
  114. package/cjs/idx/idx-js/v1/remediationParser.js.map +1 -0
  115. package/cjs/idx/index.js +120 -121
  116. package/cjs/idx/index.js.map +1 -1
  117. package/cjs/idx/interact.js +9 -4
  118. package/cjs/idx/interact.js.map +1 -1
  119. package/cjs/idx/introspect.js +19 -9
  120. package/cjs/idx/introspect.js.map +1 -1
  121. package/cjs/idx/poll.js +13 -3
  122. package/cjs/idx/poll.js.map +1 -1
  123. package/cjs/idx/proceed.js +14 -11
  124. package/cjs/idx/proceed.js.map +1 -1
  125. package/cjs/idx/recoverPassword.js.map +1 -1
  126. package/cjs/idx/register.js +5 -1
  127. package/cjs/idx/register.js.map +1 -1
  128. package/cjs/idx/remediate.js +112 -88
  129. package/cjs/idx/remediate.js.map +1 -1
  130. package/cjs/idx/remediators/AuthenticatorEnrollmentData.js +16 -6
  131. package/cjs/idx/remediators/AuthenticatorEnrollmentData.js.map +1 -1
  132. package/cjs/idx/remediators/AuthenticatorVerificationData.js +61 -16
  133. package/cjs/idx/remediators/AuthenticatorVerificationData.js.map +1 -1
  134. package/cjs/idx/remediators/Base/AuthenticatorData.js +44 -20
  135. package/cjs/idx/remediators/Base/AuthenticatorData.js.map +1 -1
  136. package/cjs/idx/remediators/Base/Remediator.js +116 -82
  137. package/cjs/idx/remediators/Base/Remediator.js.map +1 -1
  138. package/cjs/idx/remediators/Base/SelectAuthenticator.js +58 -34
  139. package/cjs/idx/remediators/Base/SelectAuthenticator.js.map +1 -1
  140. package/cjs/idx/remediators/Base/VerifyAuthenticator.js +30 -7
  141. package/cjs/idx/remediators/Base/VerifyAuthenticator.js.map +1 -1
  142. package/cjs/idx/remediators/ChallengeAuthenticator.js +2 -2
  143. package/cjs/idx/remediators/ChallengePoll.js +10 -3
  144. package/cjs/idx/remediators/ChallengePoll.js.map +1 -1
  145. package/cjs/idx/remediators/EnrollAuthenticator.js +2 -2
  146. package/cjs/idx/remediators/EnrollPoll.js +16 -6
  147. package/cjs/idx/remediators/EnrollPoll.js.map +1 -1
  148. package/cjs/idx/remediators/EnrollProfile.js +34 -16
  149. package/cjs/idx/remediators/EnrollProfile.js.map +1 -1
  150. package/cjs/idx/remediators/EnrollmentChannelData.js +25 -17
  151. package/cjs/idx/remediators/EnrollmentChannelData.js.map +1 -1
  152. package/cjs/idx/remediators/Identify.js +16 -7
  153. package/cjs/idx/remediators/Identify.js.map +1 -1
  154. package/cjs/idx/remediators/ReEnrollAuthenticator.js +13 -10
  155. package/cjs/idx/remediators/ReEnrollAuthenticator.js.map +1 -1
  156. package/cjs/idx/remediators/RedirectIdp.js +2 -2
  157. package/cjs/idx/remediators/ResetAuthenticator.js +2 -2
  158. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js +9 -6
  159. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js.map +1 -1
  160. package/cjs/idx/remediators/SelectAuthenticatorEnroll.js +2 -2
  161. package/cjs/idx/remediators/SelectAuthenticatorUnlockAccount.js +71 -0
  162. package/cjs/idx/remediators/SelectAuthenticatorUnlockAccount.js.map +1 -0
  163. package/cjs/idx/remediators/SelectEnrollProfile.js +2 -2
  164. package/cjs/idx/remediators/SelectEnrollmentChannel.js +22 -10
  165. package/cjs/idx/remediators/SelectEnrollmentChannel.js.map +1 -1
  166. package/cjs/idx/remediators/Skip.js +5 -10
  167. package/cjs/idx/remediators/Skip.js.map +1 -1
  168. package/cjs/idx/remediators/index.js +33 -18
  169. package/cjs/idx/remediators/index.js.map +1 -1
  170. package/cjs/idx/remediators/util.js +13 -3
  171. package/cjs/idx/remediators/util.js.map +1 -1
  172. package/cjs/idx/run.js +276 -177
  173. package/cjs/idx/run.js.map +1 -1
  174. package/cjs/idx/startTransaction.js.map +1 -1
  175. package/cjs/idx/transactionMeta.js.map +1 -1
  176. package/cjs/idx/types/idx-js.js.map +1 -1
  177. package/cjs/idx/types/index.js +82 -9
  178. package/cjs/idx/types/index.js.map +1 -1
  179. package/cjs/idx/unlockAccount.js +48 -0
  180. package/cjs/idx/unlockAccount.js.map +1 -0
  181. package/cjs/idx/util.js +198 -0
  182. package/cjs/idx/util.js.map +1 -0
  183. package/cjs/index.js +20 -14
  184. package/cjs/index.js.map +1 -1
  185. package/cjs/oidc/endpoints/authorize.js +8 -2
  186. package/cjs/oidc/endpoints/authorize.js.map +1 -1
  187. package/cjs/oidc/endpoints/index.js +5 -3
  188. package/cjs/oidc/endpoints/index.js.map +1 -1
  189. package/cjs/oidc/endpoints/token.js +15 -3
  190. package/cjs/oidc/endpoints/token.js.map +1 -1
  191. package/cjs/oidc/endpoints/well-known.js +7 -3
  192. package/cjs/oidc/endpoints/well-known.js.map +1 -1
  193. package/cjs/oidc/exchangeCodeForTokens.js +10 -2
  194. package/cjs/oidc/exchangeCodeForTokens.js.map +1 -1
  195. package/cjs/oidc/getToken.js +9 -5
  196. package/cjs/oidc/getToken.js.map +1 -1
  197. package/cjs/oidc/getUserInfo.js +7 -3
  198. package/cjs/oidc/getUserInfo.js.map +1 -1
  199. package/cjs/oidc/getWithPopup.js +8 -2
  200. package/cjs/oidc/getWithPopup.js.map +1 -1
  201. package/cjs/oidc/getWithRedirect.js +5 -1
  202. package/cjs/oidc/getWithRedirect.js.map +1 -1
  203. package/cjs/oidc/getWithoutPrompt.js +8 -2
  204. package/cjs/oidc/getWithoutPrompt.js.map +1 -1
  205. package/cjs/oidc/handleOAuthResponse.js +9 -3
  206. package/cjs/oidc/handleOAuthResponse.js.map +1 -1
  207. package/cjs/oidc/index.js +4 -2
  208. package/cjs/oidc/index.js.map +1 -1
  209. package/cjs/oidc/parseFromUrl.js +9 -3
  210. package/cjs/oidc/parseFromUrl.js.map +1 -1
  211. package/cjs/oidc/renewToken.js.map +1 -1
  212. package/cjs/oidc/renewTokens.js +5 -1
  213. package/cjs/oidc/renewTokens.js.map +1 -1
  214. package/cjs/oidc/renewTokensWithRefresh.js +5 -1
  215. package/cjs/oidc/renewTokensWithRefresh.js.map +1 -1
  216. package/cjs/oidc/revokeToken.js +7 -3
  217. package/cjs/oidc/revokeToken.js.map +1 -1
  218. package/cjs/oidc/util/browser.js +5 -1
  219. package/cjs/oidc/util/browser.js.map +1 -1
  220. package/cjs/oidc/util/defaultTokenParams.js.map +1 -1
  221. package/cjs/oidc/util/errors.js.map +1 -1
  222. package/cjs/oidc/util/index.js +14 -12
  223. package/cjs/oidc/util/index.js.map +1 -1
  224. package/cjs/oidc/util/loginRedirect.js +5 -1
  225. package/cjs/oidc/util/loginRedirect.js.map +1 -1
  226. package/cjs/oidc/util/oauth.js +4 -2
  227. package/cjs/oidc/util/oauth.js.map +1 -1
  228. package/cjs/oidc/util/oauthMeta.js.map +1 -1
  229. package/cjs/oidc/util/pkce.js +11 -3
  230. package/cjs/oidc/util/pkce.js.map +1 -1
  231. package/cjs/oidc/util/prepareTokenParams.js +7 -5
  232. package/cjs/oidc/util/prepareTokenParams.js.map +1 -1
  233. package/cjs/oidc/util/validateClaims.js +1 -1
  234. package/cjs/oidc/util/validateClaims.js.map +1 -1
  235. package/cjs/oidc/verifyToken.js +11 -3
  236. package/cjs/oidc/verifyToken.js.map +1 -1
  237. package/cjs/options/browser.js +86 -0
  238. package/cjs/options/browser.js.map +1 -0
  239. package/cjs/options/index.js +94 -0
  240. package/cjs/options/index.js.map +1 -0
  241. package/cjs/options/node.js +45 -0
  242. package/cjs/options/node.js.map +1 -0
  243. package/cjs/options.js +17 -5
  244. package/cjs/options.js.map +1 -1
  245. package/cjs/server/serverStorage.js +8 -4
  246. package/cjs/server/serverStorage.js.map +1 -1
  247. package/cjs/services/AutoRenewService.js +94 -0
  248. package/cjs/services/AutoRenewService.js.map +1 -0
  249. package/cjs/services/SyncStorageService.js +93 -0
  250. package/cjs/services/SyncStorageService.js.map +1 -0
  251. package/cjs/services/index.js +30 -0
  252. package/cjs/services/index.js.map +1 -0
  253. package/cjs/tx/AuthTransaction.js +15 -9
  254. package/cjs/tx/AuthTransaction.js.map +1 -1
  255. package/cjs/tx/api.js +8 -4
  256. package/cjs/tx/api.js.map +1 -1
  257. package/cjs/tx/index.js +7 -5
  258. package/cjs/tx/index.js.map +1 -1
  259. package/cjs/tx/poll.js +6 -4
  260. package/cjs/tx/poll.js.map +1 -1
  261. package/cjs/tx/util.js +5 -1
  262. package/cjs/tx/util.js.map +1 -1
  263. package/cjs/types/Service.js +2 -0
  264. package/cjs/types/Service.js.map +1 -0
  265. package/cjs/types/Transaction.js +10 -2
  266. package/cjs/types/Transaction.js.map +1 -1
  267. package/cjs/types/index.js +29 -14
  268. package/cjs/types/index.js.map +1 -1
  269. package/cjs/util/index.js +7 -5
  270. package/cjs/util/index.js.map +1 -1
  271. package/cjs/util/misc.js +5 -1
  272. package/cjs/util/misc.js.map +1 -1
  273. package/cjs/util/object.js +16 -6
  274. package/cjs/util/object.js.map +1 -1
  275. package/cjs/util/sharedStorage.js +5 -1
  276. package/cjs/util/sharedStorage.js.map +1 -1
  277. package/dist/okta-auth-js.min.js +1 -1
  278. package/dist/okta-auth-js.min.js.LICENSE.txt +0 -20
  279. package/dist/okta-auth-js.min.js.map +1 -1
  280. package/dist/okta-auth-js.polyfill.js +1 -1
  281. package/dist/okta-auth-js.polyfill.js.map +1 -1
  282. package/dist/okta-auth-js.umd.js +1 -1
  283. package/dist/okta-auth-js.umd.js.LICENSE.txt +1 -19
  284. package/dist/okta-auth-js.umd.js.map +1 -1
  285. package/esm/{index.js → esm.browser.js} +2978 -2585
  286. package/esm/esm.browser.js.map +1 -0
  287. package/esm/esm.node.mjs +9595 -0
  288. package/esm/esm.node.mjs.map +1 -0
  289. package/lib/AuthStateManager.d.ts +3 -3
  290. package/lib/OktaAuth.d.ts +10 -6
  291. package/lib/PromiseQueue.d.ts +6 -2
  292. package/lib/ServiceManager.d.ts +38 -0
  293. package/lib/StorageManager.d.ts +1 -1
  294. package/lib/TokenManager.d.ts +2 -3
  295. package/lib/TransactionManager.d.ts +4 -5
  296. package/lib/browser/fingerprint.d.ts +2 -3
  297. package/lib/crypto/base64.d.ts +2 -0
  298. package/lib/crypto/webauthn.d.ts +25 -0
  299. package/lib/http/headers.d.ts +2 -2
  300. package/lib/http/request.d.ts +4 -4
  301. package/lib/idx/authenticate.d.ts +2 -2
  302. package/lib/idx/authenticator/Authenticator.d.ts +4 -5
  303. package/lib/idx/authenticator/OktaPassword.d.ts +8 -9
  304. package/lib/idx/authenticator/OktaVerifyTotp.d.ts +1 -1
  305. package/lib/idx/authenticator/SecurityQuestionEnrollment.d.ts +11 -12
  306. package/lib/idx/authenticator/SecurityQuestionVerification.d.ts +7 -7
  307. package/lib/idx/authenticator/VerificationCodeAuthenticator.d.ts +8 -3
  308. package/lib/idx/authenticator/WebauthnEnrollment.d.ts +16 -0
  309. package/lib/idx/authenticator/WebauthnVerification.d.ts +17 -0
  310. package/lib/idx/authenticator/getAuthenticator.d.ts +1 -1
  311. package/lib/idx/authenticator/index.d.ts +9 -0
  312. package/lib/idx/authenticator/util.d.ts +4 -0
  313. package/lib/idx/cancel.d.ts +2 -2
  314. package/lib/idx/emailVerify.d.ts +2 -2
  315. package/lib/idx/flow/AccountUnlockFlow.d.ts +13 -0
  316. package/lib/idx/flow/FlowSpecification.d.ts +2 -2
  317. package/lib/idx/flow/index.d.ts +1 -0
  318. package/lib/idx/headers.d.ts +3 -2
  319. package/lib/idx/idx-js/client.d.ts +36 -0
  320. package/lib/idx/idx-js/index.d.ts +35 -0
  321. package/lib/idx/idx-js/interact.d.ts +25 -0
  322. package/lib/idx/idx-js/introspect.d.ts +21 -0
  323. package/lib/idx/idx-js/parsers.d.ts +15 -0
  324. package/lib/idx/idx-js/util.d.ts +12 -0
  325. package/lib/idx/idx-js/v1/actionParser.d.ts +16 -0
  326. package/lib/idx/idx-js/v1/generateIdxAction.d.ts +13 -0
  327. package/lib/idx/idx-js/v1/idxResponseParser.d.ts +20 -0
  328. package/lib/idx/idx-js/v1/makeIdxState.d.ts +13 -0
  329. package/lib/idx/idx-js/v1/parsers.d.ts +16 -0
  330. package/lib/idx/idx-js/v1/remediationParser.d.ts +12 -0
  331. package/lib/idx/index.d.ts +12 -11
  332. package/lib/idx/interact.d.ts +3 -2
  333. package/lib/idx/introspect.d.ts +2 -2
  334. package/lib/idx/poll.d.ts +2 -2
  335. package/lib/idx/proceed.d.ts +5 -6
  336. package/lib/idx/recoverPassword.d.ts +2 -2
  337. package/lib/idx/register.d.ts +2 -2
  338. package/lib/idx/remediate.d.ts +2 -2
  339. package/lib/idx/remediators/AuthenticatorVerificationData.d.ts +6 -5
  340. package/lib/idx/remediators/Base/AuthenticatorData.d.ts +5 -8
  341. package/lib/idx/remediators/Base/Remediator.d.ts +6 -5
  342. package/lib/idx/remediators/Base/SelectAuthenticator.d.ts +9 -8
  343. package/lib/idx/remediators/Base/VerifyAuthenticator.d.ts +9 -16
  344. package/lib/idx/remediators/ChallengePoll.d.ts +1 -0
  345. package/lib/idx/remediators/EnrollProfile.d.ts +0 -3
  346. package/lib/idx/remediators/EnrollmentChannelData.d.ts +1 -4
  347. package/lib/idx/remediators/Identify.d.ts +3 -5
  348. package/lib/idx/remediators/ReEnrollAuthenticator.d.ts +2 -5
  349. package/lib/idx/remediators/SelectAuthenticatorAuthenticate.d.ts +2 -1
  350. package/lib/idx/remediators/SelectAuthenticatorUnlockAccount.d.ts +37 -0
  351. package/lib/idx/remediators/SelectEnrollmentChannel.d.ts +1 -0
  352. package/lib/idx/remediators/Skip.d.ts +0 -3
  353. package/lib/idx/remediators/index.d.ts +1 -0
  354. package/lib/idx/run.d.ts +2 -2
  355. package/lib/idx/startTransaction.d.ts +2 -2
  356. package/lib/idx/transactionMeta.d.ts +7 -7
  357. package/lib/idx/types/FlowIdentifier.d.ts +1 -1
  358. package/lib/idx/types/idx-js.d.ts +41 -1
  359. package/lib/idx/types/index.d.ts +27 -7
  360. package/lib/idx/unlockAccount.d.ts +15 -0
  361. package/lib/idx/util.d.ts +11 -0
  362. package/lib/oidc/endpoints/well-known.d.ts +3 -3
  363. package/lib/oidc/exchangeCodeForTokens.d.ts +2 -2
  364. package/lib/oidc/getToken.d.ts +2 -2
  365. package/lib/oidc/getWithPopup.d.ts +2 -2
  366. package/lib/oidc/getWithRedirect.d.ts +2 -2
  367. package/lib/oidc/getWithoutPrompt.d.ts +2 -2
  368. package/lib/oidc/handleOAuthResponse.d.ts +2 -2
  369. package/lib/oidc/renewToken.d.ts +2 -2
  370. package/lib/oidc/renewTokensWithRefresh.d.ts +2 -2
  371. package/lib/oidc/revokeToken.d.ts +2 -2
  372. package/lib/oidc/util/browser.d.ts +2 -2
  373. package/lib/oidc/util/defaultTokenParams.d.ts +2 -2
  374. package/lib/oidc/util/errors.d.ts +2 -2
  375. package/lib/oidc/util/loginRedirect.d.ts +4 -4
  376. package/lib/oidc/util/oauth.d.ts +4 -4
  377. package/lib/oidc/util/oauthMeta.d.ts +2 -2
  378. package/lib/oidc/util/prepareTokenParams.d.ts +5 -5
  379. package/lib/oidc/util/validateClaims.d.ts +2 -2
  380. package/lib/oidc/verifyToken.d.ts +2 -2
  381. package/lib/options/browser.d.ts +16 -0
  382. package/lib/options/index.d.ts +14 -0
  383. package/lib/options/node.d.ts +16 -0
  384. package/lib/services/AutoRenewService.d.ts +27 -0
  385. package/lib/services/{TokenService.d.ts → SyncStorageService.d.ts} +8 -5
  386. package/lib/services/index.d.ts +13 -0
  387. package/lib/types/OktaAuthOptions.d.ts +6 -2
  388. package/lib/types/Service.d.ts +23 -0
  389. package/lib/types/Storage.d.ts +7 -5
  390. package/lib/types/Transaction.d.ts +2 -10
  391. package/lib/types/api.d.ts +23 -10
  392. package/lib/types/index.d.ts +1 -1
  393. package/lib/util/sharedStorage.d.ts +1 -1
  394. package/package.json +32 -14
  395. package/polyfill/index.js +1 -0
  396. package/cjs/services/TokenService.js +0 -111
  397. package/cjs/services/TokenService.js.map +0 -1
  398. package/esm/index.js.map +0 -1
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
+
5
+ exports.parseIdxResponse = exports.parseNonRemediations = void 0;
6
+
7
+ var _fromEntries = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/from-entries"));
8
+
9
+ var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
10
+
11
+ var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
12
+
13
+ var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
14
+
15
+ var _entries = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/entries"));
16
+
17
+ var _remediationParser = require("./remediationParser");
18
+
19
+ var _generateIdxAction = _interopRequireDefault(require("./generateIdxAction"));
20
+
21
+ var _jsonpathPlus = require("jsonpath-plus");
22
+
23
+ var _context;
24
+
25
+ const SKIP_FIELDS = (0, _fromEntries.default)((0, _map.default)(_context = ['remediation', // remediations are put into proceed/neededToProceed
26
+ 'context' // the API response of 'context' isn't externally useful. We ignore it and put all non-action (contextual) info into idxState.context
27
+ ]).call(_context, field => [field, !!'skip this field']));
28
+
29
+ const parseNonRemediations = function parseNonRemediations(idxResponse, toPersist = {}) {
30
+ var _context2;
31
+
32
+ const actions = {};
33
+ const context = {};
34
+ (0, _filter.default)(_context2 = (0, _keys.default)(idxResponse)).call(_context2, field => !SKIP_FIELDS[field]).forEach(field => {
35
+ const fieldIsObject = typeof idxResponse[field] === 'object' && !!idxResponse[field];
36
+
37
+ if (!fieldIsObject) {
38
+ // simple fields are contextual info
39
+ context[field] = idxResponse[field];
40
+ return;
41
+ }
42
+
43
+ if (idxResponse[field].rel) {
44
+ // top level actions
45
+ actions[idxResponse[field].name] = (0, _generateIdxAction.default)(idxResponse[field], toPersist);
46
+ return;
47
+ }
48
+
49
+ const {
50
+ value: fieldValue,
51
+ type,
52
+ ...info
53
+ } = idxResponse[field];
54
+ context[field] = {
55
+ type,
56
+ ...info
57
+ }; // add the non-action parts as context
58
+
59
+ if (type !== 'object') {
60
+ // only object values hold actions
61
+ context[field].value = fieldValue;
62
+ return;
63
+ } // We are an object field containing an object value
64
+
65
+
66
+ context[field].value = {};
67
+ (0, _entries.default)(fieldValue).forEach(([subField, value]) => {
68
+ if (value.rel) {
69
+ // is [field].value[subField] an action?
70
+ // add any "action" value subfields to actions
71
+ actions[`${field}-${subField.name || subField}`] = (0, _generateIdxAction.default)(value, toPersist);
72
+ } else {
73
+ // add non-action value subfields to context
74
+ context[field].value[subField] = value;
75
+ }
76
+ });
77
+ });
78
+ return {
79
+ context,
80
+ actions
81
+ };
82
+ };
83
+
84
+ exports.parseNonRemediations = parseNonRemediations;
85
+
86
+ const expandRelatesTo = (idxResponse, value) => {
87
+ (0, _keys.default)(value).forEach(k => {
88
+ if (k === 'relatesTo') {
89
+ const query = Array.isArray(value[k]) ? value[k][0] : value[k];
90
+
91
+ if (typeof query === 'string') {
92
+ // eslint-disable-next-line new-cap
93
+ const result = (0, _jsonpathPlus.JSONPath)({
94
+ path: query,
95
+ json: idxResponse
96
+ })[0];
97
+
98
+ if (result) {
99
+ value[k] = result;
100
+ return;
101
+ }
102
+ }
103
+ }
104
+
105
+ if (Array.isArray(value[k])) {
106
+ value[k].forEach(innerValue => expandRelatesTo(idxResponse, innerValue));
107
+ }
108
+ });
109
+ };
110
+
111
+ const convertRemediationAction = (remediation, toPersist) => {
112
+ const remediationActions = (0, _remediationParser.generateRemediationFunctions)([remediation], toPersist);
113
+ const actionFn = remediationActions[remediation.name];
114
+ return { ...remediation,
115
+ action: actionFn
116
+ };
117
+ };
118
+
119
+ const parseIdxResponse = function parseIdxResponse(idxResponse, toPersist = {}) {
120
+ var _idxResponse$remediat;
121
+
122
+ const remediationData = ((_idxResponse$remediat = idxResponse.remediation) === null || _idxResponse$remediat === void 0 ? void 0 : _idxResponse$remediat.value) || [];
123
+ remediationData.forEach(remediation => expandRelatesTo(idxResponse, remediation));
124
+ const remediations = (0, _map.default)(remediationData).call(remediationData, remediation => convertRemediationAction(remediation, toPersist));
125
+ const {
126
+ context,
127
+ actions
128
+ } = parseNonRemediations(idxResponse, toPersist);
129
+ return {
130
+ remediations,
131
+ context,
132
+ actions
133
+ };
134
+ };
135
+
136
+ exports.parseIdxResponse = parseIdxResponse;
137
+ //# sourceMappingURL=idxResponseParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../lib/idx/idx-js/v1/idxResponseParser.ts"],"names":["SKIP_FIELDS","field","parseNonRemediations","idxResponse","toPersist","actions","context","forEach","fieldIsObject","rel","name","value","fieldValue","type","info","subField","expandRelatesTo","k","query","Array","isArray","result","path","json","innerValue","convertRemediationAction","remediation","remediationActions","actionFn","action","parseIdxResponse","remediationData","remediations"],"mappings":"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","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\n/* eslint-disable max-len */\n// @ts-nocheck\nimport { generateRemediationFunctions } from './remediationParser';\nimport generateIdxAction from './generateIdxAction';\nimport { JSONPath } from 'jsonpath-plus';\n\nconst SKIP_FIELDS = Object.fromEntries([\n 'remediation', // remediations are put into proceed/neededToProceed\n 'context', // the API response of 'context' isn't externally useful. We ignore it and put all non-action (contextual) info into idxState.context\n].map( (field) => [ field, !!'skip this field' ] ));\n\nexport const parseNonRemediations = function parseNonRemediations( idxResponse, toPersist = {} ) {\n const actions = {};\n const context = {};\n\n Object.keys(idxResponse)\n .filter( field => !SKIP_FIELDS[field])\n .forEach( field => {\n const fieldIsObject = typeof idxResponse[field] === 'object' && !!idxResponse[field];\n\n if ( !fieldIsObject ) {\n // simple fields are contextual info\n context[field] = idxResponse[field];\n return;\n }\n\n if ( idxResponse[field].rel ) {\n // top level actions\n actions[idxResponse[field].name] = generateIdxAction(idxResponse[field], toPersist);\n return;\n }\n\n const { value: fieldValue, type, ...info} = idxResponse[field];\n context[field] = { type, ...info}; // add the non-action parts as context\n\n if ( type !== 'object' ) {\n // only object values hold actions\n context[field].value = fieldValue;\n return;\n }\n\n // We are an object field containing an object value\n context[field].value = {};\n Object.entries(fieldValue)\n .forEach( ([subField, value]) => {\n if (value.rel) { // is [field].value[subField] an action?\n // add any \"action\" value subfields to actions\n actions[`${field}-${subField.name || subField}`] = generateIdxAction(value, toPersist);\n } else {\n // add non-action value subfields to context\n context[field].value[subField] = value;\n }\n });\n });\n\n return { context, actions };\n};\n\nconst expandRelatesTo = (idxResponse, value) => {\n Object.keys(value).forEach(k => {\n if (k === 'relatesTo') {\n const query = Array.isArray(value[k]) ? value[k][0] : value[k];\n if (typeof query === 'string') {\n // eslint-disable-next-line new-cap\n const result = JSONPath({ path: query, json: idxResponse })[0];\n if (result) {\n value[k] = result;\n return;\n }\n }\n }\n if (Array.isArray(value[k])) {\n value[k].forEach(innerValue => expandRelatesTo(idxResponse, innerValue));\n }\n });\n};\n\nconst convertRemediationAction = (remediation, toPersist) => {\n const remediationActions = generateRemediationFunctions( [remediation], toPersist );\n const actionFn = remediationActions[remediation.name];\n return {\n ...remediation,\n action: actionFn,\n };\n};\n\nexport const parseIdxResponse = function parseIdxResponse( idxResponse, toPersist = {} ): {\n remediations: IdxRemediation[];\n context: IdxContext;\n actions: IdxActions;\n} {\n const remediationData = idxResponse.remediation?.value || [];\n\n remediationData.forEach(\n remediation => expandRelatesTo(idxResponse, remediation)\n );\n\n const remediations = remediationData.map(remediation => convertRemediationAction( remediation, toPersist ));\n\n const { context, actions } = parseNonRemediations( idxResponse, toPersist );\n\n return {\n remediations,\n context,\n actions,\n };\n};\n"],"file":"idxResponseParser.js"}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
+
5
+ exports.makeIdxState = makeIdxState;
6
+
7
+ var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
8
+
9
+ var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
10
+
11
+ var _idxResponseParser = require("./idxResponseParser");
12
+
13
+ /*!
14
+ * Copyright (c) 2021-Present, Okta, Inc. and/or its affiliates. All rights reserved.
15
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
16
+ *
17
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
18
+ * Unless required by applicable law or agreed to in writing, software
19
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
20
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ *
22
+ * See the License for the specific language governing permissions and limitations under the License.
23
+ */
24
+ function makeIdxState(idxResponse, toPersist, requestDidSucceed) {
25
+ var _rawIdxResponse$succe, _rawIdxResponse$succe2, _rawIdxResponse$succe3;
26
+
27
+ const rawIdxResponse = idxResponse;
28
+ const {
29
+ remediations,
30
+ context,
31
+ actions
32
+ } = (0, _idxResponseParser.parseIdxResponse)(idxResponse, toPersist);
33
+ const neededToProceed = [...remediations];
34
+
35
+ const proceed = async function (remediationChoice, paramsFromUser = {}) {
36
+ /*
37
+ remediationChoice is the name attribute on each form
38
+ name should remain unique for items inside the remediation that are considered forms(identify, select-factor)
39
+ name can be duplicate for items like redirect where its not considered a form(redirect)
40
+ when names are not unique its a redirect to a href, so widget wont POST to idx-js layer.
41
+ */
42
+ const remediationChoiceObject = (0, _find.default)(remediations).call(remediations, remediation => remediation.name === remediationChoice);
43
+
44
+ if (!remediationChoiceObject) {
45
+ return _promise.default.reject(`Unknown remediation choice: [${remediationChoice}]`);
46
+ }
47
+
48
+ return remediationChoiceObject.action(paramsFromUser);
49
+ };
50
+
51
+ const findCode = item => item.name === 'interaction_code';
52
+
53
+ const interactionCode = (_rawIdxResponse$succe = rawIdxResponse.successWithInteractionCode) === null || _rawIdxResponse$succe === void 0 ? void 0 : (_rawIdxResponse$succe2 = _rawIdxResponse$succe.value) === null || _rawIdxResponse$succe2 === void 0 ? void 0 : (_rawIdxResponse$succe3 = (0, _find.default)(_rawIdxResponse$succe2).call(_rawIdxResponse$succe2, findCode)) === null || _rawIdxResponse$succe3 === void 0 ? void 0 : _rawIdxResponse$succe3.value;
54
+ return {
55
+ proceed,
56
+ neededToProceed,
57
+ actions,
58
+ context,
59
+ rawIdxState: rawIdxResponse,
60
+ interactionCode,
61
+ toPersist,
62
+ requestDidSucceed
63
+ };
64
+ }
65
+ //# sourceMappingURL=makeIdxState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../lib/idx/idx-js/v1/makeIdxState.ts"],"names":["makeIdxState","idxResponse","toPersist","requestDidSucceed","rawIdxResponse","remediations","context","actions","neededToProceed","proceed","remediationChoice","paramsFromUser","remediationChoiceObject","remediation","name","reject","action","findCode","item","interactionCode","successWithInteractionCode","value","rawIdxState"],"mappings":";;;;;;;;;;AAaA;;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKO,SAASA,YAAT,CAAuBC,WAAvB,EAAoDC,SAApD,EAA+DC,iBAA/D,EAAyG;AAAA;;AAC9G,QAAMC,cAAc,GAAIH,WAAxB;AACA,QAAM;AAAEI,IAAAA,YAAF;AAAgBC,IAAAA,OAAhB;AAAyBC,IAAAA;AAAzB,MAAqC,yCAAkBN,WAAlB,EAA+BC,SAA/B,CAA3C;AACA,QAAMM,eAAe,GAAG,CAAC,GAAGH,YAAJ,CAAxB;;AAEA,QAAMI,OAA+B,GAAG,gBAAgBC,iBAAhB,EAAmCC,cAAc,GAAG,EAApD,EAAyD;AAC/F;AACJ;AACA;AACA;AACA;AACA;AACI,UAAMC,uBAAuB,GAAG,mBAAAP,YAAY,MAAZ,CAAAA,YAAY,EAAOQ,WAAD,IAAiBA,WAAW,CAACC,IAAZ,KAAqBJ,iBAA5C,CAA5C;;AACA,QAAK,CAACE,uBAAN,EAAgC;AAC9B,aAAO,iBAAQG,MAAR,CAAgB,gCAA+BL,iBAAkB,GAAjE,CAAP;AACD;;AAED,WAAOE,uBAAuB,CAACI,MAAxB,CAA+BL,cAA/B,CAAP;AACD,GAbD;;AAeA,QAAMM,QAAQ,GAAGC,IAAI,IAAIA,IAAI,CAACJ,IAAL,KAAc,kBAAvC;;AACA,QAAMK,eAAe,4BAAGf,cAAc,CAACgB,0BAAlB,oFAAG,sBAA2CC,KAA9C,qFAAG,wEAAwDJ,QAAxD,CAAH,2DAAG,uBAAoEI,KAA5F;AAEA,SAAO;AACLZ,IAAAA,OADK;AAELD,IAAAA,eAFK;AAGLD,IAAAA,OAHK;AAILD,IAAAA,OAJK;AAKLgB,IAAAA,WAAW,EAAElB,cALR;AAMLe,IAAAA,eANK;AAOLjB,IAAAA,SAPK;AAQLC,IAAAA;AARK,GAAP;AAUD","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 { IdxResponse, RawIdxResponse } from '../../types/idx-js';\nimport { parseIdxResponse } from './idxResponseParser';\n\nexport function makeIdxState( idxResponse: RawIdxResponse, toPersist, requestDidSucceed: boolean ): IdxResponse {\n const rawIdxResponse = idxResponse;\n const { remediations, context, actions } = parseIdxResponse( idxResponse, toPersist );\n const neededToProceed = [...remediations];\n\n const proceed: IdxResponse['proceed'] = async function( remediationChoice, paramsFromUser = {} ) {\n /*\n remediationChoice is the name attribute on each form\n name should remain unique for items inside the remediation that are considered forms(identify, select-factor)\n name can be duplicate for items like redirect where its not considered a form(redirect)\n when names are not unique its a redirect to a href, so widget wont POST to idx-js layer.\n */\n const remediationChoiceObject = remediations.find((remediation) => remediation.name === remediationChoice);\n if ( !remediationChoiceObject ) {\n return Promise.reject(`Unknown remediation choice: [${remediationChoice}]`);\n }\n\n return remediationChoiceObject.action(paramsFromUser);\n };\n\n const findCode = item => item.name === 'interaction_code';\n const interactionCode = rawIdxResponse.successWithInteractionCode?.value?.find( findCode )?.value as string;\n\n return {\n proceed,\n neededToProceed,\n actions,\n context,\n rawIdxState: rawIdxResponse,\n interactionCode,\n toPersist,\n requestDidSucceed,\n };\n}\n"],"file":"makeIdxState.js"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+
5
+ var _makeIdxState = require("./makeIdxState");
6
+
7
+ /*!
8
+ * Copyright (c) 2021-Present, Okta, Inc. and/or its affiliates. All rights reserved.
9
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
10
+ *
11
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ *
16
+ * See the License for the specific language governing permissions and limitations under the License.
17
+ */
18
+ // @ts-nocheck
19
+ var _default = {
20
+ makeIdxState: _makeIdxState.makeIdxState
21
+ };
22
+ exports.default = _default;
23
+ module.exports = exports.default;
24
+ //# sourceMappingURL=parsers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../lib/idx/idx-js/v1/parsers.ts"],"names":["makeIdxState"],"mappings":";;;;AAaA;;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;eAGe;AACbA,EAAAA,YAAY,EAAZA;AADa,C","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\n// @ts-nocheck\nimport { makeIdxState } from './makeIdxState';\n\nexport default {\n makeIdxState,\n};\n"],"file":"parsers.js"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
+
5
+ exports.generateRemediationFunctions = void 0;
6
+
7
+ var _fromEntries = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/from-entries"));
8
+
9
+ var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
10
+
11
+ var _generateIdxAction = _interopRequireDefault(require("./generateIdxAction"));
12
+
13
+ /*!
14
+ * Copyright (c) 2021-Present, Okta, Inc. and/or its affiliates. All rights reserved.
15
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
16
+ *
17
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
18
+ * Unless required by applicable law or agreed to in writing, software
19
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
20
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ *
22
+ * See the License for the specific language governing permissions and limitations under the License.
23
+ */
24
+ // @ts-nocheck
25
+ const generateRemediationFunctions = function generateRemediationFunctions(remediationValue, toPersist = {}) {
26
+ return (0, _fromEntries.default)((0, _map.default)(remediationValue).call(remediationValue, remediation => {
27
+ return [remediation.name, (0, _generateIdxAction.default)(remediation, toPersist)];
28
+ }));
29
+ };
30
+
31
+ exports.generateRemediationFunctions = generateRemediationFunctions;
32
+ //# sourceMappingURL=remediationParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../lib/idx/idx-js/v1/remediationParser.ts"],"names":["generateRemediationFunctions","remediationValue","toPersist","remediation","name"],"mappings":";;;;;;;;;;AAaA;;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAGO,MAAMA,4BAA4B,GAAG,SAASA,4BAAT,CAAuCC,gBAAvC,EAAyDC,SAAS,GAAG,EAArE,EAA0E;AAEpH,SAAO,0BAAoB,kBAAAD,gBAAgB,MAAhB,CAAAA,gBAAgB,EAAME,WAAW,IAAI;AAC9D,WAAO,CACLA,WAAW,CAACC,IADP,EAEL,gCAAkBD,WAAlB,EAA+BD,SAA/B,CAFK,CAAP;AAID,GAL0C,CAApC,CAAP;AAMD,CARM","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\n// @ts-nocheck\nimport generateIdxAction from './generateIdxAction';\n\nexport const generateRemediationFunctions = function generateRemediationFunctions( remediationValue, toPersist = {} ) {\n\n return Object.fromEntries( remediationValue.map( remediation => {\n return [\n remediation.name,\n generateIdxAction(remediation, toPersist),\n ];\n }) );\n};\n"],"file":"remediationParser.js"}
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"}