@okta/okta-auth-js 6.7.5 → 6.8.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 (220) hide show
  1. package/CHANGELOG.md +28 -1
  2. package/README.md +3 -2
  3. package/cjs/AuthStateManager.js +1 -1
  4. package/cjs/AuthStateManager.js.map +1 -1
  5. package/cjs/OktaAuth.js +1 -8
  6. package/cjs/OktaAuth.js.map +1 -1
  7. package/cjs/OktaUserAgent.js +2 -2
  8. package/cjs/OktaUserAgent.js.map +1 -1
  9. package/cjs/PromiseQueue.js.map +1 -1
  10. package/cjs/SavedObject.js +4 -1
  11. package/cjs/SavedObject.js.map +1 -1
  12. package/cjs/ServiceManager.js.map +1 -1
  13. package/cjs/StorageManager.js.map +1 -1
  14. package/cjs/TokenManager.js +2 -1
  15. package/cjs/TokenManager.js.map +1 -1
  16. package/cjs/TransactionManager.js.map +1 -1
  17. package/cjs/browser/browserStorage.js +3 -0
  18. package/cjs/browser/browserStorage.js.map +1 -1
  19. package/cjs/browser/fingerprint.js.map +1 -1
  20. package/cjs/constants.js +1 -1
  21. package/cjs/crypto/base64.js +4 -4
  22. package/cjs/crypto/base64.js.map +1 -1
  23. package/cjs/crypto/oidcHash.js.map +1 -1
  24. package/cjs/crypto/verifyToken.js.map +1 -1
  25. package/cjs/crypto/webauthn.js +1 -1
  26. package/cjs/crypto/webauthn.js.map +1 -1
  27. package/cjs/errors/index.js +2 -2
  28. package/cjs/features.js +6 -6
  29. package/cjs/features.js.map +1 -1
  30. package/cjs/http/request.js +1 -1
  31. package/cjs/http/request.js.map +1 -1
  32. package/cjs/idx/authenticate.js.map +1 -1
  33. package/cjs/idx/authenticator/OktaPassword.js +5 -4
  34. package/cjs/idx/authenticator/OktaPassword.js.map +1 -1
  35. package/cjs/idx/authenticator/getAuthenticator.js.map +1 -1
  36. package/cjs/idx/authenticator/util.js +1 -1
  37. package/cjs/idx/authenticator/util.js.map +1 -1
  38. package/cjs/idx/cancel.js.map +1 -1
  39. package/cjs/idx/emailVerify.js +3 -3
  40. package/cjs/idx/emailVerify.js.map +1 -1
  41. package/cjs/idx/idxState/index.js +1 -1
  42. package/cjs/idx/idxState/v1/generateIdxAction.js.map +1 -1
  43. package/cjs/idx/idxState/v1/idxResponseParser.js +1 -1
  44. package/cjs/idx/idxState/v1/idxResponseParser.js.map +1 -1
  45. package/cjs/idx/idxState/v1/makeIdxState.js.map +1 -1
  46. package/cjs/idx/idxState/v1/remediationParser.js.map +1 -1
  47. package/cjs/idx/index.js +24 -24
  48. package/cjs/idx/interact.js.map +1 -1
  49. package/cjs/idx/introspect.js.map +1 -1
  50. package/cjs/idx/poll.js.map +1 -1
  51. package/cjs/idx/proceed.js.map +1 -1
  52. package/cjs/idx/recoverPassword.js.map +1 -1
  53. package/cjs/idx/register.js.map +1 -1
  54. package/cjs/idx/remediate.js.map +1 -1
  55. package/cjs/idx/remediators/AuthenticatorEnrollmentData.js.map +1 -1
  56. package/cjs/idx/remediators/Base/AuthenticatorData.js.map +1 -1
  57. package/cjs/idx/remediators/Base/Remediator.js.map +1 -1
  58. package/cjs/idx/remediators/Base/SelectAuthenticator.js.map +1 -1
  59. package/cjs/idx/remediators/Base/VerifyAuthenticator.js.map +1 -1
  60. package/cjs/idx/remediators/EnrollProfile.js +46 -4
  61. package/cjs/idx/remediators/EnrollProfile.js.map +1 -1
  62. package/cjs/idx/remediators/GenericRemediator/util.js +1 -1
  63. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js.map +1 -1
  64. package/cjs/idx/remediators/SelectEnrollmentChannel.js.map +1 -1
  65. package/cjs/idx/remediators/util.js +1 -1
  66. package/cjs/idx/run.js.map +1 -1
  67. package/cjs/idx/startTransaction.js.map +1 -1
  68. package/cjs/idx/transactionMeta.js +3 -3
  69. package/cjs/idx/transactionMeta.js.map +1 -1
  70. package/cjs/idx/types/api.js +1 -1
  71. package/cjs/idx/types/idx-js.js +1 -1
  72. package/cjs/idx/types/idx-js.js.map +1 -1
  73. package/cjs/idx/unlockAccount.js.map +1 -1
  74. package/cjs/idx/util.js +25 -17
  75. package/cjs/idx/util.js.map +1 -1
  76. package/cjs/myaccount/emailApi.js +1 -1
  77. package/cjs/myaccount/emailApi.js.map +1 -1
  78. package/cjs/myaccount/phoneApi.js +1 -1
  79. package/cjs/myaccount/phoneApi.js.map +1 -1
  80. package/cjs/myaccount/profileApi.js +1 -1
  81. package/cjs/myaccount/profileApi.js.map +1 -1
  82. package/cjs/myaccount/request.js +1 -1
  83. package/cjs/myaccount/request.js.map +1 -1
  84. package/cjs/myaccount/transactions/EmailChallengeTransaction.js.map +1 -1
  85. package/cjs/myaccount/transactions/EmailTransaction.js.map +1 -1
  86. package/cjs/myaccount/transactions/PhoneTransaction.js.map +1 -1
  87. package/cjs/myaccount/transactions/index.js +14 -14
  88. package/cjs/myaccount/types.js +14 -13
  89. package/cjs/myaccount/types.js.map +1 -1
  90. package/cjs/oidc/decodeToken.js.map +1 -1
  91. package/cjs/oidc/endpoints/authorize.js +1 -1
  92. package/cjs/oidc/endpoints/authorize.js.map +1 -1
  93. package/cjs/oidc/endpoints/token.js +1 -1
  94. package/cjs/oidc/endpoints/token.js.map +1 -1
  95. package/cjs/oidc/endpoints/well-known.js +1 -1
  96. package/cjs/oidc/endpoints/well-known.js.map +1 -1
  97. package/cjs/oidc/exchangeCodeForTokens.js.map +1 -1
  98. package/cjs/oidc/getToken.js.map +1 -1
  99. package/cjs/oidc/getUserInfo.js.map +1 -1
  100. package/cjs/oidc/getWithPopup.js.map +1 -1
  101. package/cjs/oidc/getWithRedirect.js.map +1 -1
  102. package/cjs/oidc/getWithoutPrompt.js.map +1 -1
  103. package/cjs/oidc/handleOAuthResponse.js.map +1 -1
  104. package/cjs/oidc/index.js +24 -24
  105. package/cjs/oidc/parseFromUrl.js +2 -2
  106. package/cjs/oidc/parseFromUrl.js.map +1 -1
  107. package/cjs/oidc/renewToken.js.map +1 -1
  108. package/cjs/oidc/renewTokens.js.map +1 -1
  109. package/cjs/oidc/renewTokensWithRefresh.js.map +1 -1
  110. package/cjs/oidc/revokeToken.js.map +1 -1
  111. package/cjs/oidc/util/browser.js +2 -2
  112. package/cjs/oidc/util/defaultTokenParams.js.map +1 -1
  113. package/cjs/oidc/util/errors.js +1 -1
  114. package/cjs/oidc/util/errors.js.map +1 -1
  115. package/cjs/oidc/util/loginRedirect.js +5 -5
  116. package/cjs/oidc/util/oauth.js +1 -1
  117. package/cjs/oidc/util/oauth.js.map +1 -1
  118. package/cjs/oidc/util/oauthMeta.js.map +1 -1
  119. package/cjs/oidc/util/pkce.js.map +1 -1
  120. package/cjs/oidc/util/prepareTokenParams.js +1 -1
  121. package/cjs/oidc/util/prepareTokenParams.js.map +1 -1
  122. package/cjs/oidc/util/refreshToken.js +1 -1
  123. package/cjs/oidc/util/refreshToken.js.map +1 -1
  124. package/cjs/oidc/util/validateToken.js.map +1 -1
  125. package/cjs/oidc/verifyToken.js.map +1 -1
  126. package/cjs/options/browser.js +2 -2
  127. package/cjs/options/browser.js.map +1 -1
  128. package/cjs/options/index.js +1 -1
  129. package/cjs/options/index.js.map +1 -1
  130. package/cjs/options/node.js +2 -2
  131. package/cjs/server/serverStorage.js +1 -0
  132. package/cjs/server/serverStorage.js.map +1 -1
  133. package/cjs/services/AutoRenewService.js.map +1 -1
  134. package/cjs/services/LeaderElectionService.js.map +1 -1
  135. package/cjs/services/SyncStorageService.js +4 -1
  136. package/cjs/services/SyncStorageService.js.map +1 -1
  137. package/cjs/session.js +2 -2
  138. package/cjs/session.js.map +1 -1
  139. package/cjs/tx/AuthTransaction.js.map +1 -1
  140. package/cjs/tx/api.js +4 -4
  141. package/cjs/tx/api.js.map +1 -1
  142. package/cjs/tx/poll.js.map +1 -1
  143. package/cjs/types/Storage.js.map +1 -1
  144. package/cjs/types/Token.js +1 -1
  145. package/cjs/types/TokenManager.js +1 -1
  146. package/cjs/types/Transaction.js +2 -2
  147. package/cjs/util/console.js +3 -3
  148. package/cjs/util/index.js +13 -0
  149. package/cjs/util/index.js.map +1 -1
  150. package/cjs/util/misc.js +2 -2
  151. package/cjs/util/object.js +3 -3
  152. package/cjs/util/sharedStorage.js +2 -2
  153. package/cjs/util/sharedStorage.js.map +1 -1
  154. package/cjs/util/storage.js +29 -0
  155. package/cjs/util/storage.js.map +1 -0
  156. package/cjs/util/types.js +3 -3
  157. package/cjs/util/url.js +3 -3
  158. package/cjs/util/url.js.map +1 -1
  159. package/dist/myaccount.umd.js +1 -1
  160. package/dist/myaccount.umd.js.map +1 -1
  161. package/dist/okta-auth-js.min.js +1 -1
  162. package/dist/okta-auth-js.min.js.map +1 -1
  163. package/dist/okta-auth-js.polyfill.js +1 -1
  164. package/dist/okta-auth-js.polyfill.js.map +1 -1
  165. package/dist/okta-auth-js.umd.js +1 -1
  166. package/dist/okta-auth-js.umd.js.map +1 -1
  167. package/esm/browser/OktaAuth.js +0 -3
  168. package/esm/browser/OktaAuth.js.map +1 -1
  169. package/esm/browser/OktaUserAgent.js +2 -2
  170. package/esm/browser/SavedObject.js +2 -1
  171. package/esm/browser/SavedObject.js.map +1 -1
  172. package/esm/browser/TokenManager.js.map +1 -1
  173. package/esm/browser/browser/browserStorage.js.map +1 -1
  174. package/esm/browser/idx/authenticator/OktaPassword.js +4 -4
  175. package/esm/browser/idx/authenticator/OktaPassword.js.map +1 -1
  176. package/esm/browser/idx/remediators/Base/Remediator.js.map +1 -1
  177. package/esm/browser/idx/remediators/EnrollProfile.js +26 -0
  178. package/esm/browser/idx/remediators/EnrollProfile.js.map +1 -1
  179. package/esm/browser/idx/types/idx-js.js.map +1 -1
  180. package/esm/browser/idx/util.js +10 -3
  181. package/esm/browser/idx/util.js.map +1 -1
  182. package/esm/browser/index.js +1 -0
  183. package/esm/browser/index.js.map +1 -1
  184. package/esm/browser/services/SyncStorageService.js +1 -1
  185. package/esm/browser/services/SyncStorageService.js.map +1 -1
  186. package/esm/browser/util/storage.js +26 -0
  187. package/esm/browser/util/storage.js.map +1 -0
  188. package/esm/browser/util/url.js +1 -1
  189. package/esm/browser/util/url.js.map +1 -1
  190. package/esm/node/OktaAuth.js +0 -3
  191. package/esm/node/OktaAuth.js.map +1 -1
  192. package/esm/node/OktaUserAgent.js +2 -2
  193. package/esm/node/SavedObject.js +2 -1
  194. package/esm/node/SavedObject.js.map +1 -1
  195. package/esm/node/TokenManager.js.map +1 -1
  196. package/esm/node/browser/browserStorage.js.map +1 -1
  197. package/esm/node/idx/authenticator/OktaPassword.js +4 -4
  198. package/esm/node/idx/authenticator/OktaPassword.js.map +1 -1
  199. package/esm/node/idx/remediators/Base/Remediator.js.map +1 -1
  200. package/esm/node/idx/remediators/EnrollProfile.js +26 -0
  201. package/esm/node/idx/remediators/EnrollProfile.js.map +1 -1
  202. package/esm/node/idx/types/idx-js.js.map +1 -1
  203. package/esm/node/idx/util.js +10 -3
  204. package/esm/node/idx/util.js.map +1 -1
  205. package/esm/node/index.js +1 -0
  206. package/esm/node/index.js.map +1 -1
  207. package/esm/node/server/serverStorage.js.map +1 -1
  208. package/esm/node/services/SyncStorageService.js +1 -1
  209. package/esm/node/services/SyncStorageService.js.map +1 -1
  210. package/esm/node/util/storage.js +26 -0
  211. package/esm/node/util/storage.js.map +1 -0
  212. package/esm/node/util/url.js +1 -1
  213. package/esm/node/util/url.js.map +1 -1
  214. package/esm/package.json +1 -1
  215. package/lib/idx/authenticator/OktaPassword.d.ts +1 -0
  216. package/lib/idx/remediators/EnrollProfile.d.ts +11 -0
  217. package/lib/idx/types/idx-js.d.ts +4 -0
  218. package/lib/util/index.d.ts +1 -0
  219. package/lib/util/storage.d.ts +12 -0
  220. package/package.json +15 -26
@@ -1 +1 @@
1
- {"version":3,"file":"webauthn.js","names":["getEnrolledCredentials","authenticatorEnrollments","credentials","forEach","enrollement","key","push","type","id","credentialId","buildCredentialCreationOptions","activationData","publicKey","rp","user","name","displayName","challenge","pubKeyCredParams","attestation","authenticatorSelection","excludeCredentials","buildCredentialRequestOptions","challengeData","userVerification","allowCredentials","getAttestation","credential","response","clientData","clientDataJSON","attestationObject","getAssertion","authenticatorData","signatureData","signature"],"sources":["../../../lib/crypto/webauthn.ts"],"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\nimport { base64UrlToBuffer, bufferToBase64Url } from './base64';\nimport { ActivationData, ChallengeData, IdxAuthenticator } from '../idx/types';\n\n// Get known credentials from list of enrolled authenticators\nconst getEnrolledCredentials = (authenticatorEnrollments: IdxAuthenticator[] = []) => {\n const credentials: PublicKeyCredentialDescriptor[] = [];\n authenticatorEnrollments.forEach((enrollement) => {\n if (enrollement.key === 'webauthn') {\n credentials.push({\n type: 'public-key',\n id: base64UrlToBuffer(enrollement.credentialId),\n });\n }\n });\n return credentials;\n};\n\n// Build options for navigator.credentials.create\n// https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer/create\nexport const buildCredentialCreationOptions = (\n activationData: ActivationData, authenticatorEnrollments: IdxAuthenticator[]\n) => {\n return {\n publicKey: {\n rp: activationData.rp,\n user: {\n id: base64UrlToBuffer(activationData.user.id),\n name: activationData.user.name,\n displayName: activationData.user.displayName\n },\n challenge: base64UrlToBuffer(activationData.challenge),\n pubKeyCredParams: activationData.pubKeyCredParams,\n attestation: activationData.attestation,\n authenticatorSelection: activationData.authenticatorSelection,\n excludeCredentials: getEnrolledCredentials(authenticatorEnrollments),\n }\n } as CredentialCreationOptions;\n};\n\n\n// Build options for navigator.credentials.get\n// https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer/get\nexport const buildCredentialRequestOptions = (\n challengeData: ChallengeData, authenticatorEnrollments: IdxAuthenticator[]\n) => {\n return {\n publicKey: {\n challenge: base64UrlToBuffer(challengeData.challenge),\n userVerification: challengeData.userVerification,\n allowCredentials: getEnrolledCredentials(authenticatorEnrollments),\n }\n } as CredentialRequestOptions;\n};\n\n// Build attestation for webauthn enroll\n// https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorAttestationResponse\nexport const getAttestation = (credential: PublicKeyCredential) => {\n const response = credential.response as AuthenticatorAttestationResponse;\n const id = credential.id;\n const clientData = bufferToBase64Url(response.clientDataJSON);\n const attestation = bufferToBase64Url(response.attestationObject);\n return {\n id,\n clientData,\n attestation\n };\n};\n\n// Build assertion for webauthn verification\n// https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorAssertionResponse\nexport const getAssertion = (credential: PublicKeyCredential) => {\n const response = credential.response as AuthenticatorAssertionResponse;\n const id = credential.id;\n const clientData = bufferToBase64Url(response.clientDataJSON);\n const authenticatorData = bufferToBase64Url(response.authenticatorData);\n const signatureData = bufferToBase64Url(response.signature);\n return {\n id,\n clientData,\n authenticatorData,\n signatureData\n };\n};\n"],"mappings":";;;;AAYA;;AAZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA,MAAMA,sBAAsB,GAAG,CAACC,wBAA4C,GAAG,EAAhD,KAAuD;EACpF,MAAMC,WAA4C,GAAG,EAArD;EACAD,wBAAwB,CAACE,OAAzB,CAAkCC,WAAD,IAAiB;IAChD,IAAIA,WAAW,CAACC,GAAZ,KAAoB,UAAxB,EAAoC;MAClCH,WAAW,CAACI,IAAZ,CAAiB;QACfC,IAAI,EAAE,YADS;QAEfC,EAAE,EAAE,6BAAkBJ,WAAW,CAACK,YAA9B;MAFW,CAAjB;IAID;EACF,CAPD;EAQA,OAAOP,WAAP;AACD,CAXD,C,CAaA;AACA;;;AACO,MAAMQ,8BAA8B,GAAG,CAC5CC,cAD4C,EACZV,wBADY,KAEzC;EACH,OAAO;IACLW,SAAS,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B,EAAE,GAAGmB,UAAU,CAACnB,EAAtB;EACA,MAAMqB,UAAU,GAAG,6BAAkBD,QAAQ,CAACE,cAA3B,CAAnB;EACA,MAAMG,iBAAiB,GAAG,6BAAkBL,QAAQ,CAACK,iBAA3B,CAA1B;EACA,MAAMC,aAAa,GAAG,6BAAkBN,QAAQ,CAACO,SAA3B,CAAtB;EACA,OAAO;IACL3B,EADK;IAELqB,UAFK;IAGLI,iBAHK;IAILC;EAJK,CAAP;AAMD,CAZM"}
1
+ {"version":3,"file":"webauthn.js","names":["getEnrolledCredentials","authenticatorEnrollments","credentials","forEach","enrollement","key","push","type","id","base64UrlToBuffer","credentialId","buildCredentialCreationOptions","activationData","publicKey","rp","user","name","displayName","challenge","pubKeyCredParams","attestation","authenticatorSelection","excludeCredentials","buildCredentialRequestOptions","challengeData","userVerification","allowCredentials","getAttestation","credential","response","clientData","bufferToBase64Url","clientDataJSON","attestationObject","getAssertion","authenticatorData","signatureData","signature"],"sources":["../../../lib/crypto/webauthn.ts"],"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\nimport { base64UrlToBuffer, bufferToBase64Url } from './base64';\nimport { ActivationData, ChallengeData, IdxAuthenticator } from '../idx/types';\n\n// Get known credentials from list of enrolled authenticators\nconst getEnrolledCredentials = (authenticatorEnrollments: IdxAuthenticator[] = []) => {\n const credentials: PublicKeyCredentialDescriptor[] = [];\n authenticatorEnrollments.forEach((enrollement) => {\n if (enrollement.key === 'webauthn') {\n credentials.push({\n type: 'public-key',\n id: base64UrlToBuffer(enrollement.credentialId),\n });\n }\n });\n return credentials;\n};\n\n// Build options for navigator.credentials.create\n// https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer/create\nexport const buildCredentialCreationOptions = (\n activationData: ActivationData, authenticatorEnrollments: IdxAuthenticator[]\n) => {\n return {\n publicKey: {\n rp: activationData.rp,\n user: {\n id: base64UrlToBuffer(activationData.user.id),\n name: activationData.user.name,\n displayName: activationData.user.displayName\n },\n challenge: base64UrlToBuffer(activationData.challenge),\n pubKeyCredParams: activationData.pubKeyCredParams,\n attestation: activationData.attestation,\n authenticatorSelection: activationData.authenticatorSelection,\n excludeCredentials: getEnrolledCredentials(authenticatorEnrollments),\n }\n } as CredentialCreationOptions;\n};\n\n\n// Build options for navigator.credentials.get\n// https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer/get\nexport const buildCredentialRequestOptions = (\n challengeData: ChallengeData, authenticatorEnrollments: IdxAuthenticator[]\n) => {\n return {\n publicKey: {\n challenge: base64UrlToBuffer(challengeData.challenge),\n userVerification: challengeData.userVerification,\n allowCredentials: getEnrolledCredentials(authenticatorEnrollments),\n }\n } as CredentialRequestOptions;\n};\n\n// Build attestation for webauthn enroll\n// https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorAttestationResponse\nexport const getAttestation = (credential: PublicKeyCredential) => {\n const response = credential.response as AuthenticatorAttestationResponse;\n const id = credential.id;\n const clientData = bufferToBase64Url(response.clientDataJSON);\n const attestation = bufferToBase64Url(response.attestationObject);\n return {\n id,\n clientData,\n attestation\n };\n};\n\n// Build assertion for webauthn verification\n// https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorAssertionResponse\nexport const getAssertion = (credential: PublicKeyCredential) => {\n const response = credential.response as AuthenticatorAssertionResponse;\n const id = credential.id;\n const clientData = bufferToBase64Url(response.clientDataJSON);\n const authenticatorData = bufferToBase64Url(response.authenticatorData);\n const signatureData = bufferToBase64Url(response.signature);\n return {\n id,\n clientData,\n authenticatorData,\n signatureData\n };\n};\n"],"mappings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,SAAhC,CADF;MAETO,gBAAgB,EAAED,aAAa,CAACC,gBAFvB;MAGTC,gBAAgB,EAAE1B,sBAAsB,CAACC,wBAAD;IAH/B;EADN,CAAP;AAOD,CAVM,C,CAYP;AACA;;;;;AACO,MAAM0B,cAAc,GAAIC,UAAD,IAAqC;EACjE,MAAMC,QAAQ,GAAGD,UAAU,CAACC,QAA5B;EACA,MAAMrB,EAAE,GAAGoB,UAAU,CAACpB,EAAtB;EACA,MAAMsB,UAAU,GAAG,IAAAC,uBAAA,EAAkBF,QAAQ,CAACG,cAA3B,CAAnB;EACA,MAAMZ,WAAW,GAAG,IAAAW,uBAAA,EAAkBF,QAAQ,CAACI,iBAA3B,CAApB;EACA,OAAO;IACLzB,EADK;IAELsB,UAFK;IAGLV;EAHK,CAAP;AAKD,CAVM,C,CAYP;AACA;;;;;AACO,MAAMc,YAAY,GAAIN,UAAD,IAAqC;EAC/D,MAAMC,QAAQ,GAAGD,UAAU,CAACC,QAA5B;EACA,MAAMrB,EAAE,GAAGoB,UAAU,CAACpB,EAAtB;EACA,MAAMsB,UAAU,GAAG,IAAAC,uBAAA,EAAkBF,QAAQ,CAACG,cAA3B,CAAnB;EACA,MAAMG,iBAAiB,GAAG,IAAAJ,uBAAA,EAAkBF,QAAQ,CAACM,iBAA3B,CAA1B;EACA,MAAMC,aAAa,GAAG,IAAAL,uBAAA,EAAkBF,QAAQ,CAACQ,SAA3B,CAAtB;EACA,OAAO;IACL7B,EADK;IAELsB,UAFK;IAGLK,iBAHK;IAILC;EAJK,CAAP;AAMD,CAZM"}
@@ -2,8 +2,6 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
4
 
5
- exports.isAuthApiError = isAuthApiError;
6
- exports.isOAuthError = isOAuthError;
7
5
  Object.defineProperty(exports, "AuthApiError", {
8
6
  enumerable: true,
9
7
  get: function () {
@@ -28,6 +26,8 @@ Object.defineProperty(exports, "OAuthError", {
28
26
  return _OAuthError.default;
29
27
  }
30
28
  });
29
+ exports.isAuthApiError = isAuthApiError;
30
+ exports.isOAuthError = isOAuthError;
31
31
 
32
32
  var _AuthApiError = _interopRequireDefault(require("./AuthApiError"));
33
33
 
package/cjs/features.js CHANGED
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
 
3
- exports.isBrowser = isBrowser;
4
- exports.isIE11OrLess = isIE11OrLess;
5
3
  exports.getUserAgent = getUserAgent;
6
- exports.isFingerprintSupported = isFingerprintSupported;
7
- exports.isPopupPostMessageSupported = isPopupPostMessageSupported;
8
- exports.isTokenVerifySupported = isTokenVerifySupported;
9
4
  exports.hasTextEncoder = hasTextEncoder;
10
- exports.isPKCESupported = isPKCESupported;
5
+ exports.isBrowser = isBrowser;
6
+ exports.isFingerprintSupported = isFingerprintSupported;
11
7
  exports.isHTTPS = isHTTPS;
8
+ exports.isIE11OrLess = isIE11OrLess;
12
9
  exports.isLocalhost = isLocalhost;
10
+ exports.isPKCESupported = isPKCESupported;
11
+ exports.isPopupPostMessageSupported = isPopupPostMessageSupported;
12
+ exports.isTokenVerifySupported = isTokenVerifySupported;
13
13
 
14
14
  var _crypto = require("./crypto");
15
15
 
@@ -1 +1 @@
1
- {"version":3,"file":"features.js","names":["isWindowsPhone","isBrowser","document","window","isIE11OrLess","documentMode","getUserAgent","navigator","userAgent","isFingerprintSupported","agent","test","isPopupPostMessageSupported","isIE8or9","postMessage","isTokenVerifySupported","webcrypto","subtle","Uint8Array","hasTextEncoder","TextEncoder","isPKCESupported","isHTTPS","location","protocol","isLocalhost","hostname"],"sources":["../../lib/features.ts"],"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/* eslint-disable node/no-unsupported-features/node-builtins */\n/* global document, window, TextEncoder, navigator */\n\nimport { webcrypto } from './crypto';\n\nconst isWindowsPhone = /windows phone|iemobile|wpdesktop/i;\t\n\nexport function isBrowser() {\n return typeof document !== 'undefined' && typeof window !== 'undefined';\n}\n\nexport function isIE11OrLess() {\n if (!isBrowser()) {\n return false;\n }\n const documentMode = (document as any).documentMode;\n return !!documentMode && documentMode <= 11;\n}\n\nexport function getUserAgent() {\n return navigator.userAgent;\n}\n\nexport function isFingerprintSupported() {\n const agent = getUserAgent();\n return agent && !isWindowsPhone.test(agent);\t\n}\n\nexport function isPopupPostMessageSupported() {\n if (!isBrowser()) {\n return false;\n }\n const documentMode = (document as any).documentMode;\n var isIE8or9 = documentMode && documentMode < 10;\n if (typeof window.postMessage !== 'undefined' && !isIE8or9) {\n return true;\n }\n return false;\n}\n\nexport function isTokenVerifySupported() {\n return typeof webcrypto !== 'undefined'\n && webcrypto !== null\n && typeof webcrypto.subtle !== 'undefined'\n && typeof Uint8Array !== 'undefined';\n}\n\nexport function hasTextEncoder() {\n return typeof TextEncoder !== 'undefined';\n}\n\nexport function isPKCESupported() {\n return isTokenVerifySupported() && hasTextEncoder();\n}\n\nexport function isHTTPS() {\n if (!isBrowser()) {\n return false;\n }\n return window.location.protocol === 'https:';\n}\n\nexport function isLocalhost() {\n // eslint-disable-next-line compat/compat\n return isBrowser() && window.location.hostname === 'localhost';\n}\n\n"],"mappings":";;;;;;;;;;;;;AAeA;;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AACA;AAIA,MAAMA,cAAc,GAAG,mCAAvB;;AAEO,SAASC,SAAT,GAAqB;EAC1B,OAAO,OAAOC,QAAP,KAAoB,WAApB,IAAmC,OAAOC,MAAP,KAAkB,WAA5D;AACD;;AAEM,SAASC,YAAT,GAAwB;EAC7B,IAAI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AP,CAAgBG,QAAhB,KAA6B,WAAnD;AACD"}
1
+ {"version":3,"file":"features.js","names":["isWindowsPhone","isBrowser","document","window","isIE11OrLess","documentMode","getUserAgent","navigator","userAgent","isFingerprintSupported","agent","test","isPopupPostMessageSupported","isIE8or9","postMessage","isTokenVerifySupported","webcrypto","subtle","Uint8Array","hasTextEncoder","TextEncoder","isPKCESupported","isHTTPS","location","protocol","isLocalhost","hostname"],"sources":["../../lib/features.ts"],"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/* eslint-disable node/no-unsupported-features/node-builtins */\n/* global document, window, TextEncoder, navigator */\n\nimport { webcrypto } from './crypto';\n\nconst isWindowsPhone = /windows phone|iemobile|wpdesktop/i;\t\n\nexport function isBrowser() {\n return typeof document !== 'undefined' && typeof window !== 'undefined';\n}\n\nexport function isIE11OrLess() {\n if (!isBrowser()) {\n return false;\n }\n const documentMode = (document as any).documentMode;\n return !!documentMode && documentMode <= 11;\n}\n\nexport function getUserAgent() {\n return navigator.userAgent;\n}\n\nexport function isFingerprintSupported() {\n const agent = getUserAgent();\n return agent && !isWindowsPhone.test(agent);\t\n}\n\nexport function isPopupPostMessageSupported() {\n if (!isBrowser()) {\n return false;\n }\n const documentMode = (document as any).documentMode;\n var isIE8or9 = documentMode && documentMode < 10;\n if (typeof window.postMessage !== 'undefined' && !isIE8or9) {\n return true;\n }\n return false;\n}\n\nexport function isTokenVerifySupported() {\n return typeof webcrypto !== 'undefined'\n && webcrypto !== null\n && typeof webcrypto.subtle !== 'undefined'\n && typeof Uint8Array !== 'undefined';\n}\n\nexport function hasTextEncoder() {\n return typeof TextEncoder !== 'undefined';\n}\n\nexport function isPKCESupported() {\n return isTokenVerifySupported() && hasTextEncoder();\n}\n\nexport function isHTTPS() {\n if (!isBrowser()) {\n return false;\n }\n return window.location.protocol === 'https:';\n}\n\nexport function isLocalhost() {\n // eslint-disable-next-line compat/compat\n return isBrowser() && window.location.hostname === 'localhost';\n}\n\n"],"mappings":";;;;;;;;;;;;;AAeA;;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AACA;AAIA,MAAMA,cAAc,GAAG,mCAAvB;;AAEO,SAASC,SAAT,GAAqB;EAC1B,OAAO,OAAOC,QAAP,KAAoB,WAApB,IAAmC,OAAOC,MAAP,KAAkB,WAA5D;AACD;;AAEM,SAASC,YAAT,GAAwB;EAC7B,IAAI,CAACH,SAAS,EAAd,EAAkB;IAChB,OAAO,KAAP;EACD;;EACD,MAAMI,YAAY,GAAIH,QAAD,CAAkBG,YAAvC;EACA,OAAO,CAAC,CAACA,YAAF,IAAkBA,YAAY,IAAI,EAAzC;AACD;;AAEM,SAASC,YAAT,GAAwB;EAC7B,OAAOC,SAAS,CAACC,SAAjB;AACD;;AAEM,SAASC,sBAAT,GAAkC;EACvC,MAAMC,KAAK,GAAGJ,YAAY,EAA1B;EACA,OAAOI,KAAK,IAAI,CAACV,cAAc,CAACW,IAAf,CAAoBD,KAApB,CAAjB;AACD;;AAEM,SAASE,2BAAT,GAAuC;EAC5C,IAAI,CAACX,SAAS,EAAd,EAAkB;IAChB,OAAO,KAAP;EACD;;EACD,MAAMI,YAAY,GAAIH,QAAD,CAAkBG,YAAvC;EACA,IAAIQ,QAAQ,GAAGR,YAAY,IAAIA,YAAY,GAAG,EAA9C;;EACA,IAAI,OAAOF,MAAM,CAACW,WAAd,KAA8B,WAA9B,IAA6C,CAACD,QAAlD,EAA4D;IAC1D,OAAO,IAAP;EACD;;EACD,OAAO,KAAP;AACD;;AAEM,SAASE,sBAAT,GAAkC;EACvC,OAAO,OAAOC,iBAAP,KAAqB,WAArB,IACFA,iBAAA,KAAc,IADZ,IAEF,OAAOA,iBAAA,CAAUC,MAAjB,KAA4B,WAF1B,IAGF,OAAOC,UAAP,KAAsB,WAH3B;AAID;;AAEM,SAASC,cAAT,GAA0B;EAC/B,OAAO,OAAOC,WAAP,KAAuB,WAA9B;AACD;;AAEM,SAASC,eAAT,GAA2B;EAChC,OAAON,sBAAsB,MAAMI,cAAc,EAAjD;AACD;;AAEM,SAASG,OAAT,GAAmB;EACxB,IAAI,CAACrB,SAAS,EAAd,EAAkB;IAChB,OAAO,KAAP;EACD;;EACD,OAAOE,MAAM,CAACoB,QAAP,CAAgBC,QAAhB,KAA6B,QAApC;AACD;;AAEM,SAASC,WAAT,GAAuB;EAC5B;EACA,OAAOxB,SAAS,MAAME,MAAM,CAACoB,QAAP,CAAgBG,QAAhB,KAA6B,WAAnD;AACD"}
@@ -2,8 +2,8 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
4
 
5
- exports.httpRequest = httpRequest;
6
5
  exports.get = get;
6
+ exports.httpRequest = httpRequest;
7
7
  exports.post = post;
8
8
 
9
9
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
@@ -1 +1 @@
1
- {"version":3,"file":"request.js","names":["httpRequest","sdk","options","httpRequestInterceptors","interceptor","url","method","args","saveAuthnState","accessToken","withCredentials","storageUtil","storage","httpCache","storageManager","getHttpCache","cookies","cacheResponse","cacheContents","getStorage","cachedResponse","Date","now","expiresAt","resolve","response","oktaUserAgentHeader","_oktaUserAgent","getHttpHeader","headers","ajaxOptions","data","undefined","err","res","httpRequestClient","then","resp","responseText","JSON","parse","Array","isArray","forEach","item","stateToken","delete","STATE_TOKEN_KEY_NAME","set","updateStorage","Math","floor","DEFAULT_CACHE_DURATION","catch","serverErr","e","errorSummary","status","transformErrorXHR","error","error_description","OAuthError","AuthApiError","errorCode","get","getIssuerOrigin","getOptions","post","postOptions"],"sources":["../../../lib/http/request.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-assertion */\n/*!\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\n/* eslint-disable complexity */\nimport { isString, clone, isAbsoluteUrl, removeNils } from '../util';\nimport { STATE_TOKEN_KEY_NAME, DEFAULT_CACHE_DURATION } from '../constants';\nimport {\n OktaAuthHttpInterface,\n RequestOptions,\n FetchOptions,\n RequestData\n} from '../types';\nimport { AuthApiError, OAuthError } from '../errors';\n\nexport function httpRequest(sdk: OktaAuthHttpInterface, options: RequestOptions): Promise<any> {\n options = options || {};\n\n if (sdk.options.httpRequestInterceptors) {\n for (const interceptor of sdk.options.httpRequestInterceptors) {\n interceptor(options);\n }\n }\n\n var url = options.url,\n method = options.method,\n args = options.args,\n saveAuthnState = options.saveAuthnState,\n accessToken = options.accessToken,\n withCredentials = options.withCredentials === true, // default value is false\n storageUtil = sdk.options.storageUtil,\n storage = storageUtil!.storage,\n httpCache = sdk.storageManager.getHttpCache(sdk.options.cookies);\n\n if (options.cacheResponse) {\n var cacheContents = httpCache.getStorage();\n var cachedResponse = cacheContents[url as string];\n if (cachedResponse && Date.now()/1000 < cachedResponse.expiresAt) {\n return Promise.resolve(cachedResponse.response);\n }\n }\n\n var oktaUserAgentHeader = sdk._oktaUserAgent.getHttpHeader();\n var headers: HeadersInit = {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json',\n ...oktaUserAgentHeader\n };\n Object.assign(headers, sdk.options.headers, options.headers);\n headers = removeNils(headers) as HeadersInit;\n\n if (accessToken && isString(accessToken)) {\n headers['Authorization'] = 'Bearer ' + accessToken;\n }\n\n var ajaxOptions: FetchOptions = {\n headers,\n data: args || undefined,\n withCredentials\n };\n\n var err, res;\n return sdk.options.httpRequestClient!(method!, url!, ajaxOptions)\n .then(function(resp) {\n res = resp.responseText;\n if (res && isString(res)) {\n res = JSON.parse(res);\n if (res && typeof res === 'object' && !res.headers) {\n if (Array.isArray(res)) {\n res.forEach(item => {\n item.headers = resp.headers;\n });\n } else {\n res.headers = resp.headers;\n }\n }\n }\n\n if (saveAuthnState) {\n if (!res.stateToken) {\n storage.delete(STATE_TOKEN_KEY_NAME);\n }\n }\n\n if (res && res.stateToken && res.expiresAt) {\n storage.set(STATE_TOKEN_KEY_NAME, res.stateToken, res.expiresAt, sdk.options.cookies!);\n }\n\n if (res && options.cacheResponse) {\n httpCache.updateStorage(url!, {\n expiresAt: Math.floor(Date.now()/1000) + DEFAULT_CACHE_DURATION,\n response: res\n });\n }\n \n return res;\n })\n .catch(function(resp) {\n var serverErr = resp.responseText || {};\n if (isString(serverErr)) {\n try {\n serverErr = JSON.parse(serverErr);\n } catch (e) {\n serverErr = {\n errorSummary: 'Unknown error'\n };\n }\n }\n\n if (resp.status >= 500) {\n serverErr.errorSummary = 'Unknown error';\n }\n\n if (sdk.options.transformErrorXHR) {\n resp = sdk.options.transformErrorXHR(clone(resp));\n }\n\n if (serverErr.error && serverErr.error_description) {\n err = new OAuthError(serverErr.error, serverErr.error_description);\n } else {\n err = new AuthApiError(serverErr, resp);\n }\n\n if (err.errorCode === 'E0000011') {\n storage.delete(STATE_TOKEN_KEY_NAME);\n }\n\n throw err;\n });\n}\n\nexport function get(sdk: OktaAuthHttpInterface, url: string, options?: RequestOptions) {\n url = isAbsoluteUrl(url) ? url : sdk.getIssuerOrigin() + url;\n var getOptions = {\n url: url,\n method: 'GET'\n };\n Object.assign(getOptions, options);\n return httpRequest(sdk, getOptions);\n}\n\nexport function post(sdk: OktaAuthHttpInterface, url: string, args?: RequestData, options?: RequestOptions) {\n url = isAbsoluteUrl(url) ? url : sdk.getIssuerOrigin() + url;\n var postOptions = {\n url: url,\n method: 'POST',\n args: args,\n saveAuthnState: true\n };\n Object.assign(postOptions, options);\n return httpRequest(sdk, postOptions);\n}\n"],"mappings":";;;;;;;;;;;;AAeA;;AACA;;AAOA;;AAvBA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AAWO,SAASA,WAAT,CAAqBC,GAArB,EAAiDC,OAAjD,EAAwF;EAC7FA,OAAO,GAAGA,OAAO,IAAI,EAArB;;EAEA,IAAID,GAAG,CAACC,OAAJ,CAAYC,uBAAhB,EAAyC;IACvC,KAAK,MAAMC,WAAX,IAA0BH,GAAG,CAACC,OAAJ,CAAYC,uBAAtC,EAA+D;MAC7DC,WAAW,CAACF,OAAD,CAAX;IACD;EACF;;EAED,IAAIG,GAAG,GAAGH,OAAO,CAACG,GAAlB;EAAA,IACIC,MAAM,GAAGJ,OAAO,CAACI,MADrB;EAAA,IAEIC,IAAI,GAAGL,OAAO,CAACK,IAFnB;EAAA,IAGIC,cAAc,GAAGN,OAAO,CAACM,cAH7B;EAAA,IAIIC,WAAW,GAAGP,OAAO,CAACO,WAJ1B;EAAA,IAKIC,eAAe,GAAGR,OAAO,CAACQ,eAAR,KAA4B,IALlD;EAAA,IAKwD;EACpDC,WAAW,GAAGV,GAAG,CAACC,OAAJ,CAAYS,WAN9B;EAAA,IAOIC,OAAO,GAAGD,WAAW,CAAEC,OAP3B;EAAA,IAQIC,SAAS,GAAGZ,GAAG,CAACa,cAAJ,CAAmBC,YAAnB,CAAgCd,GAAG,CAACC,OAAJ,CAAYc,OAA5C,CARhB;;EAUA,IAAId,OAAO,CAACe,aAAZ,EAA2B;IACzB,IAAIC,aAAa,GAAGL,SAAS,CAACM,UAAV,EAApB;IACA,IAAIC,cAAc,GAAGF,aAAa,CAACb,GAAD,CAAl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GAAD,EAAMmE,WAAN,CAAlB;AACD"}
1
+ {"version":3,"file":"request.js","names":["httpRequest","sdk","options","httpRequestInterceptors","interceptor","url","method","args","saveAuthnState","accessToken","withCredentials","storageUtil","storage","httpCache","storageManager","getHttpCache","cookies","cacheResponse","cacheContents","getStorage","cachedResponse","Date","now","expiresAt","resolve","response","oktaUserAgentHeader","_oktaUserAgent","getHttpHeader","headers","removeNils","isString","ajaxOptions","data","undefined","err","res","httpRequestClient","then","resp","responseText","JSON","parse","Array","isArray","forEach","item","stateToken","delete","STATE_TOKEN_KEY_NAME","set","updateStorage","Math","floor","DEFAULT_CACHE_DURATION","catch","serverErr","e","errorSummary","status","transformErrorXHR","clone","error","error_description","OAuthError","AuthApiError","errorCode","get","isAbsoluteUrl","getIssuerOrigin","getOptions","post","postOptions"],"sources":["../../../lib/http/request.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-assertion */\n/*!\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\n/* eslint-disable complexity */\nimport { isString, clone, isAbsoluteUrl, removeNils } from '../util';\nimport { STATE_TOKEN_KEY_NAME, DEFAULT_CACHE_DURATION } from '../constants';\nimport {\n OktaAuthHttpInterface,\n RequestOptions,\n FetchOptions,\n RequestData\n} from '../types';\nimport { AuthApiError, OAuthError } from '../errors';\n\nexport function httpRequest(sdk: OktaAuthHttpInterface, options: RequestOptions): Promise<any> {\n options = options || {};\n\n if (sdk.options.httpRequestInterceptors) {\n for (const interceptor of sdk.options.httpRequestInterceptors) {\n interceptor(options);\n }\n }\n\n var url = options.url,\n method = options.method,\n args = options.args,\n saveAuthnState = options.saveAuthnState,\n accessToken = options.accessToken,\n withCredentials = options.withCredentials === true, // default value is false\n storageUtil = sdk.options.storageUtil,\n storage = storageUtil!.storage,\n httpCache = sdk.storageManager.getHttpCache(sdk.options.cookies);\n\n if (options.cacheResponse) {\n var cacheContents = httpCache.getStorage();\n var cachedResponse = cacheContents[url as string];\n if (cachedResponse && Date.now()/1000 < cachedResponse.expiresAt) {\n return Promise.resolve(cachedResponse.response);\n }\n }\n\n var oktaUserAgentHeader = sdk._oktaUserAgent.getHttpHeader();\n var headers: HeadersInit = {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json',\n ...oktaUserAgentHeader\n };\n Object.assign(headers, sdk.options.headers, options.headers);\n headers = removeNils(headers) as HeadersInit;\n\n if (accessToken && isString(accessToken)) {\n headers['Authorization'] = 'Bearer ' + accessToken;\n }\n\n var ajaxOptions: FetchOptions = {\n headers,\n data: args || undefined,\n withCredentials\n };\n\n var err, res;\n return sdk.options.httpRequestClient!(method!, url!, ajaxOptions)\n .then(function(resp) {\n res = resp.responseText;\n if (res && isString(res)) {\n res = JSON.parse(res);\n if (res && typeof res === 'object' && !res.headers) {\n if (Array.isArray(res)) {\n res.forEach(item => {\n item.headers = resp.headers;\n });\n } else {\n res.headers = resp.headers;\n }\n }\n }\n\n if (saveAuthnState) {\n if (!res.stateToken) {\n storage.delete(STATE_TOKEN_KEY_NAME);\n }\n }\n\n if (res && res.stateToken && res.expiresAt) {\n storage.set(STATE_TOKEN_KEY_NAME, res.stateToken, res.expiresAt, sdk.options.cookies!);\n }\n\n if (res && options.cacheResponse) {\n httpCache.updateStorage(url!, {\n expiresAt: Math.floor(Date.now()/1000) + DEFAULT_CACHE_DURATION,\n response: res\n });\n }\n \n return res;\n })\n .catch(function(resp) {\n var serverErr = resp.responseText || {};\n if (isString(serverErr)) {\n try {\n serverErr = JSON.parse(serverErr);\n } catch (e) {\n serverErr = {\n errorSummary: 'Unknown error'\n };\n }\n }\n\n if (resp.status >= 500) {\n serverErr.errorSummary = 'Unknown error';\n }\n\n if (sdk.options.transformErrorXHR) {\n resp = sdk.options.transformErrorXHR(clone(resp));\n }\n\n if (serverErr.error && serverErr.error_description) {\n err = new OAuthError(serverErr.error, serverErr.error_description);\n } else {\n err = new AuthApiError(serverErr, resp);\n }\n\n if (err.errorCode === 'E0000011') {\n storage.delete(STATE_TOKEN_KEY_NAME);\n }\n\n throw err;\n });\n}\n\nexport function get(sdk: OktaAuthHttpInterface, url: string, options?: RequestOptions) {\n url = isAbsoluteUrl(url) ? url : sdk.getIssuerOrigin() + url;\n var getOptions = {\n url: url,\n method: 'GET'\n };\n Object.assign(getOptions, options);\n return httpRequest(sdk, getOptions);\n}\n\nexport function post(sdk: OktaAuthHttpInterface, url: string, args?: RequestData, options?: RequestOptions) {\n url = isAbsoluteUrl(url) ? url : sdk.getIssuerOrigin() + url;\n var postOptions = {\n url: url,\n method: 'POST',\n args: args,\n saveAuthnState: true\n };\n Object.assign(postOptions, options);\n return httpRequest(sdk, postOptions);\n}\n"],"mappings":";;;;;;;;;;;;AAeA;;AACA;;AAOA;;AAvBA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AAWO,SAASA,WAAT,CAAqBC,GAArB,EAAiDC,OAAjD,EAAwF;EAC7FA,OAAO,GAAGA,OAAO,IAAI,EAArB;;EAEA,IAAID,GAAG,CAACC,OAAJ,CAAYC,uBAAhB,EAAyC;IACvC,KAAK,MAAMC,WAAX,IAA0BH,GAAG,CAACC,OAAJ,CAAYC,uBAAtC,EAA+D;MAC7DC,WAAW,CAACF,OAAD,CAAX;IACD;EACF;;EAED,IAAIG,GAAG,GAAGH,OAAO,CAACG,GAAlB;EAAA,IACIC,MAAM,GAAGJ,OAAO,CAACI,MADrB;EAAA,IAEIC,IAAI,GAAGL,OAAO,CAACK,IAFnB;EAAA,IAGIC,cAAc,GAAGN,OAAO,CAACM,cAH7B;EAAA,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G;IACfjE,GAAG,EAAEA,GADU;IAEfC,MAAM,EAAE;EAFO,CAAjB;EAIA,qBAAcgE,UAAd,EAA0BpE,OAA1B;EACA,OAAOF,WAAW,CAACC,GAAD,EAAMqE,UAAN,CAAlB;AACD;;AAEM,SAASC,IAAT,CAActE,GAAd,EAA0CI,GAA1C,EAAuDE,IAAvD,EAA2EL,OAA3E,EAAqG;EAC1GG,GAAG,GAAG,IAAA+D,mBAAA,EAAc/D,GAAd,IAAqBA,GAArB,GAA2BJ,GAAG,CAACoE,eAAJ,KAAwBhE,GAAzD;EACA,IAAImE,WAAW,GAAG;IAChBnE,GAAG,EAAEA,GADW;IAEhBC,MAAM,EAAE,MAFQ;IAGhBC,IAAI,EAAEA,IAHU;IAIhBC,cAAc,EAAE;EAJA,CAAlB;EAMA,qBAAcgE,WAAd,EAA2BtE,OAA3B;EACA,OAAOF,WAAW,CAACC,GAAD,EAAMuE,WAAN,CAAlB;AACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"authenticate.js","names":["authenticate","authClient","options","password","authenticator","AuthenticatorKey","OKTA_PASSWORD","flow"],"sources":["../../../lib/idx/authenticate.ts"],"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 OktaAuthIdxInterface,\n IdxTransaction,\n AuthenticatorKey,\n AuthenticationOptions\n} from '../types';\nimport { run } from './run';\n\nexport async function authenticate(\n authClient: OktaAuthIdxInterface, options: AuthenticationOptions = {}\n): Promise<IdxTransaction> {\n if (options.password && !options.authenticator) {\n options.authenticator = AuthenticatorKey.OKTA_PASSWORD;\n }\n return run(authClient, { \n ...options, \n flow: 'authenticate'\n });\n}\n"],"mappings":";;;;AAaA;;AAMA;;AAnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAWO,eAAeA,YAAf,CACLC,UADK,EAC6BC,OAA8B,GAAG,EAD9D,EAEoB;EACzB,IAAIA,OAAO,CAACC,QAAR,IAAoB,CAACD,OAAO,CAACE,aAAjC,EAAgD;IAC9CF,OAAO,CAACE,aAAR,GAAwBC,wBAAiBC,aAAzC;EACD;;EACD,OAAO,cAAIL,UAAJ,EAAgB,EACrB,GAAGC,OADkB;IAErBK,IAAI,EAAE;EAFe,CAAhB,CAAP;AAID"}
1
+ {"version":3,"file":"authenticate.js","names":["authenticate","authClient","options","password","authenticator","AuthenticatorKey","OKTA_PASSWORD","run","flow"],"sources":["../../../lib/idx/authenticate.ts"],"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 OktaAuthIdxInterface,\n IdxTransaction,\n AuthenticatorKey,\n AuthenticationOptions\n} from '../types';\nimport { run } from './run';\n\nexport async function authenticate(\n authClient: OktaAuthIdxInterface, options: AuthenticationOptions = {}\n): Promise<IdxTransaction> {\n if (options.password && !options.authenticator) {\n options.authenticator = AuthenticatorKey.OKTA_PASSWORD;\n }\n return run(authClient, { \n ...options, \n flow: 'authenticate'\n });\n}\n"],"mappings":";;;;AAaA;;AAMA;;AAnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAWO,eAAeA,YAAf,CACLC,UADK,EAC6BC,OAA8B,GAAG,EAD9D,EAEoB;EACzB,IAAIA,OAAO,CAACC,QAAR,IAAoB,CAACD,OAAO,CAACE,aAAjC,EAAgD;IAC9CF,OAAO,CAACE,aAAR,GAAwBC,uBAAA,CAAiBC,aAAzC;EACD;;EACD,OAAO,IAAAC,QAAA,EAAIN,UAAJ,EAAgB,EACrB,GAAGC,OADkB;IAErBM,IAAI,EAAE;EAFe,CAAhB,CAAP;AAID"}
@@ -6,21 +6,22 @@ var _Authenticator = require("./Authenticator");
6
6
 
7
7
  class OktaPassword extends _Authenticator.Authenticator {
8
8
  canVerify(values) {
9
- return !!(values.credentials || values.password);
9
+ return !!(values.credentials || values.password || values.passcode);
10
10
  }
11
11
 
12
12
  mapCredentials(values) {
13
13
  const {
14
14
  credentials,
15
- password
15
+ password,
16
+ passcode
16
17
  } = values;
17
18
 
18
- if (!credentials && !password) {
19
+ if (!credentials && !password && !passcode) {
19
20
  return;
20
21
  }
21
22
 
22
23
  return credentials || {
23
- passcode: password
24
+ passcode: passcode || password
24
25
  };
25
26
  }
26
27
 
@@ -1 +1 @@
1
- {"version":3,"file":"OktaPassword.js","names":["OktaPassword","Authenticator","canVerify","values","credentials","password","mapCredentials","passcode","getInputs","idxRemediationValue","form","value","name","type","required"],"sources":["../../../../lib/idx/authenticator/OktaPassword.ts"],"sourcesContent":["import { Authenticator, Credentials } from './Authenticator';\n\nexport interface OktaPasswordInputValues {\n password?: string;\n credentials?: Credentials;\n}\n\nexport class OktaPassword extends Authenticator<OktaPasswordInputValues> {\n canVerify(values: OktaPasswordInputValues) {\n return !!(values.credentials || values.password);\n }\n\n mapCredentials(values: OktaPasswordInputValues): Credentials | undefined {\n const { credentials, password } = values;\n if (!credentials && !password) {\n return;\n }\n return credentials || { passcode: password };\n }\n\n getInputs(idxRemediationValue) {\n return {\n ...idxRemediationValue.form?.value[0],\n name: 'password',\n type: 'string',\n required: idxRemediationValue.required\n };\n }\n}\n"],"mappings":";;;;AAAA;;AAOO,MAAMA,YAAN,SAA2BC,4BAA3B,CAAkE;EACvEC,SAAS,CAACC,MAAD,EAAkC;IACzC,OAAO,CAAC,EAAEA,MAAM,CAACC,WAAP,IAAsBD,MAAM,CAACE,QAA/B,CAAR;EACD;;EAEDC,cAAc,CAACH,MAAD,EAA2D;IACvE,MAAM;MAAEC,WAAF;MAAeC;IAAf,IAA4BF,MAAlC;;IACA,IAAI,CAACC,WAAD,IAAgB,CAACC,QAArB,EAA+B;MAC7B;IACD;;IACD,OAAOD,WAAW,IAAI;MAAEG,QAAQ,EAAEF;IAAZ,CAAtB;EACD;;EAEDG,SAAS,CAACC,mBAAD,EAAsB;IAAA;;IAC7B,OAAO,EACL,6BAAGA,mBAAmB,CAACC,IAAvB,0DAAG,sBAA0BC,KAA1B,CAAgC,CAAhC,CAAH,CADK;MAELC,IAAI,EAAE,UAFD;MAGLC,IAAI,EAAE,QAHD;MAILC,QAAQ,EAAEL,mBAAmB,CAACK;IAJzB,CAAP;EAMD;;AApBsE"}
1
+ {"version":3,"file":"OktaPassword.js","names":["OktaPassword","Authenticator","canVerify","values","credentials","password","passcode","mapCredentials","getInputs","idxRemediationValue","form","value","name","type","required"],"sources":["../../../../lib/idx/authenticator/OktaPassword.ts"],"sourcesContent":["import { Authenticator, Credentials } from './Authenticator';\n\nexport interface OktaPasswordInputValues {\n password?: string;\n passcode?: string;\n credentials?: Credentials;\n}\n\nexport class OktaPassword extends Authenticator<OktaPasswordInputValues> {\n canVerify(values: OktaPasswordInputValues) {\n return !!(values.credentials || values.password || values.passcode);\n }\n\n mapCredentials(values: OktaPasswordInputValues): Credentials | undefined {\n const { credentials, password, passcode } = values;\n if (!credentials && !password && !passcode) {\n return;\n }\n return credentials || { passcode: passcode || password };\n }\n\n getInputs(idxRemediationValue) {\n return {\n ...idxRemediationValue.form?.value[0],\n name: 'password',\n type: 'string',\n required: idxRemediationValue.required\n };\n }\n}\n"],"mappings":";;;;AAAA;;AAQO,MAAMA,YAAN,SAA2BC,4BAA3B,CAAkE;EACvEC,SAAS,CAACC,MAAD,EAAkC;IACzC,OAAO,CAAC,EAAEA,MAAM,CAACC,WAAP,IAAsBD,MAAM,CAACE,QAA7B,IAAyCF,MAAM,CAACG,QAAlD,CAAR;EACD;;EAEDC,cAAc,CAACJ,MAAD,EAA2D;IACvE,MAAM;MAAEC,WAAF;MAAeC,QAAf;MAAyBC;IAAzB,IAAsCH,MAA5C;;IACA,IAAI,CAACC,WAAD,IAAgB,CAACC,QAAjB,IAA6B,CAACC,QAAlC,EAA4C;MAC1C;IACD;;IACD,OAAOF,WAAW,IAAI;MAAEE,QAAQ,EAAEA,QAAQ,IAAID;IAAxB,CAAtB;EACD;;EAEDG,SAAS,CAACC,mBAAD,EAAsB;IAAA;;IAC7B,OAAO,EACL,6BAAGA,mBAAmB,CAACC,IAAvB,0DAAG,sBAA0BC,KAA1B,CAAgC,CAAhC,CAAH,CADK;MAELC,IAAI,EAAE,UAFD;MAGLC,IAAI,EAAE,QAHD;MAILC,QAAQ,EAAEL,mBAAmB,CAACK;IAJzB,CAAP;EAMD;;AApBsE"}
@@ -1 +1 @@
1
- {"version":3,"file":"getAuthenticator.js","names":["getAuthenticator","remediation","relatesTo","value","key","AuthenticatorKey","OKTA_PASSWORD","OktaPassword","SECURITY_QUESTION","contextualData","enrolledQuestion","SecurityQuestionVerification","SecurityQuestionEnrollment","OKTA_VERIFY","OktaVerifyTotp","WEBAUTHN","challengeData","WebauthnVerification","WebauthnEnrollment","VerificationCodeAuthenticator"],"sources":["../../../../lib/idx/authenticator/getAuthenticator.ts"],"sourcesContent":["import { OktaVerifyTotp } from './OktaVerifyTotp';\nimport { Authenticator } from './Authenticator';\nimport { VerificationCodeAuthenticator } from './VerificationCodeAuthenticator';\nimport { OktaPassword } from './OktaPassword';\nimport { SecurityQuestionEnrollment } from './SecurityQuestionEnrollment';\nimport { SecurityQuestionVerification } from './SecurityQuestionVerification';\nimport { WebauthnEnrollment } from './WebauthnEnrollment';\nimport { WebauthnVerification } from './WebauthnVerification';\nimport { IdxAuthenticator, IdxRemediation } from '../types/idx-js';\nimport { AuthenticatorKey } from '../types';\n\n/* eslint complexity:[0,8] */\nexport function getAuthenticator(remediation: IdxRemediation): Authenticator<any> {\n const relatesTo = remediation.relatesTo;\n const value = relatesTo?.value || {} as IdxAuthenticator;\n switch (value.key) {\n case AuthenticatorKey.OKTA_PASSWORD:\n return new OktaPassword(value);\n case AuthenticatorKey.SECURITY_QUESTION:\n if (value.contextualData?.enrolledQuestion) {\n return new SecurityQuestionVerification(value);\n } else {\n return new SecurityQuestionEnrollment(value);\n }\n case AuthenticatorKey.OKTA_VERIFY:\n return new OktaVerifyTotp(value);\n case AuthenticatorKey.WEBAUTHN:\n if (value.contextualData?.challengeData) {\n return new WebauthnVerification(value);\n } else {\n return new WebauthnEnrollment(value);\n }\n default:\n return new VerificationCodeAuthenticator(value);\n }\n}\n"],"mappings":";;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AAEA;AACO,SAASA,gBAAT,CAA0BC,WAA1B,EAA2E;EAAA;;EAChF,MAAMC,SAAS,GAAGD,WAAW,CAACC,SAA9B;EACA,MAAMC,KAAK,GAAG,CAAAD,SAAS,SAAT,IAAAA,SAAS,WAAT,YAAAA,SAAS,CAAEC,KAAX,KAAoB,EAAlC;;EACA,QAAQA,KAAK,CAACC,GAAd;IACE,KAAKC,wBAAiBC,aAAtB;MACE,OAAO,IAAIC,0BAAJ,CAAiBJ,KAAjB,CAAP;;IACF,KAAKE,wBAAiBG,iBAAtB;MACE,6BAAIL,KAAK,CAACM,cAAV,kDAAI,sBAAsBC,gBAA1B,EAA4C;QAC1C,OAAO,IAAIC,0DAAJ,CAAiCR,KAAjC,CAAP;MACD,CAFD,MAEO;QACL,OAAO,IAAIS,sDAAJ,CAA+BT,KAA/B,CAAP;MACD;;IACH,KAAKE,wBAAiBQ,WAAtB;MACE,OAAO,IAAIC,8BAAJ,CAAmBX,KAAnB,CAAP;;IACF,KAAKE,wBAAiBU,QAAtB;MACE,8BAAIZ,KAAK,CAACM,cAAV,mDAAI,uBAAsBO,aAA1B,EAAyC;QACvC,OAAO,IAAIC,0CAAJ,CAAyBd,KAAzB,CAAP;MACD,CAFD,MAEO;QACL,OAAO,IAAIe,sCAAJ,CAAuBf,KAAvB,CAAP;MACD;;IACH;MACE,OAAO,IAAIgB,4DAAJ,CAAkChB,KAAlC,CAAP;EAlBJ;AAoBD"}
1
+ {"version":3,"file":"getAuthenticator.js","names":["getAuthenticator","remediation","relatesTo","value","key","AuthenticatorKey","OKTA_PASSWORD","OktaPassword","SECURITY_QUESTION","contextualData","enrolledQuestion","SecurityQuestionVerification","SecurityQuestionEnrollment","OKTA_VERIFY","OktaVerifyTotp","WEBAUTHN","challengeData","WebauthnVerification","WebauthnEnrollment","VerificationCodeAuthenticator"],"sources":["../../../../lib/idx/authenticator/getAuthenticator.ts"],"sourcesContent":["import { OktaVerifyTotp } from './OktaVerifyTotp';\nimport { Authenticator } from './Authenticator';\nimport { VerificationCodeAuthenticator } from './VerificationCodeAuthenticator';\nimport { OktaPassword } from './OktaPassword';\nimport { SecurityQuestionEnrollment } from './SecurityQuestionEnrollment';\nimport { SecurityQuestionVerification } from './SecurityQuestionVerification';\nimport { WebauthnEnrollment } from './WebauthnEnrollment';\nimport { WebauthnVerification } from './WebauthnVerification';\nimport { IdxAuthenticator, IdxRemediation } from '../types/idx-js';\nimport { AuthenticatorKey } from '../types';\n\n/* eslint complexity:[0,8] */\nexport function getAuthenticator(remediation: IdxRemediation): Authenticator<any> {\n const relatesTo = remediation.relatesTo;\n const value = relatesTo?.value || {} as IdxAuthenticator;\n switch (value.key) {\n case AuthenticatorKey.OKTA_PASSWORD:\n return new OktaPassword(value);\n case AuthenticatorKey.SECURITY_QUESTION:\n if (value.contextualData?.enrolledQuestion) {\n return new SecurityQuestionVerification(value);\n } else {\n return new SecurityQuestionEnrollment(value);\n }\n case AuthenticatorKey.OKTA_VERIFY:\n return new OktaVerifyTotp(value);\n case AuthenticatorKey.WEBAUTHN:\n if (value.contextualData?.challengeData) {\n return new WebauthnVerification(value);\n } else {\n return new WebauthnEnrollment(value);\n }\n default:\n return new VerificationCodeAuthenticator(value);\n }\n}\n"],"mappings":";;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AAEA;AACO,SAASA,gBAAT,CAA0BC,WAA1B,EAA2E;EAAA;;EAChF,MAAMC,SAAS,GAAGD,WAAW,CAACC,SAA9B;EACA,MAAMC,KAAK,GAAG,CAAAD,SAAS,SAAT,IAAAA,SAAS,WAAT,YAAAA,SAAS,CAAEC,KAAX,KAAoB,EAAlC;;EACA,QAAQA,KAAK,CAACC,GAAd;IACE,KAAKC,uBAAA,CAAiBC,aAAtB;MACE,OAAO,IAAIC,0BAAJ,CAAiBJ,KAAjB,CAAP;;IACF,KAAKE,uBAAA,CAAiBG,iBAAtB;MACE,6BAAIL,KAAK,CAACM,cAAV,kDAAI,sBAAsBC,gBAA1B,EAA4C;QAC1C,OAAO,IAAIC,0DAAJ,CAAiCR,KAAjC,CAAP;MACD,CAFD,MAEO;QACL,OAAO,IAAIS,sDAAJ,CAA+BT,KAA/B,CAAP;MACD;;IACH,KAAKE,uBAAA,CAAiBQ,WAAtB;MACE,OAAO,IAAIC,8BAAJ,CAAmBX,KAAnB,CAAP;;IACF,KAAKE,uBAAA,CAAiBU,QAAtB;MACE,8BAAIZ,KAAK,CAACM,cAAV,mDAAI,uBAAsBO,aAA1B,EAAyC;QACvC,OAAO,IAAIC,0CAAJ,CAAyBd,KAAzB,CAAP;MACD,CAFD,MAEO;QACL,OAAO,IAAIe,sCAAJ,CAAuBf,KAAvB,CAAP;MACD;;IACH;MACE,OAAO,IAAIgB,4DAAJ,CAAkChB,KAAlC,CAAP;EAlBJ;AAoBD"}
@@ -2,9 +2,9 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
4
 
5
- exports.formatAuthenticator = formatAuthenticator;
6
5
  exports.compareAuthenticators = compareAuthenticators;
7
6
  exports.findMatchedOption = findMatchedOption;
7
+ exports.formatAuthenticator = formatAuthenticator;
8
8
 
9
9
  var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
10
10
 
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","names":["formatAuthenticator","incoming","authenticator","key","Error","compareAuthenticators","auth1","auth2","id","findMatchedOption","authenticators","options","option","relatesTo"],"sources":["../../../../lib/idx/authenticator/util.ts"],"sourcesContent":["import { Authenticator, isAuthenticator } from '../types';\n\nexport function formatAuthenticator(incoming: unknown): Authenticator {\n let authenticator: Authenticator;\n if (isAuthenticator(incoming)) {\n authenticator = incoming;\n } else if (typeof incoming === 'string') {\n authenticator = {\n key: incoming\n };\n } else {\n throw new Error('Invalid format for authenticator');\n }\n return authenticator;\n}\n\n// Returns true if the authenticators are equivalent\nexport function compareAuthenticators(auth1, auth2) {\n if (!auth1 || !auth2) {\n return false;\n }\n // by id\n if (auth1.id && auth2.id) {\n return (auth1.id === auth2.id);\n }\n // by key\n if (auth1.key && auth2.key) {\n return (auth1.key === auth2.key);\n }\n return false;\n}\n\n// Find matched authenticator in provided order\nexport function findMatchedOption(authenticators, options) {\n let option;\n for (let authenticator of authenticators) {\n option = options\n .find(({ relatesTo }) => relatesTo.key === authenticator.key);\n if (option) {\n break;\n }\n }\n return option;\n}"],"mappings":";;;;;;;;;;AAAA;;AAEO,SAASA,mBAAT,CAA6BC,QAA7B,EAA+D;EACpE,IAAIC,aAAJ;;EACA,IAAK,4BAAgBD,QAAhB,CAAL,EAAgC;IAC9BC,aAAa,GAAGD,QAAhB;EACD,CAFD,MAEO,IAAI,OAAOA,QAAP,KAAoB,QAAxB,EAAkC;IACvCC,aAAa,GAAG;MACdC,GAAG,EAAEF;IADS,CAAhB;EAGD,CAJM,MAIA;IACL,MAAM,IAAIG,KAAJ,CAAU,kCAAV,CAAN;EACD;;EACD,OAAOF,aAAP;AACD,C,CAED;;;AACO,SAASG,qBAAT,CAA+BC,KAA/B,EAAsCC,KAAtC,EAA6C;EAClD,IAAI,CAACD,KAAD,IAAU,CAACC,KAAf,EAAsB;IACpB,OAAO,KAAP;EACD,CAHiD,CAIlD;;;EACA,IAAID,KAAK,CAACE,EAAN,IAAYD,KAAK,CAACC,EAAtB,EAA0B;IACxB,OAAQF,KAAK,CAACE,EAAN,KAAaD,KAAK,CAACC,EAA3B;EACD,CAPiD,CAQlD;;;EACA,IAAIF,KAAK,CAACH,GAAN,IAAaI,KAAK,CAACJ,GAAvB,EAA4B;IAC1B,OAAQG,KAAK,CAACH,GAAN,KAAcI,KAAK,CAACJ,GAA5B;EACD;;EACD,OAAO,KAAP;AACD,C,CAED;;;AACO,SAASM,iBAAT,CAA2BC,cAA3B,EAA2CC,OAA3C,EAAoD;EACzD,IAAIC,MAAJ;;EACA,KAAK,IAAIV,aAAT,IAA0BQ,cAA1B,EAA0C;IACxCE,MAAM,GAAG,mBAAAD,OAAO,MAAP,CAAAA,OAAO,EACR,CAAC;MAAEE;IAAF,CAAD,KAAmBA,SAAS,CAACV,GAAV,KAAkBD,aAAa,CAACC,GAD3C,CAAhB;;IAEA,IAAIS,MAAJ,EAAY;MACV;IACD;EACF;;EACD,OAAOA,MAAP;AACD"}
1
+ {"version":3,"file":"util.js","names":["formatAuthenticator","incoming","authenticator","isAuthenticator","key","Error","compareAuthenticators","auth1","auth2","id","findMatchedOption","authenticators","options","option","relatesTo"],"sources":["../../../../lib/idx/authenticator/util.ts"],"sourcesContent":["import { Authenticator, isAuthenticator } from '../types';\n\nexport function formatAuthenticator(incoming: unknown): Authenticator {\n let authenticator: Authenticator;\n if (isAuthenticator(incoming)) {\n authenticator = incoming;\n } else if (typeof incoming === 'string') {\n authenticator = {\n key: incoming\n };\n } else {\n throw new Error('Invalid format for authenticator');\n }\n return authenticator;\n}\n\n// Returns true if the authenticators are equivalent\nexport function compareAuthenticators(auth1, auth2) {\n if (!auth1 || !auth2) {\n return false;\n }\n // by id\n if (auth1.id && auth2.id) {\n return (auth1.id === auth2.id);\n }\n // by key\n if (auth1.key && auth2.key) {\n return (auth1.key === auth2.key);\n }\n return false;\n}\n\n// Find matched authenticator in provided order\nexport function findMatchedOption(authenticators, options) {\n let option;\n for (let authenticator of authenticators) {\n option = options\n .find(({ relatesTo }) => relatesTo.key === authenticator.key);\n if (option) {\n break;\n }\n }\n return option;\n}"],"mappings":";;;;;;;;;;AAAA;;AAEO,SAASA,mBAAT,CAA6BC,QAA7B,EAA+D;EACpE,IAAIC,aAAJ;;EACA,IAAK,IAAAC,sBAAA,EAAgBF,QAAhB,CAAL,EAAgC;IAC9BC,aAAa,GAAGD,QAAhB;EACD,CAFD,MAEO,IAAI,OAAOA,QAAP,KAAoB,QAAxB,EAAkC;IACvCC,aAAa,GAAG;MACdE,GAAG,EAAEH;IADS,CAAhB;EAGD,CAJM,MAIA;IACL,MAAM,IAAII,KAAJ,CAAU,kCAAV,CAAN;EACD;;EACD,OAAOH,aAAP;AACD,C,CAED;;;AACO,SAASI,qBAAT,CAA+BC,KAA/B,EAAsCC,KAAtC,EAA6C;EAClD,IAAI,CAACD,KAAD,IAAU,CAACC,KAAf,EAAsB;IACpB,OAAO,KAAP;EACD,CAHiD,CAIlD;;;EACA,IAAID,KAAK,CAACE,EAAN,IAAYD,KAAK,CAACC,EAAtB,EAA0B;IACxB,OAAQF,KAAK,CAACE,EAAN,KAAaD,KAAK,CAACC,EAA3B;EACD,CAPiD,CAQlD;;;EACA,IAAIF,KAAK,CAACH,GAAN,IAAaI,KAAK,CAACJ,GAAvB,EAA4B;IAC1B,OAAQG,KAAK,CAACH,GAAN,KAAcI,KAAK,CAACJ,GAA5B;EACD;;EACD,OAAO,KAAP;AACD,C,CAED;;;AACO,SAASM,iBAAT,CAA2BC,cAA3B,EAA2CC,OAA3C,EAAoD;EACzD,IAAIC,MAAJ;;EACA,KAAK,IAAIX,aAAT,IAA0BS,cAA1B,EAA0C;IACxCE,MAAM,GAAG,mBAAAD,OAAO,MAAP,CAAAA,OAAO,EACR,CAAC;MAAEE;IAAF,CAAD,KAAmBA,SAAS,CAACV,GAAV,KAAkBF,aAAa,CAACE,GAD3C,CAAhB;;IAEA,IAAIS,MAAJ,EAAY;MACV;IACD;EACF;;EACD,OAAOA,MAAP;AACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"cancel.js","names":["cancel","authClient","options","meta","transactionManager","load","flowSpec","flow","actions"],"sources":["../../../lib/idx/cancel.ts"],"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 { OktaAuthIdxInterface, CancelOptions, IdxTransactionMeta } from '../types';\nimport { run } from './run';\nimport { getFlowSpecification } from './flow';\n\nexport async function cancel (authClient: OktaAuthIdxInterface, options?: CancelOptions) {\n const meta = authClient.transactionManager.load() as IdxTransactionMeta;\n const flowSpec = getFlowSpecification(authClient, meta.flow);\n return run(authClient, {\n ...options,\n ...flowSpec,\n actions: ['cancel']\n });\n}\n"],"mappings":";;;;AAaA;;AACA;;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMO,eAAeA,MAAf,CAAuBC,UAAvB,EAAyDC,OAAzD,EAAkF;EACvF,MAAMC,IAAI,GAAGF,UAAU,CAACG,kBAAX,CAA8BC,IAA9B,EAAb;EACA,MAAMC,QAAQ,GAAG,gCAAqBL,UAArB,EAAiCE,IAAI,CAACI,IAAtC,CAAjB;EACA,OAAO,cAAIN,UAAJ,EAAgB,EACrB,GAAGC,OADkB;IAErB,GAAGI,QAFkB;IAGrBE,OAAO,EAAE,CAAC,QAAD;EAHY,CAAhB,CAAP;AAKD"}
1
+ {"version":3,"file":"cancel.js","names":["cancel","authClient","options","meta","transactionManager","load","flowSpec","getFlowSpecification","flow","run","actions"],"sources":["../../../lib/idx/cancel.ts"],"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 { OktaAuthIdxInterface, CancelOptions, IdxTransactionMeta } from '../types';\nimport { run } from './run';\nimport { getFlowSpecification } from './flow';\n\nexport async function cancel (authClient: OktaAuthIdxInterface, options?: CancelOptions) {\n const meta = authClient.transactionManager.load() as IdxTransactionMeta;\n const flowSpec = getFlowSpecification(authClient, meta.flow);\n return run(authClient, {\n ...options,\n ...flowSpec,\n actions: ['cancel']\n });\n}\n"],"mappings":";;;;AAaA;;AACA;;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMO,eAAeA,MAAf,CAAuBC,UAAvB,EAAyDC,OAAzD,EAAkF;EACvF,MAAMC,IAAI,GAAGF,UAAU,CAACG,kBAAX,CAA8BC,IAA9B,EAAb;EACA,MAAMC,QAAQ,GAAG,IAAAC,0BAAA,EAAqBN,UAArB,EAAiCE,IAAI,CAACK,IAAtC,CAAjB;EACA,OAAO,IAAAC,QAAA,EAAIR,UAAJ,EAAgB,EACrB,GAAGC,OADkB;IAErB,GAAGI,QAFkB;IAGrBI,OAAO,EAAE,CAAC,QAAD;EAHY,CAAhB,CAAP;AAKD"}
@@ -2,11 +2,11 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
4
 
5
- exports.isEmailVerifyCallbackError = isEmailVerifyCallbackError;
5
+ exports.EmailVerifyCallbackError = void 0;
6
+ exports.handleEmailVerifyCallback = handleEmailVerifyCallback;
6
7
  exports.isEmailVerifyCallback = isEmailVerifyCallback;
8
+ exports.isEmailVerifyCallbackError = isEmailVerifyCallbackError;
7
9
  exports.parseEmailVerifyCallback = parseEmailVerifyCallback;
8
- exports.handleEmailVerifyCallback = handleEmailVerifyCallback;
9
- exports.EmailVerifyCallbackError = void 0;
10
10
 
11
11
  var _CustomError = _interopRequireDefault(require("../errors/CustomError"));
12
12
 
@@ -1 +1 @@
1
- {"version":3,"file":"emailVerify.js","names":["EmailVerifyCallbackError","CustomError","constructor","state","otp","name","isEmailVerifyCallbackError","error","isEmailVerifyCallback","urlPath","test","parseEmailVerifyCallback","handleEmailVerifyCallback","authClient","search","idx","canProceed","proceed"],"sources":["../../../lib/idx/emailVerify.ts"],"sourcesContent":["\n/*!\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\nimport { OktaAuthIdxInterface } from '../types';\n\nimport CustomError from '../errors/CustomError';\nimport { urlParamsToObject } from '../oidc/util/urlParams';\n\nexport interface EmailVerifyCallbackResponse {\n state: string;\n otp: string;\n}\n\nexport class EmailVerifyCallbackError extends CustomError {\n state: string;\n otp: string;\n\n constructor(state: string, otp: string) {\n super(`Enter the OTP code in the originating client: ${otp}`);\n this.name = 'EmailVerifyCallbackError';\n this.state = state;\n this.otp = otp;\n }\n}\n\nexport function isEmailVerifyCallbackError(error: Error) {\n return (error.name === 'EmailVerifyCallbackError');\n}\n\n// Check if state && otp have been passed back in the url\nexport function isEmailVerifyCallback (urlPath: string): boolean {\n return /(otp=)/i.test(urlPath) && /(state=)/i.test(urlPath);\n}\n\n// Parse state and otp from a urlPath (should be either a search or fragment from the URL)\nexport function parseEmailVerifyCallback(urlPath: string): EmailVerifyCallbackResponse {\n return urlParamsToObject(urlPath) as EmailVerifyCallbackResponse;\n}\n\nexport async function handleEmailVerifyCallback(authClient: OktaAuthIdxInterface, search: string) {\n if (isEmailVerifyCallback(search)) {\n const { state, otp } = parseEmailVerifyCallback(search);\n if (authClient.idx.canProceed({ state })) {\n // same browser / device\n return await authClient.idx.proceed({ state, otp });\n } else {\n // different browser or device\n throw new EmailVerifyCallbackError(state, otp);\n }\n }\n}\n"],"mappings":";;;;;;;;;;AAeA;;AACA;;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAYO,MAAMA,wBAAN,SAAuCC,oBAAvC,CAAmD;EAIxDC,WAAW,CAACC,KAAD,EAAgBC,GAAhB,EAA6B;IACtC,MAAO,iDAAgDA,GAAI,EAA3D;IACA,KAAKC,IAAL,GAAY,0BAAZ;IACA,KAAKF,KAAL,GAAaA,KAAb;IACA,KAAKC,GAAL,GAAWA,GAAX;EACD;;AATuD;;;;AAYnD,SAASE,0BAAT,CAAoCC,KAApC,EAAkD;EACvD,OAAQA,KAAK,CAACF,IAAN,KAAe,0BAAvB;AACD,C,CAED;;;AACO,SAASG,qBAAT,CAAgCC,OAAhC,EAA0D;EAC/D,OAAO,UAAUC,IAAV,CAAeD,OAAf,KAA2B,YAAYC,IAAZ,CAAiBD,OAAjB,CAAlC;AACD,C,CAED;;;AACO,SAASE,wBAAT,CAAkCF,OAAlC,EAAgF;EACrF,OAAO,kCAAkBA,OAAlB,CAAP;AACD;;AAEM,eAAeG,yBAAf,CAAyCC,UAAzC,EAA2EC,MAA3E,EAA2F;EAChG,IAAIN,qBAAqB,CAACM,MAAD,CAAzB,EAAmC;IACjC,MAAM;MAAEX,KAAF;MAASC;IAAT,IAAiBO,wBAAwB,CAACG,MAAD,CAA/C;;IACA,IAAID,UAAU,CAACE,GAAX,CAAeC,UAAf,CAA0B;MAAEb;IAAF,CAA1B,CAAJ,EAA0C;MACxC;MACA,OAAO,MAAMU,UAAU,CAACE,GAAX,CAAeE,OAAf,CAAuB;QAAEd,KAAF;QAASC;MAAT,CAAvB,CAAb;IACD,CAHD,MAGO;MACL;MACA,MAAM,IAAIJ,wBAAJ,CAA6BG,KAA7B,EAAoCC,GAApC,CAAN;IACD;EACF;AACF"}
1
+ {"version":3,"file":"emailVerify.js","names":["EmailVerifyCallbackError","CustomError","constructor","state","otp","name","isEmailVerifyCallbackError","error","isEmailVerifyCallback","urlPath","test","parseEmailVerifyCallback","urlParamsToObject","handleEmailVerifyCallback","authClient","search","idx","canProceed","proceed"],"sources":["../../../lib/idx/emailVerify.ts"],"sourcesContent":["\n/*!\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\nimport { OktaAuthIdxInterface } from '../types';\n\nimport CustomError from '../errors/CustomError';\nimport { urlParamsToObject } from '../oidc/util/urlParams';\n\nexport interface EmailVerifyCallbackResponse {\n state: string;\n otp: string;\n}\n\nexport class EmailVerifyCallbackError extends CustomError {\n state: string;\n otp: string;\n\n constructor(state: string, otp: string) {\n super(`Enter the OTP code in the originating client: ${otp}`);\n this.name = 'EmailVerifyCallbackError';\n this.state = state;\n this.otp = otp;\n }\n}\n\nexport function isEmailVerifyCallbackError(error: Error) {\n return (error.name === 'EmailVerifyCallbackError');\n}\n\n// Check if state && otp have been passed back in the url\nexport function isEmailVerifyCallback (urlPath: string): boolean {\n return /(otp=)/i.test(urlPath) && /(state=)/i.test(urlPath);\n}\n\n// Parse state and otp from a urlPath (should be either a search or fragment from the URL)\nexport function parseEmailVerifyCallback(urlPath: string): EmailVerifyCallbackResponse {\n return urlParamsToObject(urlPath) as EmailVerifyCallbackResponse;\n}\n\nexport async function handleEmailVerifyCallback(authClient: OktaAuthIdxInterface, search: string) {\n if (isEmailVerifyCallback(search)) {\n const { state, otp } = parseEmailVerifyCallback(search);\n if (authClient.idx.canProceed({ state })) {\n // same browser / device\n return await authClient.idx.proceed({ state, otp });\n } else {\n // different browser or device\n throw new EmailVerifyCallbackError(state, otp);\n }\n }\n}\n"],"mappings":";;;;;;;;;;AAeA;;AACA;;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAYO,MAAMA,wBAAN,SAAuCC,oBAAvC,CAAmD;EAIxDC,WAAW,CAACC,KAAD,EAAgBC,GAAhB,EAA6B;IACtC,MAAO,iDAAgDA,GAAI,EAA3D;IACA,KAAKC,IAAL,GAAY,0BAAZ;IACA,KAAKF,KAAL,GAAaA,KAAb;IACA,KAAKC,GAAL,GAAWA,GAAX;EACD;;AATuD;;;;AAYnD,SAASE,0BAAT,CAAoCC,KAApC,EAAkD;EACvD,OAAQA,KAAK,CAACF,IAAN,KAAe,0BAAvB;AACD,C,CAED;;;AACO,SAASG,qBAAT,CAAgCC,OAAhC,EAA0D;EAC/D,OAAO,UAAUC,IAAV,CAAeD,OAAf,KAA2B,YAAYC,IAAZ,CAAiBD,OAAjB,CAAlC;AACD,C,CAED;;;AACO,SAASE,wBAAT,CAAkCF,OAAlC,EAAgF;EACrF,OAAO,IAAAG,4BAAA,EAAkBH,OAAlB,CAAP;AACD;;AAEM,eAAeI,yBAAf,CAAyCC,UAAzC,EAA2EC,MAA3E,EAA2F;EAChG,IAAIP,qBAAqB,CAACO,MAAD,CAAzB,EAAmC;IACjC,MAAM;MAAEZ,KAAF;MAASC;IAAT,IAAiBO,wBAAwB,CAACI,MAAD,CAA/C;;IACA,IAAID,UAAU,CAACE,GAAX,CAAeC,UAAf,CAA0B;MAAEd;IAAF,CAA1B,CAAJ,EAA0C;MACxC;MACA,OAAO,MAAMW,UAAU,CAACE,GAAX,CAAeE,OAAf,CAAuB;QAAEf,KAAF;QAASC;MAAT,CAAvB,CAAb;IACD,CAHD,MAGO;MACL;MACA,MAAM,IAAIJ,wBAAJ,CAA6BG,KAA7B,EAAoCC,GAApC,CAAN;IACD;EACF;AACF"}
@@ -2,9 +2,9 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
4
 
5
- exports.validateVersionConfig = validateVersionConfig;
6
5
  exports.makeIdxState = makeIdxState;
7
6
  exports.parsersForVersion = void 0;
7
+ exports.validateVersionConfig = validateVersionConfig;
8
8
 
9
9
  var _constants = require("../../constants");
10
10
 
@@ -1 +1 @@
1
- {"version":3,"file":"generateIdxAction.js","names":["generateDirectFetch","authClient","actionDefinition","defaultParamsForAction","immutableParamsForAction","toPersist","target","href","params","headers","accepts","body","response","url","method","args","withCredentials","idx","makeIdxResponse","err","AuthApiError","xhr","payload","responseJSON","JSON","parse","responseText","wwwAuthHeader","idxResponse","status","stepUp","generateIdxAction","generator","defaultParams","neededParams","immutableParams","action","name"],"sources":["../../../../../lib/idx/idxState/v1/generateIdxAction.ts"],"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, complexity */\nimport { httpRequest } from '../../../http';\nimport { OktaAuthIdxInterface } from '../../../types'; // auth-js/types\nimport { IdxActionFunction, IdxActionParams, IdxResponse, IdxToPersist } from '../../types/idx-js';\nimport { divideActionParamsByMutability } from './actionParser';\nimport AuthApiError from '../../../errors/AuthApiError';\n\nconst generateDirectFetch = function generateDirectFetch(authClient: OktaAuthIdxInterface, { \n actionDefinition, \n defaultParamsForAction = {}, \n immutableParamsForAction = {}, \n toPersist = {} as IdxToPersist\n}): IdxActionFunction {\n const target = actionDefinition.href;\n return async function(params: IdxActionParams = {}): Promise<IdxResponse> {\n const headers = {\n 'Content-Type': 'application/json',\n 'Accept': actionDefinition.accepts || 'application/ion+json',\n };\n const body = JSON.stringify({\n ...defaultParamsForAction,\n ...params,\n ...immutableParamsForAction\n });\n\n try {\n const response = await httpRequest(authClient, {\n url: target,\n method: actionDefinition.method,\n headers,\n args: body,\n withCredentials: toPersist?.withCredentials ?? true\n });\n\n return authClient.idx.makeIdxResponse({ ...response }, toPersist, true);\n }\n catch (err) {\n if (!(err instanceof AuthApiError) || !err?.xhr) {\n throw err;\n }\n\n const response = err.xhr;\n const payload = response.responseJSON || JSON.parse(response.responseText);\n const wwwAuthHeader = response.headers['WWW-Authenticate'] || response.headers['www-authenticate'];\n\n const idxResponse = authClient.idx.makeIdxResponse({ ...payload }, toPersist, false);\n if (response.status === 401 && wwwAuthHeader === 'Oktadevicejwt realm=\"Okta Device\"') {\n // Okta server responds 401 status code with WWW-Authenticate header and new remediation\n // so that the iOS/MacOS credential SSO extension (Okta Verify) can intercept\n // the response reaches here when Okta Verify is not installed\n // set `stepUp` to true if flow should be continued without showing any errors\n idxResponse.stepUp = true;\n }\n\n // Throw IDX response if request did not succeed. This behavior will be removed in version 7.0: OKTA-481844\n throw idxResponse;\n }\n };\n};\n\n// TODO: Resolve in M2: Either build the final polling solution or remove this code\n// const generatePollingFetch = function generatePollingFetch( { actionDefinition, defaultParamsForAction = {}, immutableParamsForAction = {} } ) {\n// // TODO: Discussions ongoing about when/how to terminate polling: OKTA-246581\n// const target = actionDefinition.href;\n// return async function(params) {\n// return fetch(target, {\n// method: actionDefinition.method,\n// headers: {\n// 'content-type': actionDefinition.accepts,\n// },\n// body: JSON.stringify({ ...defaultParamsForAction, ...params, ...immutableParamsForAction })\n// })\n// .then( response => response.ok ? response.json() : response.json().then( err => Promise.reject(err)) )\n// .then( idxResponse => makeIdxState(authClient, idxResponse) );\n// };\n// };\n\nconst generateIdxAction = function generateIdxAction( authClient: OktaAuthIdxInterface, actionDefinition, toPersist ): IdxActionFunction {\n // TODO: leaving this here to see where the polling is EXPECTED to drop into the code, but removing any accidental trigger of incomplete code\n // const generator = actionDefinition.refresh ? generatePollingFetch : generateDirectFetch;\n const generator = generateDirectFetch;\n const { defaultParams, neededParams, immutableParams } = divideActionParamsByMutability( actionDefinition );\n\n const action = generator(authClient, {\n actionDefinition,\n defaultParamsForAction: defaultParams[actionDefinition.name],\n immutableParamsForAction: immutableParams[actionDefinition.name],\n toPersist\n });\n action.neededParams = neededParams;\n return action;\n};\n\nexport default generateIdxAction;\n"],"mappings":";;;;;;;;AAaA;;AAGA;;AACA;;AAjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AAOA,MAAMA,mBAAmB,GAAG,SAASA,mBAAT,CAA6BC,UAA7B,EAA+D;EACzFC,gBADyF;EAEzFC,sBAAsB,GAAG,EAFgE;EAGzFC,wBAAwB,GAAG,EAH8D;EAIzFC,SAAS,GAAG;AAJ6E,CAA/D,EAKN;EACpB,MAAMC,MAAM,GAAGJ,gBAAgB,CAACK,IAAhC;EACA,OAAO,gBAAeC,MAAuB,GAAG,EAAzC,EAAmE;IACxE,MAAMC,OAAO,GAAG;MACd,gBAAgB,kBADF;MAEd,UAAUP,gBAAgB,CAACQ,OAAjB,IAA4B;IAFxB,CAAhB;IAIA,MAAMC,IAAI,GAAG,wBAAe,EAC1B,GAAGR,sBADuB;MAE1B,GAAGK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CAqDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA,MAAMG,iBAAiB,GAAG,SAASA,iBAAT,CAA4B9B,UAA5B,EAA8DC,gBAA9D,EAAgFG,SAAhF,EAA+G;EACvI;EACA;EACA,MAAM2B,SAAS,GAAGhC,mBAAlB;EACA,MAAM;IAAEiC,aAAF;IAAiBC,YAAjB;IAA+BC;EAA/B,IAAmD,kDAAgCjC,gBAAhC,CAAzD;EAEA,MAAMkC,MAAM,GAAGJ,SAAS,CAAC/B,UAAD,EAAa;IACnCC,gBADmC;IAEnCC,sBAAsB,EAAE8B,aAAa,CAAC/B,gBAAgB,CAACmC,IAAlB,CAFF;IAGnCjC,wBAAwB,EAAE+B,eAAe,CAACjC,gBAAgB,CAACmC,IAAlB,CAHN;IAInChC;EAJmC,CAAb,CAAxB;EAMA+B,MAAM,CAACF,YAAP,GAAsBA,YAAtB;EACA,OAAOE,MAAP;AACD,CAdD;;eAgBeL,iB"}
1
+ {"version":3,"file":"generateIdxAction.js","names":["generateDirectFetch","authClient","actionDefinition","defaultParamsForAction","immutableParamsForAction","toPersist","target","href","params","headers","accepts","body","response","httpRequest","url","method","args","withCredentials","idx","makeIdxResponse","err","AuthApiError","xhr","payload","responseJSON","JSON","parse","responseText","wwwAuthHeader","idxResponse","status","stepUp","generateIdxAction","generator","defaultParams","neededParams","immutableParams","divideActionParamsByMutability","action","name"],"sources":["../../../../../lib/idx/idxState/v1/generateIdxAction.ts"],"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, complexity */\nimport { httpRequest } from '../../../http';\nimport { OktaAuthIdxInterface } from '../../../types'; // auth-js/types\nimport { IdxActionFunction, IdxActionParams, IdxResponse, IdxToPersist } from '../../types/idx-js';\nimport { divideActionParamsByMutability } from './actionParser';\nimport AuthApiError from '../../../errors/AuthApiError';\n\nconst generateDirectFetch = function generateDirectFetch(authClient: OktaAuthIdxInterface, { \n actionDefinition, \n defaultParamsForAction = {}, \n immutableParamsForAction = {}, \n toPersist = {} as IdxToPersist\n}): IdxActionFunction {\n const target = actionDefinition.href;\n return async function(params: IdxActionParams = {}): Promise<IdxResponse> {\n const headers = {\n 'Content-Type': 'application/json',\n 'Accept': actionDefinition.accepts || 'application/ion+json',\n };\n const body = JSON.stringify({\n ...defaultParamsForAction,\n ...params,\n ...immutableParamsForAction\n });\n\n try {\n const response = await httpRequest(authClient, {\n url: target,\n method: actionDefinition.method,\n headers,\n args: body,\n withCredentials: toPersist?.withCredentials ?? true\n });\n\n return authClient.idx.makeIdxResponse({ ...response }, toPersist, true);\n }\n catch (err) {\n if (!(err instanceof AuthApiError) || !err?.xhr) {\n throw err;\n }\n\n const response = err.xhr;\n const payload = response.responseJSON || JSON.parse(response.responseText);\n const wwwAuthHeader = response.headers['WWW-Authenticate'] || response.headers['www-authenticate'];\n\n const idxResponse = authClient.idx.makeIdxResponse({ ...payload }, toPersist, false);\n if (response.status === 401 && wwwAuthHeader === 'Oktadevicejwt realm=\"Okta Device\"') {\n // Okta server responds 401 status code with WWW-Authenticate header and new remediation\n // so that the iOS/MacOS credential SSO extension (Okta Verify) can intercept\n // the response reaches here when Okta Verify is not installed\n // set `stepUp` to true if flow should be continued without showing any errors\n idxResponse.stepUp = true;\n }\n\n // Throw IDX response if request did not succeed. This behavior will be removed in version 7.0: OKTA-481844\n throw idxResponse;\n }\n };\n};\n\n// TODO: Resolve in M2: Either build the final polling solution or remove this code\n// const generatePollingFetch = function generatePollingFetch( { actionDefinition, defaultParamsForAction = {}, immutableParamsForAction = {} } ) {\n// // TODO: Discussions ongoing about when/how to terminate polling: OKTA-246581\n// const target = actionDefinition.href;\n// return async function(params) {\n// return fetch(target, {\n// method: actionDefinition.method,\n// headers: {\n// 'content-type': actionDefinition.accepts,\n// },\n// body: JSON.stringify({ ...defaultParamsForAction, ...params, ...immutableParamsForAction })\n// })\n// .then( response => response.ok ? response.json() : response.json().then( err => Promise.reject(err)) )\n// .then( idxResponse => makeIdxState(authClient, idxResponse) );\n// };\n// };\n\nconst generateIdxAction = function generateIdxAction( authClient: OktaAuthIdxInterface, actionDefinition, toPersist ): IdxActionFunction {\n // TODO: leaving this here to see where the polling is EXPECTED to drop into the code, but removing any accidental trigger of incomplete code\n // const generator = actionDefinition.refresh ? generatePollingFetch : generateDirectFetch;\n const generator = generateDirectFetch;\n const { defaultParams, neededParams, immutableParams } = divideActionParamsByMutability( actionDefinition );\n\n const action = generator(authClient, {\n actionDefinition,\n defaultParamsForAction: defaultParams[actionDefinition.name],\n immutableParamsForAction: immutableParams[actionDefinition.name],\n toPersist\n });\n action.neededParams = neededParams;\n return action;\n};\n\nexport default generateIdxAction;\n"],"mappings":";;;;;;;;AAaA;;AAGA;;AACA;;AAjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AAOA,MAAMA,mBAAmB,GAAG,SAASA,mBAAT,CAA6BC,UAA7B,EAA+D;EACzFC,gBADyF;EAEzFC,sBAAsB,GAAG,EAFgE;EAGzFC,wBAAwB,GAAG,EAH8D;EAIzFC,SAAS,GAAG;AAJ6E,CAA/D,EAKN;EACpB,MAAMC,MAAM,GAAGJ,gBAAgB,CAACK,IAAhC;EACA,OAAO,gBAAeC,MAAuB,GAAG,EAAzC,EAAmE;IACxE,MAAMC,OAAO,GAAG;MACd,gBAAgB,kBADF;MAEd,UAAUP,gBAAgB,CAACQ,OAAjB,IAA4B;IAFxB,CAAhB;IAIA,MAAMC,IAAI,GAAG,wBAA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;MACA,MAAMF,WAAN;IACD;EACF,CA3CD;AA4CD,CAnDD,C,CAqDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA,MAAMG,iBAAiB,GAAG,SAASA,iBAAT,CAA4B/B,UAA5B,EAA8DC,gBAA9D,EAAgFG,SAAhF,EAA+G;EACvI;EACA;EACA,MAAM4B,SAAS,GAAGjC,mBAAlB;EACA,MAAM;IAAEkC,aAAF;IAAiBC,YAAjB;IAA+BC;EAA/B,IAAmD,IAAAC,4CAAA,EAAgCnC,gBAAhC,CAAzD;EAEA,MAAMoC,MAAM,GAAGL,SAAS,CAAChC,UAAD,EAAa;IACnCC,gBADmC;IAEnCC,sBAAsB,EAAE+B,aAAa,CAAChC,gBAAgB,CAACqC,IAAlB,CAFF;IAGnCnC,wBAAwB,EAAEgC,eAAe,CAAClC,gBAAgB,CAACqC,IAAlB,CAHN;IAInClC;EAJmC,CAAb,CAAxB;EAMAiC,MAAM,CAACH,YAAP,GAAsBA,YAAtB;EACA,OAAOG,MAAP;AACD,CAdD;;eAgBeN,iB"}
@@ -2,7 +2,7 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
4
 
5
- exports.parseIdxResponse = exports.parseNonRemediations = void 0;
5
+ exports.parseNonRemediations = exports.parseIdxResponse = void 0;
6
6
 
7
7
  var _fromEntries = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/from-entries"));
8
8
 
@@ -1 +1 @@
1
- {"version":3,"file":"idxResponseParser.js","names":["SKIP_FIELDS","field","parseNonRemediations","authClient","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"],"sources":["../../../../../lib/idx/idxState/v1/idxResponseParser.ts"],"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// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nimport { OktaAuthIdxInterface } from '../../../types'; // auth-js/types\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( authClient: OktaAuthIdxInterface, 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(authClient, 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(authClient, 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 = (authClient: OktaAuthIdxInterface, remediation, toPersist) => {\n // Only remediation that has `rel` field (indicator for form submission) can have http action\n if (remediation.rel) {\n const remediationActions = generateRemediationFunctions( authClient, [remediation], toPersist );\n const actionFn = remediationActions[remediation.name];\n return {\n ...remediation,\n action: actionFn,\n };\n }\n \n return remediation;\n};\n\nexport const parseIdxResponse = function parseIdxResponse( authClient: OktaAuthIdxInterface, 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( authClient, remediation, toPersist ));\n\n const { context, actions } = parseNonRemediations( authClient, idxResponse, toPersist );\n\n return {\n remediations,\n context,\n actions,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA;;AACA;;AACA;;;;AAEA,MAAMA,WAAW,GAAG,0BAAmB,8BACrC,aADqC,EACtB;AACf,SAFqC,CAE1B;AAF0B,kBAG/BC,KAAD,IAAW,CAAEA,KAAF,EAAS,CAAC,CAAC,iBAAX,CAHqB,CAAnB,CAApB;;AAKO,MAAMC,oBAAoB,GAAG,SAASA,oBAAT,CAA+BC,UAA/B,EAAiEC,WAAjE,EAA8EC,SAAS,GAAG,EAA1F,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9B,EAA0C,CAACwB,WAAD,CAA1C,EAAyDtB,SAAzD,CAA3B;IACA,MAAMwB,QAAQ,GAAGD,kBAAkB,CAACD,WAAW,CAAChB,IAAb,CAAnC;IACA,OAAO,EACL,GAAGgB,WADE;MAELG,MAAM,EAAED;IAFH,CAAP;EAID;;EAED,OAAOF,WAAP;AACD,CAZD;;AAcO,MAAMI,gBAAgB,GAAG,SAASA,gBAAT,CAA2B5B,UAA3B,EAA6DC,WAA7D,EAA0EC,SAAS,GAAG,EAAtF,EAI9B;EAAA;;EACA,MAAM2B,eAAe,GAAG,0BAAA5B,WAAW,CAACuB,WAAZ,gFAAyBf,KAAzB,KAAkC,EAA1D;EAEAoB,eAAe,CAACxB,OAAhB,CACEmB,WAAW,IAAIV,eAAe,CAACb,WAAD,EAAcuB,WAAd,CADhC;EAIA,MAAMM,YAAY,GAAG,kBAAAD,eAAe,MAAf,CAAAA,eAAe,EAAKL,WAAW,IAAID,wBAAwB,CAAEvB,UAAF,EAAcwB,WAAd,EAA2BtB,SAA3B,CAA5C,CAApC;EAEA,MAAM;IAAEE,OAAF;IAAWD;EAAX,IAAuBJ,oBAAoB,CAAEC,UAAF,EAAcC,WAAd,EAA2BC,SAA3B,CAAjD;EAEA,OAAO;IACL4B,YADK;IAEL1B,OAFK;IAGLD;EAHK,CAAP;AAKD,CApBM"}
1
+ {"version":3,"file":"idxResponseParser.js","names":["SKIP_FIELDS","field","parseNonRemediations","authClient","idxResponse","toPersist","actions","context","forEach","fieldIsObject","rel","name","generateIdxAction","value","fieldValue","type","info","subField","expandRelatesTo","k","query","Array","isArray","result","JSONPath","path","json","innerValue","convertRemediationAction","remediation","remediationActions","generateRemediationFunctions","actionFn","action","parseIdxResponse","remediationData","remediations"],"sources":["../../../../../lib/idx/idxState/v1/idxResponseParser.ts"],"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// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nimport { OktaAuthIdxInterface } from '../../../types'; // auth-js/types\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( authClient: OktaAuthIdxInterface, 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(authClient, 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(authClient, 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 = (authClient: OktaAuthIdxInterface, remediation, toPersist) => {\n // Only remediation that has `rel` field (indicator for form submission) can have http action\n if (remediation.rel) {\n const remediationActions = generateRemediationFunctions( authClient, [remediation], toPersist );\n const actionFn = remediationActions[remediation.name];\n return {\n ...remediation,\n action: actionFn,\n };\n }\n \n return remediation;\n};\n\nexport const parseIdxResponse = function parseIdxResponse( authClient: OktaAuthIdxInterface, 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( authClient, remediation, toPersist ));\n\n const { context, actions } = parseNonRemediations( authClient, idxResponse, toPersist );\n\n return {\n remediations,\n context,\n actions,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA;;AACA;;AACA;;;;AAEA,MAAMA,WAAW,GAAG,0BAAmB,8BACrC,aADqC,EACtB;AACf,SAFqC,CAE1B;AAF0B,kBAG/BC,KAAD,IAAW,CAAEA,KAAF,EAAS,CAAC,CAAC,iBAAX,CAHqB,CAAnB,CAApB;;AAKO,MAAMC,oBAAoB,GAAG,SAASA,oBAAT,CAA+BC,UAA/B,EAAiEC,WAAjE,EAA8EC,SAAS,GAAG,EAA1F,EAA+F;EAAA;;EACjI,MAAMC,OAAO,GAAG,EAAhB;EACA,MAAMC,OAAO,GAAG,EAAhB;EAEA,oDAAYH,WAA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zD,CAA3B;IACA,MAAM2B,QAAQ,GAAGF,kBAAkB,CAACD,WAAW,CAAClB,IAAb,CAAnC;IACA,OAAO,EACL,GAAGkB,WADE;MAELI,MAAM,EAAED;IAFH,CAAP;EAID;;EAED,OAAOH,WAAP;AACD,CAZD;;AAcO,MAAMK,gBAAgB,GAAG,SAASA,gBAAT,CAA2B/B,UAA3B,EAA6DC,WAA7D,EAA0EC,SAAS,GAAG,EAAtF,EAI9B;EAAA;;EACA,MAAM8B,eAAe,GAAG,0BAAA/B,WAAW,CAACyB,WAAZ,gFAAyBhB,KAAzB,KAAkC,EAA1D;EAEAsB,eAAe,CAAC3B,OAAhB,CACEqB,WAAW,IAAIX,eAAe,CAACd,WAAD,EAAcyB,WAAd,CADhC;EAIA,MAAMO,YAAY,GAAG,kBAAAD,eAAe,MAAf,CAAAA,eAAe,EAAKN,WAAW,IAAID,wBAAwB,CAAEzB,UAAF,EAAc0B,WAAd,EAA2BxB,SAA3B,CAA5C,CAApC;EAEA,MAAM;IAAEE,OAAF;IAAWD;EAAX,IAAuBJ,oBAAoB,CAAEC,UAAF,EAAcC,WAAd,EAA2BC,SAA3B,CAAjD;EAEA,OAAO;IACL+B,YADK;IAEL7B,OAFK;IAGLD;EAHK,CAAP;AAKD,CApBM"}
@@ -1 +1 @@
1
- {"version":3,"file":"makeIdxState.js","names":["makeIdxState","authClient","idxResponse","toPersist","requestDidSucceed","rawIdxResponse","remediations","context","actions","neededToProceed","proceed","remediationChoice","paramsFromUser","remediationChoiceObject","remediation","name","reject","actionFn","action","findCode","item","interactionCode","successWithInteractionCode","value","rawIdxState"],"sources":["../../../../../lib/idx/idxState/v1/makeIdxState.ts"],"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, IdxToPersist } from '../../types/idx-js';\nimport { OktaAuthIdxInterface, RawIdxResponse } from '../../../types'; // auth-js/types\nimport { parseIdxResponse } from './idxResponseParser';\n\nexport function makeIdxState( \n authClient: OktaAuthIdxInterface,\n idxResponse: RawIdxResponse,\n toPersist: IdxToPersist,\n requestDidSucceed: boolean\n): IdxResponse {\n const rawIdxResponse = idxResponse;\n const { remediations, context, actions } = parseIdxResponse( authClient, 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 const actionFn = remediationChoiceObject.action;\n if (typeof actionFn !== 'function') {\n return Promise.reject(`Current remediation cannot make form submit action: [${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"],"mappings":";;;;;;;;;;AAcA;;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAG0E;AAGnE,SAASA,YAAT,CACLC,UADK,EAELC,WAFK,EAGLC,SAHK,EAILC,iBAJK,EAKQ;EAAA;;EACb,MAAMC,cAAc,GAAIH,WAAxB;EACA,MAAM;IAAEI,YAAF;IAAgBC,OAAhB;IAAyBC;EAAzB,IAAqC,yCAAkBP,UAAlB,EAA8BC,WAA9B,EAA2CC,SAA3C,CAA3C;EACA,MAAMM,eAAe,GAAG,CAAC,GAAGH,YAAJ,CAAxB;;EAEA,MAAMI,OAA+B,GAAG,gBAAgBC,iBAAhB,EAAmCC,cAAc,GAAG,EAApD,EAAyD;IAC/F;AACJ;AACA;AACA;AACA;AACA;IACI,MAAMC,uBAAuB,GAAG,mBAAAP,YAAY,MAAZ,CAAAA,YAAY,EAAOQ,WAAD,IAAiBA,WAAW,CAACC,IAAZ,KAAqBJ,iBAA5C,CAA5C;;IACA,IAAK,CAACE,uBAAN,EAAgC;MAC9B,OAAO,iBAAQG,MAAR,CAAgB,gCAA+BL,iBAAkB,GAAjE,CAAP;IACD;;IAED,MAAMM,QAAQ,GAAGJ,uBAAuB,CAACK,MAAzC;;IACA,IAAI,OAAOD,QAAP,KAAoB,UAAxB,EAAoC;MAClC,OAAO,iBAAQD,MAAR,CAAgB,wDAAuDL,iBAAkB,GAAzF,CAAP;IACD;;IAED,OAAOE,uBAAuB,CAACK,MAAxB,CAA+BN,cAA/B,CAAP;EACD,CAlBD;;EAoBA,MAAMO,QAAQ,GAAGC,IAAI,IAAIA,IAAI,CAACL,IAAL,KAAc,kBAAvC;;EACA,MAAMM,eAAe,4BAAGhB,cAAc,CAACiB,0BAAlB,oFAAG,sBAA2CC,KAA9C,qFAAG,wEAAwDJ,QAAxD,CAAH,2DAAG,uBAAoEI,KAA5F;EAEA,OAAO;IACLb,OADK;IAELD,eAFK;IAGLD,OAHK;IAILD,OAJK;IAKLiB,WAAW,EAAEnB,cALR;IAMLgB,eANK;IAOLlB,SAPK;IAQLC;EARK,CAAP;AAUD"}
1
+ {"version":3,"file":"makeIdxState.js","names":["makeIdxState","authClient","idxResponse","toPersist","requestDidSucceed","rawIdxResponse","remediations","context","actions","parseIdxResponse","neededToProceed","proceed","remediationChoice","paramsFromUser","remediationChoiceObject","remediation","name","reject","actionFn","action","findCode","item","interactionCode","successWithInteractionCode","value","rawIdxState"],"sources":["../../../../../lib/idx/idxState/v1/makeIdxState.ts"],"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, IdxToPersist } from '../../types/idx-js';\nimport { OktaAuthIdxInterface, RawIdxResponse } from '../../../types'; // auth-js/types\nimport { parseIdxResponse } from './idxResponseParser';\n\nexport function makeIdxState( \n authClient: OktaAuthIdxInterface,\n idxResponse: RawIdxResponse,\n toPersist: IdxToPersist,\n requestDidSucceed: boolean\n): IdxResponse {\n const rawIdxResponse = idxResponse;\n const { remediations, context, actions } = parseIdxResponse( authClient, 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 const actionFn = remediationChoiceObject.action;\n if (typeof actionFn !== 'function') {\n return Promise.reject(`Current remediation cannot make form submit action: [${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"],"mappings":";;;;;;;;;;AAcA;;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAG0E;AAGnE,SAASA,YAAT,CACLC,UADK,EAELC,WAFK,EAGLC,SAHK,EAILC,iBAJK,EAKQ;EAAA;;EACb,MAAMC,cAAc,GAAIH,WAAxB;EACA,MAAM;IAAEI,YAAF;IAAgBC,OAAhB;IAAyBC;EAAzB,IAAqC,IAAAC,mCAAA,EAAkBR,UAAlB,EAA8BC,WAA9B,EAA2CC,SAA3C,CAA3C;EACA,MAAMO,eAAe,GAAG,CAAC,GAAGJ,YAAJ,CAAxB;;EAEA,MAAMK,OAA+B,GAAG,gBAAgBC,iBAAhB,EAAmCC,cAAc,GAAG,EAApD,EAAyD;IAC/F;AACJ;AACA;AACA;AACA;AACA;IACI,MAAMC,uBAAuB,GAAG,mBAAAR,YAAY,MAAZ,CAAAA,YAAY,EAAOS,WAAD,IAAiBA,WAAW,CAACC,IAAZ,KAAqBJ,iBAA5C,CAA5C;;IACA,IAAK,CAACE,uBAAN,EAAgC;MAC9B,OAAO,iBAAQG,MAAR,CAAgB,gCAA+BL,iBAAkB,GAAjE,CAAP;IACD;;IAED,MAAMM,QAAQ,GAAGJ,uBAAuB,CAACK,MAAzC;;IACA,IAAI,OAAOD,QAAP,KAAoB,UAAxB,EAAoC;MAClC,OAAO,iBAAQD,MAAR,CAAgB,wDAAuDL,iBAAkB,GAAzF,CAAP;IACD;;IAED,OAAOE,uBAAuB,CAACK,MAAxB,CAA+BN,cAA/B,CAAP;EACD,CAlBD;;EAoBA,MAAMO,QAAQ,GAAGC,IAAI,IAAIA,IAAI,CAACL,IAAL,KAAc,kBAAvC;;EACA,MAAMM,eAAe,4BAAGjB,cAAc,CAACkB,0BAAlB,oFAAG,sBAA2CC,KAA9C,qFAAG,wEAAwDJ,QAAxD,CAAH,2DAAG,uBAAoEI,KAA5F;EAEA,OAAO;IACLb,OADK;IAELD,eAFK;IAGLF,OAHK;IAILD,OAJK;IAKLkB,WAAW,EAAEpB,cALR;IAMLiB,eANK;IAOLnB,SAPK;IAQLC;EARK,CAAP;AAUD"}
@@ -1 +1 @@
1
- {"version":3,"file":"remediationParser.js","names":["generateRemediationFunctions","authClient","remediationValue","toPersist","remediation","name"],"sources":["../../../../../lib/idx/idxState/v1/remediationParser.ts"],"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-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nimport { OktaAuthIdxInterface } from '../../../types'; // auth-js/types\nimport generateIdxAction from './generateIdxAction';\n\nexport const generateRemediationFunctions = function generateRemediationFunctions(\n authClient: OktaAuthIdxInterface,\n remediationValue,\n toPersist = {}\n) {\n return Object.fromEntries( remediationValue.map( remediation => {\n return [\n remediation.name,\n generateIdxAction(authClient, remediation, toPersist),\n ];\n }) );\n};\n"],"mappings":";;;;;;;;;;AAeA;;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAC0D;AAGnD,MAAMA,4BAA4B,GAAG,SAASA,4BAAT,CAC1CC,UAD0C,EAE1CC,gBAF0C,EAG1CC,SAAS,GAAG,EAH8B,EAI1C;EACA,OAAO,0BAAoB,kBAAAD,gBAAgB,MAAhB,CAAAA,gBAAgB,EAAME,WAAW,IAAI;IAC9D,OAAO,CACLA,WAAW,CAACC,IADP,EAEL,gCAAkBJ,UAAlB,EAA8BG,WAA9B,EAA2CD,SAA3C,CAFK,CAAP;EAID,CAL0C,CAApC,CAAP;AAMD,CAXM"}
1
+ {"version":3,"file":"remediationParser.js","names":["generateRemediationFunctions","authClient","remediationValue","toPersist","remediation","name","generateIdxAction"],"sources":["../../../../../lib/idx/idxState/v1/remediationParser.ts"],"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-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nimport { OktaAuthIdxInterface } from '../../../types'; // auth-js/types\nimport generateIdxAction from './generateIdxAction';\n\nexport const generateRemediationFunctions = function generateRemediationFunctions(\n authClient: OktaAuthIdxInterface,\n remediationValue,\n toPersist = {}\n) {\n return Object.fromEntries( remediationValue.map( remediation => {\n return [\n remediation.name,\n generateIdxAction(authClient, remediation, toPersist),\n ];\n }) );\n};\n"],"mappings":";;;;;;;;;;AAeA;;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAC0D;AAGnD,MAAMA,4BAA4B,GAAG,SAASA,4BAAT,CAC1CC,UAD0C,EAE1CC,gBAF0C,EAG1CC,SAAS,GAAG,EAH8B,EAI1C;EACA,OAAO,0BAAoB,kBAAAD,gBAAgB,MAAhB,CAAAA,gBAAgB,EAAME,WAAW,IAAI;IAC9D,OAAO,CACLA,WAAW,CAACC,IADP,EAEL,IAAAC,0BAAA,EAAkBL,UAAlB,EAA8BG,WAA9B,EAA2CD,SAA3C,CAFK,CAAP;EAID,CAL0C,CAApC,CAAP;AAMD,CAXM"}
package/cjs/idx/index.js CHANGED
@@ -26,34 +26,28 @@ Object.defineProperty(exports, "authenticate", {
26
26
  return _authenticate.authenticate;
27
27
  }
28
28
  });
29
- Object.defineProperty(exports, "cancel", {
30
- enumerable: true,
31
- get: function () {
32
- return _cancel.cancel;
33
- }
34
- });
35
- Object.defineProperty(exports, "handleEmailVerifyCallback", {
29
+ Object.defineProperty(exports, "canProceed", {
36
30
  enumerable: true,
37
31
  get: function () {
38
- return _emailVerify.handleEmailVerifyCallback;
32
+ return _proceed.canProceed;
39
33
  }
40
34
  });
41
- Object.defineProperty(exports, "isEmailVerifyCallback", {
35
+ Object.defineProperty(exports, "cancel", {
42
36
  enumerable: true,
43
37
  get: function () {
44
- return _emailVerify.isEmailVerifyCallback;
38
+ return _cancel.cancel;
45
39
  }
46
40
  });
47
- Object.defineProperty(exports, "parseEmailVerifyCallback", {
41
+ Object.defineProperty(exports, "handleEmailVerifyCallback", {
48
42
  enumerable: true,
49
43
  get: function () {
50
- return _emailVerify.parseEmailVerifyCallback;
44
+ return _emailVerify.handleEmailVerifyCallback;
51
45
  }
52
46
  });
53
- Object.defineProperty(exports, "isEmailVerifyCallbackError", {
47
+ Object.defineProperty(exports, "handleInteractionCodeRedirect", {
54
48
  enumerable: true,
55
49
  get: function () {
56
- return _emailVerify.isEmailVerifyCallbackError;
50
+ return _handleInteractionCodeRedirect.handleInteractionCodeRedirect;
57
51
  }
58
52
  });
59
53
  Object.defineProperty(exports, "interact", {
@@ -68,28 +62,34 @@ Object.defineProperty(exports, "introspect", {
68
62
  return _introspect.introspect;
69
63
  }
70
64
  });
71
- Object.defineProperty(exports, "poll", {
65
+ Object.defineProperty(exports, "isEmailVerifyCallback", {
72
66
  enumerable: true,
73
67
  get: function () {
74
- return _poll.poll;
68
+ return _emailVerify.isEmailVerifyCallback;
75
69
  }
76
70
  });
77
- Object.defineProperty(exports, "proceed", {
71
+ Object.defineProperty(exports, "isEmailVerifyCallbackError", {
78
72
  enumerable: true,
79
73
  get: function () {
80
- return _proceed.proceed;
74
+ return _emailVerify.isEmailVerifyCallbackError;
81
75
  }
82
76
  });
83
- Object.defineProperty(exports, "canProceed", {
77
+ Object.defineProperty(exports, "parseEmailVerifyCallback", {
84
78
  enumerable: true,
85
79
  get: function () {
86
- return _proceed.canProceed;
80
+ return _emailVerify.parseEmailVerifyCallback;
87
81
  }
88
82
  });
89
- Object.defineProperty(exports, "register", {
83
+ Object.defineProperty(exports, "poll", {
90
84
  enumerable: true,
91
85
  get: function () {
92
- return _register.register;
86
+ return _poll.poll;
87
+ }
88
+ });
89
+ Object.defineProperty(exports, "proceed", {
90
+ enumerable: true,
91
+ get: function () {
92
+ return _proceed.proceed;
93
93
  }
94
94
  });
95
95
  Object.defineProperty(exports, "recoverPassword", {
@@ -98,10 +98,10 @@ Object.defineProperty(exports, "recoverPassword", {
98
98
  return _recoverPassword.recoverPassword;
99
99
  }
100
100
  });
101
- Object.defineProperty(exports, "handleInteractionCodeRedirect", {
101
+ Object.defineProperty(exports, "register", {
102
102
  enumerable: true,
103
103
  get: function () {
104
- return _handleInteractionCodeRedirect.handleInteractionCodeRedirect;
104
+ return _register.register;
105
105
  }
106
106
  });
107
107
  Object.defineProperty(exports, "startTransaction", {