@okta/okta-auth-js 6.0.0 → 6.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (398) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/README.md +58 -27
  3. package/cjs/AuthStateManager.js +21 -7
  4. package/cjs/AuthStateManager.js.map +1 -1
  5. package/cjs/OktaAuth.js +96 -40
  6. package/cjs/OktaAuth.js.map +1 -1
  7. package/cjs/OktaUserAgent.js +2 -2
  8. package/cjs/PromiseQueue.js +14 -3
  9. package/cjs/PromiseQueue.js.map +1 -1
  10. package/cjs/SavedObject.js +4 -2
  11. package/cjs/SavedObject.js.map +1 -1
  12. package/cjs/ServiceManager.js +195 -0
  13. package/cjs/ServiceManager.js.map +1 -0
  14. package/cjs/StorageManager.js +13 -8
  15. package/cjs/StorageManager.js.map +1 -1
  16. package/cjs/TokenManager.js +34 -32
  17. package/cjs/TokenManager.js.map +1 -1
  18. package/cjs/TransactionManager.js +17 -5
  19. package/cjs/TransactionManager.js.map +1 -1
  20. package/cjs/browser/browserStorage.js +48 -33
  21. package/cjs/browser/browserStorage.js.map +1 -1
  22. package/cjs/browser/fingerprint.js +9 -3
  23. package/cjs/browser/fingerprint.js.map +1 -1
  24. package/cjs/builderUtil.js +4 -2
  25. package/cjs/builderUtil.js.map +1 -1
  26. package/cjs/clock.js +5 -1
  27. package/cjs/clock.js.map +1 -1
  28. package/cjs/crypto/base64.js +18 -0
  29. package/cjs/crypto/base64.js.map +1 -1
  30. package/cjs/crypto/index.js +6 -4
  31. package/cjs/crypto/index.js.map +1 -1
  32. package/cjs/crypto/node.js +19 -13
  33. package/cjs/crypto/node.js.map +1 -1
  34. package/cjs/crypto/oidcHash.js +5 -1
  35. package/cjs/crypto/oidcHash.js.map +1 -1
  36. package/cjs/crypto/webauthn.js +101 -0
  37. package/cjs/crypto/webauthn.js.map +1 -0
  38. package/cjs/crypto/webcrypto.js +3 -1
  39. package/cjs/crypto/webcrypto.js.map +1 -1
  40. package/cjs/errors/AuthApiError.js +1 -1
  41. package/cjs/errors/AuthPollStopError.js +1 -1
  42. package/cjs/errors/AuthSdkError.js +1 -1
  43. package/cjs/errors/CustomError.js +5 -1
  44. package/cjs/errors/CustomError.js.map +1 -1
  45. package/cjs/errors/OAuthError.js +1 -1
  46. package/cjs/errors/index.js +1 -1
  47. package/cjs/fetch/fetchRequest.js +18 -6
  48. package/cjs/fetch/fetchRequest.js.map +1 -1
  49. package/cjs/http/headers.js.map +1 -1
  50. package/cjs/http/index.js +4 -2
  51. package/cjs/http/index.js.map +1 -1
  52. package/cjs/http/request.js +9 -5
  53. package/cjs/http/request.js.map +1 -1
  54. package/cjs/idx/authenticate.js.map +1 -1
  55. package/cjs/idx/authenticator/Authenticator.js.map +1 -1
  56. package/cjs/idx/authenticator/OktaPassword.js +12 -3
  57. package/cjs/idx/authenticator/OktaPassword.js.map +1 -1
  58. package/cjs/idx/authenticator/OktaVerifyTotp.js +9 -1
  59. package/cjs/idx/authenticator/OktaVerifyTotp.js.map +1 -1
  60. package/cjs/idx/authenticator/SecurityQuestionEnrollment.js +15 -2
  61. package/cjs/idx/authenticator/SecurityQuestionEnrollment.js.map +1 -1
  62. package/cjs/idx/authenticator/SecurityQuestionVerification.js +10 -2
  63. package/cjs/idx/authenticator/SecurityQuestionVerification.js.map +1 -1
  64. package/cjs/idx/authenticator/VerificationCodeAuthenticator.js +13 -3
  65. package/cjs/idx/authenticator/VerificationCodeAuthenticator.js.map +1 -1
  66. package/cjs/idx/authenticator/WebauthnEnrollment.js +51 -0
  67. package/cjs/idx/authenticator/WebauthnEnrollment.js.map +1 -0
  68. package/cjs/idx/authenticator/WebauthnVerification.js +60 -0
  69. package/cjs/idx/authenticator/WebauthnVerification.js.map +1 -0
  70. package/cjs/idx/authenticator/getAuthenticator.js +13 -1
  71. package/cjs/idx/authenticator/getAuthenticator.js.map +1 -1
  72. package/cjs/idx/authenticator/index.js +34 -6
  73. package/cjs/idx/authenticator/index.js.map +1 -1
  74. package/cjs/idx/authenticator/util.js +64 -0
  75. package/cjs/idx/authenticator/util.js.map +1 -0
  76. package/cjs/idx/cancel.js.map +1 -1
  77. package/cjs/idx/emailVerify.js +1 -1
  78. package/cjs/idx/emailVerify.js.map +1 -1
  79. package/cjs/idx/flow/AccountUnlockFlow.js +30 -0
  80. package/cjs/idx/flow/AccountUnlockFlow.js.map +1 -0
  81. package/cjs/idx/flow/FlowSpecification.js +8 -0
  82. package/cjs/idx/flow/FlowSpecification.js.map +1 -1
  83. package/cjs/idx/flow/PasswordRecoveryFlow.js +4 -1
  84. package/cjs/idx/flow/PasswordRecoveryFlow.js.map +1 -1
  85. package/cjs/idx/flow/index.js +20 -5
  86. package/cjs/idx/flow/index.js.map +1 -1
  87. package/cjs/idx/handleInteractionCodeRedirect.js +5 -1
  88. package/cjs/idx/handleInteractionCodeRedirect.js.map +1 -1
  89. package/cjs/idx/headers.js +21 -5
  90. package/cjs/idx/headers.js.map +1 -1
  91. package/cjs/idx/idx-js/client.js +91 -0
  92. package/cjs/idx/idx-js/client.js.map +1 -0
  93. package/cjs/idx/idx-js/index.js +40 -0
  94. package/cjs/idx/idx-js/index.js.map +1 -0
  95. package/cjs/idx/idx-js/interact.js +83 -0
  96. package/cjs/idx/idx-js/interact.js.map +1 -0
  97. package/cjs/idx/idx-js/introspect.js +62 -0
  98. package/cjs/idx/idx-js/introspect.js.map +1 -0
  99. package/cjs/idx/idx-js/parsers.js +41 -0
  100. package/cjs/idx/idx-js/parsers.js.map +1 -0
  101. package/cjs/idx/idx-js/util.js +34 -0
  102. package/cjs/idx/idx-js/util.js.map +1 -0
  103. package/cjs/idx/idx-js/v1/actionParser.js +90 -0
  104. package/cjs/idx/idx-js/v1/actionParser.js.map +1 -0
  105. package/cjs/idx/idx-js/v1/generateIdxAction.js +111 -0
  106. package/cjs/idx/idx-js/v1/generateIdxAction.js.map +1 -0
  107. package/cjs/idx/idx-js/v1/idxResponseParser.js +137 -0
  108. package/cjs/idx/idx-js/v1/idxResponseParser.js.map +1 -0
  109. package/cjs/idx/idx-js/v1/makeIdxState.js +65 -0
  110. package/cjs/idx/idx-js/v1/makeIdxState.js.map +1 -0
  111. package/cjs/idx/idx-js/v1/parsers.js +24 -0
  112. package/cjs/idx/idx-js/v1/parsers.js.map +1 -0
  113. package/cjs/idx/idx-js/v1/remediationParser.js +32 -0
  114. package/cjs/idx/idx-js/v1/remediationParser.js.map +1 -0
  115. package/cjs/idx/index.js +120 -121
  116. package/cjs/idx/index.js.map +1 -1
  117. package/cjs/idx/interact.js +9 -4
  118. package/cjs/idx/interact.js.map +1 -1
  119. package/cjs/idx/introspect.js +19 -9
  120. package/cjs/idx/introspect.js.map +1 -1
  121. package/cjs/idx/poll.js +13 -3
  122. package/cjs/idx/poll.js.map +1 -1
  123. package/cjs/idx/proceed.js +14 -11
  124. package/cjs/idx/proceed.js.map +1 -1
  125. package/cjs/idx/recoverPassword.js.map +1 -1
  126. package/cjs/idx/register.js +5 -1
  127. package/cjs/idx/register.js.map +1 -1
  128. package/cjs/idx/remediate.js +112 -88
  129. package/cjs/idx/remediate.js.map +1 -1
  130. package/cjs/idx/remediators/AuthenticatorEnrollmentData.js +16 -6
  131. package/cjs/idx/remediators/AuthenticatorEnrollmentData.js.map +1 -1
  132. package/cjs/idx/remediators/AuthenticatorVerificationData.js +61 -16
  133. package/cjs/idx/remediators/AuthenticatorVerificationData.js.map +1 -1
  134. package/cjs/idx/remediators/Base/AuthenticatorData.js +44 -20
  135. package/cjs/idx/remediators/Base/AuthenticatorData.js.map +1 -1
  136. package/cjs/idx/remediators/Base/Remediator.js +116 -82
  137. package/cjs/idx/remediators/Base/Remediator.js.map +1 -1
  138. package/cjs/idx/remediators/Base/SelectAuthenticator.js +58 -34
  139. package/cjs/idx/remediators/Base/SelectAuthenticator.js.map +1 -1
  140. package/cjs/idx/remediators/Base/VerifyAuthenticator.js +30 -7
  141. package/cjs/idx/remediators/Base/VerifyAuthenticator.js.map +1 -1
  142. package/cjs/idx/remediators/ChallengeAuthenticator.js +2 -2
  143. package/cjs/idx/remediators/ChallengePoll.js +10 -3
  144. package/cjs/idx/remediators/ChallengePoll.js.map +1 -1
  145. package/cjs/idx/remediators/EnrollAuthenticator.js +2 -2
  146. package/cjs/idx/remediators/EnrollPoll.js +16 -6
  147. package/cjs/idx/remediators/EnrollPoll.js.map +1 -1
  148. package/cjs/idx/remediators/EnrollProfile.js +34 -16
  149. package/cjs/idx/remediators/EnrollProfile.js.map +1 -1
  150. package/cjs/idx/remediators/EnrollmentChannelData.js +25 -17
  151. package/cjs/idx/remediators/EnrollmentChannelData.js.map +1 -1
  152. package/cjs/idx/remediators/Identify.js +16 -7
  153. package/cjs/idx/remediators/Identify.js.map +1 -1
  154. package/cjs/idx/remediators/ReEnrollAuthenticator.js +13 -10
  155. package/cjs/idx/remediators/ReEnrollAuthenticator.js.map +1 -1
  156. package/cjs/idx/remediators/RedirectIdp.js +2 -2
  157. package/cjs/idx/remediators/ResetAuthenticator.js +2 -2
  158. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js +9 -6
  159. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js.map +1 -1
  160. package/cjs/idx/remediators/SelectAuthenticatorEnroll.js +2 -2
  161. package/cjs/idx/remediators/SelectAuthenticatorUnlockAccount.js +71 -0
  162. package/cjs/idx/remediators/SelectAuthenticatorUnlockAccount.js.map +1 -0
  163. package/cjs/idx/remediators/SelectEnrollProfile.js +2 -2
  164. package/cjs/idx/remediators/SelectEnrollmentChannel.js +22 -10
  165. package/cjs/idx/remediators/SelectEnrollmentChannel.js.map +1 -1
  166. package/cjs/idx/remediators/Skip.js +5 -10
  167. package/cjs/idx/remediators/Skip.js.map +1 -1
  168. package/cjs/idx/remediators/index.js +33 -18
  169. package/cjs/idx/remediators/index.js.map +1 -1
  170. package/cjs/idx/remediators/util.js +13 -3
  171. package/cjs/idx/remediators/util.js.map +1 -1
  172. package/cjs/idx/run.js +276 -177
  173. package/cjs/idx/run.js.map +1 -1
  174. package/cjs/idx/startTransaction.js.map +1 -1
  175. package/cjs/idx/transactionMeta.js.map +1 -1
  176. package/cjs/idx/types/idx-js.js.map +1 -1
  177. package/cjs/idx/types/index.js +82 -9
  178. package/cjs/idx/types/index.js.map +1 -1
  179. package/cjs/idx/unlockAccount.js +48 -0
  180. package/cjs/idx/unlockAccount.js.map +1 -0
  181. package/cjs/idx/util.js +198 -0
  182. package/cjs/idx/util.js.map +1 -0
  183. package/cjs/index.js +20 -14
  184. package/cjs/index.js.map +1 -1
  185. package/cjs/oidc/endpoints/authorize.js +8 -2
  186. package/cjs/oidc/endpoints/authorize.js.map +1 -1
  187. package/cjs/oidc/endpoints/index.js +5 -3
  188. package/cjs/oidc/endpoints/index.js.map +1 -1
  189. package/cjs/oidc/endpoints/token.js +15 -3
  190. package/cjs/oidc/endpoints/token.js.map +1 -1
  191. package/cjs/oidc/endpoints/well-known.js +7 -3
  192. package/cjs/oidc/endpoints/well-known.js.map +1 -1
  193. package/cjs/oidc/exchangeCodeForTokens.js +10 -2
  194. package/cjs/oidc/exchangeCodeForTokens.js.map +1 -1
  195. package/cjs/oidc/getToken.js +9 -5
  196. package/cjs/oidc/getToken.js.map +1 -1
  197. package/cjs/oidc/getUserInfo.js +7 -3
  198. package/cjs/oidc/getUserInfo.js.map +1 -1
  199. package/cjs/oidc/getWithPopup.js +8 -2
  200. package/cjs/oidc/getWithPopup.js.map +1 -1
  201. package/cjs/oidc/getWithRedirect.js +5 -1
  202. package/cjs/oidc/getWithRedirect.js.map +1 -1
  203. package/cjs/oidc/getWithoutPrompt.js +8 -2
  204. package/cjs/oidc/getWithoutPrompt.js.map +1 -1
  205. package/cjs/oidc/handleOAuthResponse.js +9 -3
  206. package/cjs/oidc/handleOAuthResponse.js.map +1 -1
  207. package/cjs/oidc/index.js +4 -2
  208. package/cjs/oidc/index.js.map +1 -1
  209. package/cjs/oidc/parseFromUrl.js +9 -3
  210. package/cjs/oidc/parseFromUrl.js.map +1 -1
  211. package/cjs/oidc/renewToken.js.map +1 -1
  212. package/cjs/oidc/renewTokens.js +5 -1
  213. package/cjs/oidc/renewTokens.js.map +1 -1
  214. package/cjs/oidc/renewTokensWithRefresh.js +5 -1
  215. package/cjs/oidc/renewTokensWithRefresh.js.map +1 -1
  216. package/cjs/oidc/revokeToken.js +7 -3
  217. package/cjs/oidc/revokeToken.js.map +1 -1
  218. package/cjs/oidc/util/browser.js +5 -1
  219. package/cjs/oidc/util/browser.js.map +1 -1
  220. package/cjs/oidc/util/defaultTokenParams.js.map +1 -1
  221. package/cjs/oidc/util/errors.js.map +1 -1
  222. package/cjs/oidc/util/index.js +14 -12
  223. package/cjs/oidc/util/index.js.map +1 -1
  224. package/cjs/oidc/util/loginRedirect.js +5 -1
  225. package/cjs/oidc/util/loginRedirect.js.map +1 -1
  226. package/cjs/oidc/util/oauth.js +4 -2
  227. package/cjs/oidc/util/oauth.js.map +1 -1
  228. package/cjs/oidc/util/oauthMeta.js.map +1 -1
  229. package/cjs/oidc/util/pkce.js +11 -3
  230. package/cjs/oidc/util/pkce.js.map +1 -1
  231. package/cjs/oidc/util/prepareTokenParams.js +7 -5
  232. package/cjs/oidc/util/prepareTokenParams.js.map +1 -1
  233. package/cjs/oidc/util/validateClaims.js +1 -1
  234. package/cjs/oidc/util/validateClaims.js.map +1 -1
  235. package/cjs/oidc/verifyToken.js +11 -3
  236. package/cjs/oidc/verifyToken.js.map +1 -1
  237. package/cjs/options/browser.js +86 -0
  238. package/cjs/options/browser.js.map +1 -0
  239. package/cjs/options/index.js +94 -0
  240. package/cjs/options/index.js.map +1 -0
  241. package/cjs/options/node.js +45 -0
  242. package/cjs/options/node.js.map +1 -0
  243. package/cjs/options.js +17 -5
  244. package/cjs/options.js.map +1 -1
  245. package/cjs/server/serverStorage.js +8 -4
  246. package/cjs/server/serverStorage.js.map +1 -1
  247. package/cjs/services/AutoRenewService.js +94 -0
  248. package/cjs/services/AutoRenewService.js.map +1 -0
  249. package/cjs/services/SyncStorageService.js +93 -0
  250. package/cjs/services/SyncStorageService.js.map +1 -0
  251. package/cjs/services/index.js +30 -0
  252. package/cjs/services/index.js.map +1 -0
  253. package/cjs/tx/AuthTransaction.js +15 -9
  254. package/cjs/tx/AuthTransaction.js.map +1 -1
  255. package/cjs/tx/api.js +8 -4
  256. package/cjs/tx/api.js.map +1 -1
  257. package/cjs/tx/index.js +7 -5
  258. package/cjs/tx/index.js.map +1 -1
  259. package/cjs/tx/poll.js +6 -4
  260. package/cjs/tx/poll.js.map +1 -1
  261. package/cjs/tx/util.js +5 -1
  262. package/cjs/tx/util.js.map +1 -1
  263. package/cjs/types/Service.js +2 -0
  264. package/cjs/types/Service.js.map +1 -0
  265. package/cjs/types/Transaction.js +10 -2
  266. package/cjs/types/Transaction.js.map +1 -1
  267. package/cjs/types/index.js +29 -14
  268. package/cjs/types/index.js.map +1 -1
  269. package/cjs/util/index.js +7 -5
  270. package/cjs/util/index.js.map +1 -1
  271. package/cjs/util/misc.js +5 -1
  272. package/cjs/util/misc.js.map +1 -1
  273. package/cjs/util/object.js +16 -6
  274. package/cjs/util/object.js.map +1 -1
  275. package/cjs/util/sharedStorage.js +5 -1
  276. package/cjs/util/sharedStorage.js.map +1 -1
  277. package/dist/okta-auth-js.min.js +1 -1
  278. package/dist/okta-auth-js.min.js.LICENSE.txt +0 -20
  279. package/dist/okta-auth-js.min.js.map +1 -1
  280. package/dist/okta-auth-js.polyfill.js +1 -1
  281. package/dist/okta-auth-js.polyfill.js.map +1 -1
  282. package/dist/okta-auth-js.umd.js +1 -1
  283. package/dist/okta-auth-js.umd.js.LICENSE.txt +1 -19
  284. package/dist/okta-auth-js.umd.js.map +1 -1
  285. package/esm/{index.js → esm.browser.js} +2978 -2585
  286. package/esm/esm.browser.js.map +1 -0
  287. package/esm/esm.node.mjs +9595 -0
  288. package/esm/esm.node.mjs.map +1 -0
  289. package/lib/AuthStateManager.d.ts +3 -3
  290. package/lib/OktaAuth.d.ts +10 -6
  291. package/lib/PromiseQueue.d.ts +6 -2
  292. package/lib/ServiceManager.d.ts +38 -0
  293. package/lib/StorageManager.d.ts +1 -1
  294. package/lib/TokenManager.d.ts +2 -3
  295. package/lib/TransactionManager.d.ts +4 -5
  296. package/lib/browser/fingerprint.d.ts +2 -3
  297. package/lib/crypto/base64.d.ts +2 -0
  298. package/lib/crypto/webauthn.d.ts +25 -0
  299. package/lib/http/headers.d.ts +2 -2
  300. package/lib/http/request.d.ts +4 -4
  301. package/lib/idx/authenticate.d.ts +2 -2
  302. package/lib/idx/authenticator/Authenticator.d.ts +4 -5
  303. package/lib/idx/authenticator/OktaPassword.d.ts +8 -9
  304. package/lib/idx/authenticator/OktaVerifyTotp.d.ts +1 -1
  305. package/lib/idx/authenticator/SecurityQuestionEnrollment.d.ts +11 -12
  306. package/lib/idx/authenticator/SecurityQuestionVerification.d.ts +7 -7
  307. package/lib/idx/authenticator/VerificationCodeAuthenticator.d.ts +8 -3
  308. package/lib/idx/authenticator/WebauthnEnrollment.d.ts +16 -0
  309. package/lib/idx/authenticator/WebauthnVerification.d.ts +17 -0
  310. package/lib/idx/authenticator/getAuthenticator.d.ts +1 -1
  311. package/lib/idx/authenticator/index.d.ts +9 -0
  312. package/lib/idx/authenticator/util.d.ts +4 -0
  313. package/lib/idx/cancel.d.ts +2 -2
  314. package/lib/idx/emailVerify.d.ts +2 -2
  315. package/lib/idx/flow/AccountUnlockFlow.d.ts +13 -0
  316. package/lib/idx/flow/FlowSpecification.d.ts +2 -2
  317. package/lib/idx/flow/index.d.ts +1 -0
  318. package/lib/idx/headers.d.ts +3 -2
  319. package/lib/idx/idx-js/client.d.ts +36 -0
  320. package/lib/idx/idx-js/index.d.ts +35 -0
  321. package/lib/idx/idx-js/interact.d.ts +25 -0
  322. package/lib/idx/idx-js/introspect.d.ts +21 -0
  323. package/lib/idx/idx-js/parsers.d.ts +15 -0
  324. package/lib/idx/idx-js/util.d.ts +12 -0
  325. package/lib/idx/idx-js/v1/actionParser.d.ts +16 -0
  326. package/lib/idx/idx-js/v1/generateIdxAction.d.ts +13 -0
  327. package/lib/idx/idx-js/v1/idxResponseParser.d.ts +20 -0
  328. package/lib/idx/idx-js/v1/makeIdxState.d.ts +13 -0
  329. package/lib/idx/idx-js/v1/parsers.d.ts +16 -0
  330. package/lib/idx/idx-js/v1/remediationParser.d.ts +12 -0
  331. package/lib/idx/index.d.ts +12 -11
  332. package/lib/idx/interact.d.ts +3 -2
  333. package/lib/idx/introspect.d.ts +2 -2
  334. package/lib/idx/poll.d.ts +2 -2
  335. package/lib/idx/proceed.d.ts +5 -6
  336. package/lib/idx/recoverPassword.d.ts +2 -2
  337. package/lib/idx/register.d.ts +2 -2
  338. package/lib/idx/remediate.d.ts +2 -2
  339. package/lib/idx/remediators/AuthenticatorVerificationData.d.ts +6 -5
  340. package/lib/idx/remediators/Base/AuthenticatorData.d.ts +5 -8
  341. package/lib/idx/remediators/Base/Remediator.d.ts +6 -5
  342. package/lib/idx/remediators/Base/SelectAuthenticator.d.ts +9 -8
  343. package/lib/idx/remediators/Base/VerifyAuthenticator.d.ts +9 -16
  344. package/lib/idx/remediators/ChallengePoll.d.ts +1 -0
  345. package/lib/idx/remediators/EnrollProfile.d.ts +0 -3
  346. package/lib/idx/remediators/EnrollmentChannelData.d.ts +1 -4
  347. package/lib/idx/remediators/Identify.d.ts +3 -5
  348. package/lib/idx/remediators/ReEnrollAuthenticator.d.ts +2 -5
  349. package/lib/idx/remediators/SelectAuthenticatorAuthenticate.d.ts +2 -1
  350. package/lib/idx/remediators/SelectAuthenticatorUnlockAccount.d.ts +37 -0
  351. package/lib/idx/remediators/SelectEnrollmentChannel.d.ts +1 -0
  352. package/lib/idx/remediators/Skip.d.ts +0 -3
  353. package/lib/idx/remediators/index.d.ts +1 -0
  354. package/lib/idx/run.d.ts +2 -2
  355. package/lib/idx/startTransaction.d.ts +2 -2
  356. package/lib/idx/transactionMeta.d.ts +7 -7
  357. package/lib/idx/types/FlowIdentifier.d.ts +1 -1
  358. package/lib/idx/types/idx-js.d.ts +41 -1
  359. package/lib/idx/types/index.d.ts +27 -7
  360. package/lib/idx/unlockAccount.d.ts +15 -0
  361. package/lib/idx/util.d.ts +11 -0
  362. package/lib/oidc/endpoints/well-known.d.ts +3 -3
  363. package/lib/oidc/exchangeCodeForTokens.d.ts +2 -2
  364. package/lib/oidc/getToken.d.ts +2 -2
  365. package/lib/oidc/getWithPopup.d.ts +2 -2
  366. package/lib/oidc/getWithRedirect.d.ts +2 -2
  367. package/lib/oidc/getWithoutPrompt.d.ts +2 -2
  368. package/lib/oidc/handleOAuthResponse.d.ts +2 -2
  369. package/lib/oidc/renewToken.d.ts +2 -2
  370. package/lib/oidc/renewTokensWithRefresh.d.ts +2 -2
  371. package/lib/oidc/revokeToken.d.ts +2 -2
  372. package/lib/oidc/util/browser.d.ts +2 -2
  373. package/lib/oidc/util/defaultTokenParams.d.ts +2 -2
  374. package/lib/oidc/util/errors.d.ts +2 -2
  375. package/lib/oidc/util/loginRedirect.d.ts +4 -4
  376. package/lib/oidc/util/oauth.d.ts +4 -4
  377. package/lib/oidc/util/oauthMeta.d.ts +2 -2
  378. package/lib/oidc/util/prepareTokenParams.d.ts +5 -5
  379. package/lib/oidc/util/validateClaims.d.ts +2 -2
  380. package/lib/oidc/verifyToken.d.ts +2 -2
  381. package/lib/options/browser.d.ts +16 -0
  382. package/lib/options/index.d.ts +14 -0
  383. package/lib/options/node.d.ts +16 -0
  384. package/lib/services/AutoRenewService.d.ts +27 -0
  385. package/lib/services/{TokenService.d.ts → SyncStorageService.d.ts} +8 -5
  386. package/lib/services/index.d.ts +13 -0
  387. package/lib/types/OktaAuthOptions.d.ts +6 -2
  388. package/lib/types/Service.d.ts +23 -0
  389. package/lib/types/Storage.d.ts +7 -5
  390. package/lib/types/Transaction.d.ts +2 -10
  391. package/lib/types/api.d.ts +23 -10
  392. package/lib/types/index.d.ts +1 -1
  393. package/lib/util/sharedStorage.d.ts +1 -1
  394. package/package.json +32 -14
  395. package/polyfill/index.js +1 -0
  396. package/cjs/services/TokenService.js +0 -111
  397. package/cjs/services/TokenService.js.map +0 -1
  398. package/esm/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/browser/fingerprint.ts"],"names":["fingerprint","sdk","options","Promise","reject","AuthSdkError","timeout","iframe","listener","promise","resolve","document","createElement","style","display","e","data","origin","getIssuerOrigin","msg","JSON","parse","err","type","source","postMessage","stringify","window","src","body","appendChild","setTimeout","finally","clearTimeout","contains","parentElement","removeChild"],"mappings":";;;;AAcA;;AACA;;AACA;;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAYe,SAASA,WAAT,CAAqBC,GAArB,EAAoCC,OAApC,EAAmF;AAChGA,EAAAA,OAAO,GAAGA,OAAO,IAAI,EAArB;;AAEA,MAAI,CAAC,uCAAL,EAA+B;AAC7B,WAAOC,OAAO,CAACC,MAAR,CAAe,IAAIC,oBAAJ,CAAiB,gDAAjB,CAAf,CAAP;AACD;;AAED,MAAIC,OAAJ;AACA,MAAIC,MAAJ;AACA,MAAIC,QAAJ;AACA,MAAIC,OAAO,GAAG,IAAIN,OAAJ,CAAY,UAAUO,OAAV,EAAmBN,MAAnB,EAA2B;AAAA;;AACnDG,IAAAA,MAAM,GAAGI,QAAQ,CAACC,aAAT,CAAuB,QAAvB,CAAT;AACAL,IAAAA,MAAM,CAACM,KAAP,CAAaC,OAAb,GAAuB,MAAvB,CAFmD,CAInD;;AACAN,IAAAA,QAAQ,GAAG,SAASA,QAAT,CAAkBO,CAAlB,EAAqB;AAC9B,UAAI,CAACA,CAAD,IAAM,CAACA,CAAC,CAACC,IAAT,IAAiBD,CAAC,CAACE,MAAF,KAAahB,GAAG,CAACiB,eAAJ,EAAlC,EAAyD;AACvD;AACD;;AAED,UAAI;AACF,YAAIC,GAAG,GAAGC,IAAI,CAACC,KAAL,CAAWN,CAAC,CAACC,IAAb,CAAV;AACD,OAFD,CAEE,OAAOM,GAAP,EAAY;AACZ;AACA;AACA;AACA;AACD;;AAED,UAAI,CAACH,GAAL,EAAU;AAAE;AAAS;;AACrB,UAAIA,GAAG,CAACI,IAAJ,KAAa,sBAAjB,EAAyC;AACvC,eAAOb,OAAO,CAACS,GAAG,CAACnB,WAAL,CAAd;AACD;;AACD,UAAImB,GAAG,CAACI,IAAJ,KAAa,yBAAjB,EAA4C;AAC1CR,QAAAA,CAAC,CAACS,MAAF,CAASC,WAAT,CAAqBL,IAAI,CAACM,SAAL,CAAe;AAClCH,UAAAA,IAAI,EAAE;AAD4B,SAAf,CAArB,EAEIR,CAAC,CAACE,MAFN;AAGD;AACF,KAvBD;;AAwBA,2BAAYU,MAAZ,EAAoB,SAApB,EAA+BnB,QAA/B;AAEAD,IAAAA,MAAM,CAACqB,GAAP,GAAa3B,GAAG,CAACiB,eAAJ,KAAwB,kCAArC;AACAP,IAAAA,QAAQ,CAACkB,IAAT,CAAcC,WAAd,CAA0BvB,MAA1B;AAEAD,IAAAA,OAAO,GAAGyB,UAAU,CAAC,YAAW;AAC9B3B,MAAAA,MAAM,CAAC,IAAIC,oBAAJ,CAAiB,0BAAjB,CAAD,CAAN;AACD,KAFmB,EAEjB,aAAAH,OAAO,UAAP,4CAASI,OAAT,KAAoB,KAFH,CAApB;AAGD,GArCa,CAAd;AAuCA,SAAOG,OAAO,CAACuB,OAAR,CAAgB,YAAW;AAChCC,IAAAA,YAAY,CAAC3B,OAAD,CAAZ;AACA,8BAAeqB,MAAf,EAAuB,SAAvB,EAAkCnB,QAAlC;;AACA,QAAIG,QAAQ,CAACkB,IAAT,CAAcK,QAAd,CAAuB3B,MAAvB,CAAJ,EAAoC;AAClCA,MAAAA,MAAM,CAAC4B,aAAP,CAAqBC,WAArB,CAAiC7B,MAAjC;AACD;AACF,GANM,CAAP;AAOD","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { OktaAuth } from '../types';\nimport { AuthSdkError } from '../errors';\nimport { isFingerprintSupported } from '../features';\nimport {\n addListener,\n removeListener\n} from '../oidc';\nimport { FingerprintOptions } from '../types';\n\nexport default function fingerprint(sdk: OktaAuth, options?: FingerprintOptions): Promise<string> {\n options = options || {};\n\n if (!isFingerprintSupported()) {\n return Promise.reject(new AuthSdkError('Fingerprinting is not supported on this device'));\n }\n\n var timeout;\n var iframe;\n var listener;\n var promise = new Promise(function (resolve, reject) {\n iframe = document.createElement('iframe');\n iframe.style.display = 'none';\n\n // eslint-disable-next-line complexity\n listener = function listener(e) {\n if (!e || !e.data || e.origin !== sdk.getIssuerOrigin()) {\n return;\n }\n\n try {\n var msg = JSON.parse(e.data);\n } catch (err) {\n // iframe messages should all be parsable\n // skip not parsable messages come from other sources in same origin (browser extensions)\n // TODO: add namespace flag in okta-core to distinguish messages that come from other sources\n return;\n }\n\n if (!msg) { return; }\n if (msg.type === 'FingerprintAvailable') {\n return resolve(msg.fingerprint as string);\n }\n if (msg.type === 'FingerprintServiceReady') {\n e.source.postMessage(JSON.stringify({\n type: 'GetFingerprint'\n }), e.origin);\n }\n };\n addListener(window, 'message', listener);\n\n iframe.src = sdk.getIssuerOrigin() + '/auth/services/devicefingerprint';\n document.body.appendChild(iframe);\n\n timeout = setTimeout(function() {\n reject(new AuthSdkError('Fingerprinting timed out'));\n }, options?.timeout || 15000);\n });\n\n return promise.finally(function() {\n clearTimeout(timeout);\n removeListener(window, 'message', listener);\n if (document.body.contains(iframe)) {\n iframe.parentElement.removeChild(iframe);\n }\n }) as Promise<string>;\n}\n"],"file":"fingerprint.js"}
1
+ {"version":3,"sources":["../../../lib/browser/fingerprint.ts"],"names":["fingerprint","sdk","options","reject","AuthSdkError","timeout","iframe","listener","promise","resolve","document","createElement","style","display","e","data","origin","getIssuerOrigin","msg","JSON","parse","err","type","source","postMessage","window","src","body","appendChild","setTimeout","finally","clearTimeout","contains","parentElement","removeChild"],"mappings":";;;;;;;;;;AAaA;;AACA;;AACA;;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAWe,SAASA,WAAT,CAAqBC,GAArB,EAA6CC,OAA7C,EAA4F;AACzGA,EAAAA,OAAO,GAAGA,OAAO,IAAI,EAArB;;AAEA,MAAI,CAAC,uCAAL,EAA+B;AAC7B,WAAO,iBAAQC,MAAR,CAAe,IAAIC,oBAAJ,CAAiB,gDAAjB,CAAf,CAAP;AACD;;AAED,MAAIC,OAAJ;AACA,MAAIC,MAAJ;AACA,MAAIC,QAAJ;AACA,MAAIC,OAAO,GAAG,qBAAY,UAAUC,OAAV,EAAmBN,MAAnB,EAA2B;AAAA;;AACnDG,IAAAA,MAAM,GAAGI,QAAQ,CAACC,aAAT,CAAuB,QAAvB,CAAT;AACAL,IAAAA,MAAM,CAACM,KAAP,CAAaC,OAAb,GAAuB,MAAvB,CAFmD,CAInD;;AACAN,IAAAA,QAAQ,GAAG,SAASA,QAAT,CAAkBO,CAAlB,EAAqB;AAC9B,UAAI,CAACA,CAAD,IAAM,CAACA,CAAC,CAACC,IAAT,IAAiBD,CAAC,CAACE,MAAF,KAAaf,GAAG,CAACgB,eAAJ,EAAlC,EAAyD;AACvD;AACD;;AAED,UAAI;AACF,YAAIC,GAAG,GAAGC,IAAI,CAACC,KAAL,CAAWN,CAAC,CAACC,IAAb,CAAV;AACD,OAFD,CAEE,OAAOM,GAAP,EAAY;AACZ;AACA;AACA;AACA;AACD;;AAED,UAAI,CAACH,GAAL,EAAU;AAAE;AAAS;;AACrB,UAAIA,GAAG,CAACI,IAAJ,KAAa,sBAAjB,EAAyC;AACvC,eAAOb,OAAO,CAACS,GAAG,CAAClB,WAAL,CAAd;AACD;;AACD,UAAIkB,GAAG,CAACI,IAAJ,KAAa,yBAAjB,EAA4C;AAC1CR,QAAAA,CAAC,CAACS,MAAF,CAASC,WAAT,CAAqB,wBAAe;AAClCF,UAAAA,IAAI,EAAE;AAD4B,SAAf,CAArB,EAEIR,CAAC,CAACE,MAFN;AAGD;AACF,KAvBD;;AAwBA,2BAAYS,MAAZ,EAAoB,SAApB,EAA+BlB,QAA/B;AAEAD,IAAAA,MAAM,CAACoB,GAAP,GAAazB,GAAG,CAACgB,eAAJ,KAAwB,kCAArC;AACAP,IAAAA,QAAQ,CAACiB,IAAT,CAAcC,WAAd,CAA0BtB,MAA1B;AAEAD,IAAAA,OAAO,GAAGwB,UAAU,CAAC,YAAW;AAC9B1B,MAAAA,MAAM,CAAC,IAAIC,oBAAJ,CAAiB,0BAAjB,CAAD,CAAN;AACD,KAFmB,EAEjB,aAAAF,OAAO,UAAP,4CAASG,OAAT,KAAoB,KAFH,CAApB;AAGD,GArCa,CAAd;AAuCA,SAAOG,OAAO,CAACsB,OAAR,CAAgB,YAAW;AAChCC,IAAAA,YAAY,CAAC1B,OAAD,CAAZ;AACA,8BAAeoB,MAAf,EAAuB,SAAvB,EAAkClB,QAAlC;;AACA,QAAIG,QAAQ,CAACiB,IAAT,CAAcK,QAAd,CAAuB1B,MAAvB,CAAJ,EAAoC;AAClCA,MAAAA,MAAM,CAAC2B,aAAP,CAAqBC,WAArB,CAAiC5B,MAAjC;AACD;AACF,GANM,CAAP;AAOD","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { AuthSdkError } from '../errors';\nimport { isFingerprintSupported } from '../features';\nimport {\n addListener,\n removeListener\n} from '../oidc';\nimport { FingerprintOptions, OktaAuthInterface } from '../types';\n\nexport default function fingerprint(sdk: OktaAuthInterface, options?: FingerprintOptions): Promise<string> {\n options = options || {};\n\n if (!isFingerprintSupported()) {\n return Promise.reject(new AuthSdkError('Fingerprinting is not supported on this device'));\n }\n\n var timeout;\n var iframe;\n var listener;\n var promise = new Promise(function (resolve, reject) {\n iframe = document.createElement('iframe');\n iframe.style.display = 'none';\n\n // eslint-disable-next-line complexity\n listener = function listener(e) {\n if (!e || !e.data || e.origin !== sdk.getIssuerOrigin()) {\n return;\n }\n\n try {\n var msg = JSON.parse(e.data);\n } catch (err) {\n // iframe messages should all be parsable\n // skip not parsable messages come from other sources in same origin (browser extensions)\n // TODO: add namespace flag in okta-core to distinguish messages that come from other sources\n return;\n }\n\n if (!msg) { return; }\n if (msg.type === 'FingerprintAvailable') {\n return resolve(msg.fingerprint as string);\n }\n if (msg.type === 'FingerprintServiceReady') {\n e.source.postMessage(JSON.stringify({\n type: 'GetFingerprint'\n }), e.origin);\n }\n };\n addListener(window, 'message', listener);\n\n iframe.src = sdk.getIssuerOrigin() + '/auth/services/devicefingerprint';\n document.body.appendChild(iframe);\n\n timeout = setTimeout(function() {\n reject(new AuthSdkError('Fingerprinting timed out'));\n }, options?.timeout || 15000);\n });\n\n return promise.finally(function() {\n clearTimeout(timeout);\n removeListener(window, 'message', listener);\n if (document.body.contains(iframe)) {\n iframe.parentElement.removeChild(iframe);\n }\n }) as Promise<string>;\n}\n"],"file":"fingerprint.js"}
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
4
 
5
5
  exports.assertValidConfig = assertValidConfig;
6
6
 
7
+ var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
8
+
7
9
  var _AuthSdkError = _interopRequireDefault(require("./errors/AuthSdkError"));
8
10
 
9
11
  /*!
@@ -40,7 +42,7 @@ function assertValidConfig(args) {
40
42
  throw new _AuthSdkError.default('Issuer must be a valid URL. ' + 'Required usage: new OktaAuth({issuer: "https://{yourOktaDomain}.com/oauth2/{authServerId}"})');
41
43
  }
42
44
 
43
- if (issuer.indexOf('-admin.') !== -1) {
45
+ if ((0, _indexOf.default)(issuer).call(issuer, '-admin.') !== -1) {
44
46
  throw new _AuthSdkError.default('Issuer URL passed to constructor contains "-admin" in subdomain. ' + 'Required usage: new OktaAuth({issuer: "https://{yourOktaDomain}.com})');
45
47
  }
46
48
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/builderUtil.ts"],"names":["assertValidConfig","args","scopes","Array","isArray","AuthSdkError","issuer","isUrlRegex","RegExp","test","indexOf"],"mappings":";;;;;;AAYA;;AAZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA,SAASA,iBAAT,CAA2BC,IAA3B,EAAkD;AAChDA,EAAAA,IAAI,GAAGA,IAAI,IAAI,EAAf;AAEA,MAAIC,MAAM,GAAGD,IAAI,CAACC,MAAlB;;AACA,MAAIA,MAAM,IAAI,CAACC,KAAK,CAACC,OAAN,CAAcF,MAAd,CAAf,EAAsC;AACpC,UAAM,IAAIG,qBAAJ,CAAiB,wCACrB,6DADI,CAAN;AAED,GAP+C,CAShD;;;AACA,MAAIC,MAAM,GAAGL,IAAI,CAACK,MAAlB;;AACA,MAAI,CAACA,MAAL,EAAa;AACX,UAAM,IAAID,qBAAJ,CAAiB,sCACrB,8FADI,CAAN;AAED;;AAED,MAAIE,UAAU,GAAG,IAAIC,MAAJ,CAAW,eAAX,CAAjB;;AACA,MAAI,CAACD,UAAU,CAACE,IAAX,CAAgBH,MAAhB,CAAL,EAA8B;AAC5B,UAAM,IAAID,qBAAJ,CAAiB,iCACrB,8FADI,CAAN;AAED;;AAED,MAAIC,MAAM,CAACI,OAAP,CAAe,SAAf,MAA8B,CAAC,CAAnC,EAAsC;AACpC,UAAM,IAAIL,qBAAJ,CAAiB,sEACrB,uEADI,CAAN;AAED;AACF","sourcesContent":["/*!\n * Copyright (c) 2018-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 AuthSdkError from './errors/AuthSdkError';\nimport { OktaAuthOptions } from './types';\n\n// TODO: use @okta/configuration-validation (move module to this monorepo?)\n// eslint-disable-next-line complexity\nfunction assertValidConfig(args: OktaAuthOptions) {\n args = args || {};\n\n var scopes = args.scopes;\n if (scopes && !Array.isArray(scopes)) {\n throw new AuthSdkError('scopes must be a array of strings. ' +\n 'Required usage: new OktaAuth({scopes: [\"openid\", \"email\"]})');\n }\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n var issuer = args.issuer!;\n if (!issuer) {\n throw new AuthSdkError('No issuer passed to constructor. ' + \n 'Required usage: new OktaAuth({issuer: \"https://{yourOktaDomain}.com/oauth2/{authServerId}\"})');\n }\n\n var isUrlRegex = new RegExp('^http?s?://.+');\n if (!isUrlRegex.test(issuer)) {\n throw new AuthSdkError('Issuer must be a valid URL. ' + \n 'Required usage: new OktaAuth({issuer: \"https://{yourOktaDomain}.com/oauth2/{authServerId}\"})');\n }\n\n if (issuer.indexOf('-admin.') !== -1) {\n throw new AuthSdkError('Issuer URL passed to constructor contains \"-admin\" in subdomain. ' +\n 'Required usage: new OktaAuth({issuer: \"https://{yourOktaDomain}.com})');\n }\n}\n\nexport {\n assertValidConfig\n};\n"],"file":"builderUtil.js"}
1
+ {"version":3,"sources":["../../lib/builderUtil.ts"],"names":["assertValidConfig","args","scopes","Array","isArray","AuthSdkError","issuer","isUrlRegex","RegExp","test"],"mappings":";;;;;;;;AAYA;;AAZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA,SAASA,iBAAT,CAA2BC,IAA3B,EAAkD;AAChDA,EAAAA,IAAI,GAAGA,IAAI,IAAI,EAAf;AAEA,MAAIC,MAAM,GAAGD,IAAI,CAACC,MAAlB;;AACA,MAAIA,MAAM,IAAI,CAACC,KAAK,CAACC,OAAN,CAAcF,MAAd,CAAf,EAAsC;AACpC,UAAM,IAAIG,qBAAJ,CAAiB,wCACrB,6DADI,CAAN;AAED,GAP+C,CAShD;;;AACA,MAAIC,MAAM,GAAGL,IAAI,CAACK,MAAlB;;AACA,MAAI,CAACA,MAAL,EAAa;AACX,UAAM,IAAID,qBAAJ,CAAiB,sCACrB,8FADI,CAAN;AAED;;AAED,MAAIE,UAAU,GAAG,IAAIC,MAAJ,CAAW,eAAX,CAAjB;;AACA,MAAI,CAACD,UAAU,CAACE,IAAX,CAAgBH,MAAhB,CAAL,EAA8B;AAC5B,UAAM,IAAID,qBAAJ,CAAiB,iCACrB,8FADI,CAAN;AAED;;AAED,MAAI,sBAAAC,MAAM,MAAN,CAAAA,MAAM,EAAS,SAAT,CAAN,KAA8B,CAAC,CAAnC,EAAsC;AACpC,UAAM,IAAID,qBAAJ,CAAiB,sEACrB,uEADI,CAAN;AAED;AACF","sourcesContent":["/*!\n * Copyright (c) 2018-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 AuthSdkError from './errors/AuthSdkError';\nimport { OktaAuthOptions } from './types';\n\n// TODO: use @okta/configuration-validation (move module to this monorepo?)\n// eslint-disable-next-line complexity\nfunction assertValidConfig(args: OktaAuthOptions) {\n args = args || {};\n\n var scopes = args.scopes;\n if (scopes && !Array.isArray(scopes)) {\n throw new AuthSdkError('scopes must be a array of strings. ' +\n 'Required usage: new OktaAuth({scopes: [\"openid\", \"email\"]})');\n }\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n var issuer = args.issuer!;\n if (!issuer) {\n throw new AuthSdkError('No issuer passed to constructor. ' + \n 'Required usage: new OktaAuth({issuer: \"https://{yourOktaDomain}.com/oauth2/{authServerId}\"})');\n }\n\n var isUrlRegex = new RegExp('^http?s?://.+');\n if (!isUrlRegex.test(issuer)) {\n throw new AuthSdkError('Issuer must be a valid URL. ' + \n 'Required usage: new OktaAuth({issuer: \"https://{yourOktaDomain}.com/oauth2/{authServerId}\"})');\n }\n\n if (issuer.indexOf('-admin.') !== -1) {\n throw new AuthSdkError('Issuer URL passed to constructor contains \"-admin\" in subdomain. ' +\n 'Required usage: new OktaAuth({issuer: \"https://{yourOktaDomain}.com})');\n }\n}\n\nexport {\n assertValidConfig\n};\n"],"file":"builderUtil.js"}
package/cjs/clock.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
+
3
5
  exports.default = void 0;
4
6
 
7
+ var _parseInt2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/parse-int"));
8
+
5
9
  /*!
6
10
  * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
7
11
  * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
@@ -16,7 +20,7 @@ exports.default = void 0;
16
20
  class SdkClock {
17
21
  constructor(localOffset) {
18
22
  // Calculated local clock offset from server time (in milliseconds). Can be positive or negative.
19
- this.localOffset = parseInt(localOffset || 0);
23
+ this.localOffset = (0, _parseInt2.default)(localOffset || 0);
20
24
  } // factory method. Create an instance of a clock from current context.
21
25
 
22
26
 
package/cjs/clock.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../lib/clock.ts"],"names":["SdkClock","constructor","localOffset","parseInt","create","now","Date"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEe,MAAMA,QAAN,CAAe;AAG5BC,EAAAA,WAAW,CAACC,WAAD,EAAc;AACvB;AACA,SAAKA,WAAL,GAAmBC,QAAQ,CAACD,WAAW,IAAI,CAAhB,CAA3B;AACD,GAN2B,CAQ5B;;;AACa,SAANE,MAAM,GAA+B;AAC1C;AACA,QAAIF,WAAW,GAAG,CAAlB;AACA,WAAO,IAAIF,QAAJ,CAAaE,WAAb,CAAP;AACD,GAb2B,CAe5B;;;AACAG,EAAAA,GAAG,GAAG;AACJ,QAAIA,GAAG,GAAG,CAACC,IAAI,CAACD,GAAL,KAAa,KAAKH,WAAnB,IAAkC,IAA5C;AACA,WAAOG,GAAP;AACD;;AAnB2B","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\nexport default class SdkClock {\n localOffset: number;\n\n constructor(localOffset) {\n // Calculated local clock offset from server time (in milliseconds). Can be positive or negative.\n this.localOffset = parseInt(localOffset || 0);\n }\n\n // factory method. Create an instance of a clock from current context.\n static create(/* sdk, options */): SdkClock {\n // TODO: calculate localOffset\n var localOffset = 0;\n return new SdkClock(localOffset);\n }\n\n // Return the current time (in seconds)\n now() {\n var now = (Date.now() + this.localOffset) / 1000;\n return now;\n }\n}\n"],"file":"clock.js"}
1
+ {"version":3,"sources":["../../lib/clock.ts"],"names":["SdkClock","constructor","localOffset","create","now","Date"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEe,MAAMA,QAAN,CAAe;AAG5BC,EAAAA,WAAW,CAACC,WAAD,EAAc;AACvB;AACA,SAAKA,WAAL,GAAmB,wBAASA,WAAW,IAAI,CAAxB,CAAnB;AACD,GAN2B,CAQ5B;;;AACa,SAANC,MAAM,GAA+B;AAC1C;AACA,QAAID,WAAW,GAAG,CAAlB;AACA,WAAO,IAAIF,QAAJ,CAAaE,WAAb,CAAP;AACD,GAb2B,CAe5B;;;AACAE,EAAAA,GAAG,GAAG;AACJ,QAAIA,GAAG,GAAG,CAACC,IAAI,CAACD,GAAL,KAAa,KAAKF,WAAnB,IAAkC,IAA5C;AACA,WAAOE,GAAP;AACD;;AAnB2B","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\nexport default class SdkClock {\n localOffset: number;\n\n constructor(localOffset) {\n // Calculated local clock offset from server time (in milliseconds). Can be positive or negative.\n this.localOffset = parseInt(localOffset || 0);\n }\n\n // factory method. Create an instance of a clock from current context.\n static create(/* sdk, options */): SdkClock {\n // TODO: calculate localOffset\n var localOffset = 0;\n return new SdkClock(localOffset);\n }\n\n // Return the current time (in seconds)\n now() {\n var now = (Date.now() + this.localOffset) / 1000;\n return now;\n }\n}\n"],"file":"clock.js"}
@@ -1,11 +1,17 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
+
3
5
  exports.stringToBase64Url = stringToBase64Url;
4
6
  exports.base64ToBase64Url = base64ToBase64Url;
5
7
  exports.base64UrlToBase64 = base64UrlToBase64;
6
8
  exports.base64UrlToString = base64UrlToString;
7
9
  exports.stringToBuffer = stringToBuffer;
8
10
  exports.base64UrlDecode = base64UrlDecode;
11
+ exports.base64UrlToBuffer = base64UrlToBuffer;
12
+ exports.bufferToBase64Url = bufferToBase64Url;
13
+
14
+ var _reduce = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/reduce"));
9
15
 
10
16
  var _errors = require("../errors");
11
17
 
@@ -78,5 +84,17 @@ function stringToBuffer(str) {
78
84
 
79
85
  function base64UrlDecode(str) {
80
86
  return (0, _webcrypto.atob)(base64UrlToBase64(str));
87
+ } // Converts base64 string to binary data view
88
+
89
+
90
+ function base64UrlToBuffer(b64u) {
91
+ return Uint8Array.from(base64UrlDecode(b64u), c => c.charCodeAt(0));
92
+ } // Converts an ArrayBuffer object that contains binary data to base64 encoded string
93
+
94
+
95
+ function bufferToBase64Url(bin) {
96
+ var _context;
97
+
98
+ return (0, _webcrypto.btoa)((0, _reduce.default)(_context = new Uint8Array(bin)).call(_context, (s, byte) => s + String.fromCharCode(byte), ''));
81
99
  }
82
100
  //# sourceMappingURL=base64.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/crypto/base64.ts"],"names":["stringToBase64Url","str","b64","base64ToBase64Url","replace","base64UrlToBase64","b64u","base64UrlToString","length","AuthSdkError","utf8","decodeURIComponent","escape","e","stringToBuffer","buffer","Uint8Array","i","charCodeAt","base64UrlDecode"],"mappings":";;;;;;;;;AAYA;;AACA;;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACO,SAASA,iBAAT,CAA2BC,GAA3B,EAAgC;AACrC,MAAIC,GAAG,GAAG,qBAAKD,GAAL,CAAV;AACA,SAAOE,iBAAiB,CAACD,GAAD,CAAxB;AACD,C,CAED;;;AACO,SAASC,iBAAT,CAA2BD,GAA3B,EAAgC;AACrC,SAAOA,GAAG,CAACE,OAAJ,CAAY,KAAZ,EAAmB,GAAnB,EAAwBA,OAAxB,CAAgC,KAAhC,EAAuC,GAAvC,EAA4CA,OAA5C,CAAoD,KAApD,EAA2D,EAA3D,CAAP;AACD,C,CAED;;;AACO,SAASC,iBAAT,CAA2BC,IAA3B,EAAiC;AACtC,SAAOA,IAAI,CAACF,OAAL,CAAa,IAAb,EAAmB,GAAnB,EAAwBA,OAAxB,CAAgC,IAAhC,EAAsC,GAAtC,CAAP;AACD;;AAEM,SAASG,iBAAT,CAA2BD,IAA3B,EAAiC;AACtC,MAAIJ,GAAG,GAAGG,iBAAiB,CAACC,IAAD,CAA3B;;AACA,UAAQJ,GAAG,CAACM,MAAJ,GAAa,CAArB;AACE,SAAK,CAAL;AACE;;AACF,SAAK,CAAL;AACEN,MAAAA,GAAG,IAAI,IAAP;AACA;;AACF,SAAK,CAAL;AACEA,MAAAA,GAAG,IAAI,GAAP;AACA;;AACF;AACE,YAAM,IAAIO,oBAAJ,CAAiB,uBAAjB,CAAN;AAVJ;;AAYA,MAAIC,IAAI,GAAG,qBAAKR,GAAL,CAAX;;AACA,MAAI;AACF,WAAOS,kBAAkB,CAACC,MAAM,CAACF,IAAD,CAAP,CAAzB;AACD,GAFD,CAEE,OAAOG,CAAP,EAAU;AACV,WAAOH,IAAP;AACD;AACF;;AAEM,SAASI,cAAT,CAAwBb,GAAxB,EAA6B;AAClC,MAAIc,MAAM,GAAG,IAAIC,UAAJ,CAAef,GAAG,CAACO,MAAnB,CAAb;;AACA,OAAK,IAAIS,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGhB,GAAG,CAACO,MAAxB,EAAgCS,CAAC,EAAjC,EAAqC;AACnCF,IAAAA,MAAM,CAACE,CAAD,CAAN,GAAYhB,GAAG,CAACiB,UAAJ,CAAeD,CAAf,CAAZ;AACD;;AACD,SAAOF,MAAP;AACD;;AAEM,SAASI,eAAT,CAAyBlB,GAAzB,EAA8B;AACnC,SAAO,qBAAKI,iBAAiB,CAACJ,GAAD,CAAtB,CAAP;AACD","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 { AuthSdkError } from '../errors';\nimport { atob, btoa } from './webcrypto';\n\n// converts a string to base64 (url/filename safe variant)\nexport function stringToBase64Url(str) {\n var b64 = btoa(str);\n return base64ToBase64Url(b64);\n}\n\n// converts a standard base64-encoded string to a \"url/filename safe\" variant\nexport function base64ToBase64Url(b64) {\n return b64.replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=+$/, '');\n}\n\n// converts a \"url/filename safe\" base64 string to a \"standard\" base64 string\nexport function base64UrlToBase64(b64u) {\n return b64u.replace(/-/g, '+').replace(/_/g, '/');\n}\n\nexport function base64UrlToString(b64u) {\n var b64 = base64UrlToBase64(b64u);\n switch (b64.length % 4) {\n case 0:\n break;\n case 2:\n b64 += '==';\n break;\n case 3:\n b64 += '=';\n break;\n default:\n throw new AuthSdkError('Not a valid Base64Url');\n }\n var utf8 = atob(b64);\n try {\n return decodeURIComponent(escape(utf8));\n } catch (e) {\n return utf8;\n }\n}\n\nexport function stringToBuffer(str) {\n var buffer = new Uint8Array(str.length);\n for (var i = 0; i < str.length; i++) {\n buffer[i] = str.charCodeAt(i);\n }\n return buffer;\n}\n\nexport function base64UrlDecode(str) {\n return atob(base64UrlToBase64(str));\n}\n"],"file":"base64.js"}
1
+ {"version":3,"sources":["../../../lib/crypto/base64.ts"],"names":["stringToBase64Url","str","b64","base64ToBase64Url","replace","base64UrlToBase64","b64u","base64UrlToString","length","AuthSdkError","utf8","decodeURIComponent","escape","e","stringToBuffer","buffer","Uint8Array","i","charCodeAt","base64UrlDecode","base64UrlToBuffer","from","c","bufferToBase64Url","bin","s","byte","String","fromCharCode"],"mappings":";;;;;;;;;;;;;;;AAYA;;AACA;;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACO,SAASA,iBAAT,CAA2BC,GAA3B,EAAgC;AACrC,MAAIC,GAAG,GAAG,qBAAKD,GAAL,CAAV;AACA,SAAOE,iBAAiB,CAACD,GAAD,CAAxB;AACD,C,CAED;;;AACO,SAASC,iBAAT,CAA2BD,GAA3B,EAAgC;AACrC,SAAOA,GAAG,CAACE,OAAJ,CAAY,KAAZ,EAAmB,GAAnB,EAAwBA,OAAxB,CAAgC,KAAhC,EAAuC,GAAvC,EAA4CA,OAA5C,CAAoD,KAApD,EAA2D,EAA3D,CAAP;AACD,C,CAED;;;AACO,SAASC,iBAAT,CAA2BC,IAA3B,EAAiC;AACtC,SAAOA,IAAI,CAACF,OAAL,CAAa,IAAb,EAAmB,GAAnB,EAAwBA,OAAxB,CAAgC,IAAhC,EAAsC,GAAtC,CAAP;AACD;;AAEM,SAASG,iBAAT,CAA2BD,IAA3B,EAAiC;AACtC,MAAIJ,GAAG,GAAGG,iBAAiB,CAACC,IAAD,CAA3B;;AACA,UAAQJ,GAAG,CAACM,MAAJ,GAAa,CAArB;AACE,SAAK,CAAL;AACE;;AACF,SAAK,CAAL;AACEN,MAAAA,GAAG,IAAI,IAAP;AACA;;AACF,SAAK,CAAL;AACEA,MAAAA,GAAG,IAAI,GAAP;AACA;;AACF;AACE,YAAM,IAAIO,oBAAJ,CAAiB,uBAAjB,CAAN;AAVJ;;AAYA,MAAIC,IAAI,GAAG,qBAAKR,GAAL,CAAX;;AACA,MAAI;AACF,WAAOS,kBAAkB,CAACC,MAAM,CAACF,IAAD,CAAP,CAAzB;AACD,GAFD,CAEE,OAAOG,CAAP,EAAU;AACV,WAAOH,IAAP;AACD;AACF;;AAEM,SAASI,cAAT,CAAwBb,GAAxB,EAA6B;AAClC,MAAIc,MAAM,GAAG,IAAIC,UAAJ,CAAef,GAAG,CAACO,MAAnB,CAAb;;AACA,OAAK,IAAIS,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGhB,GAAG,CAACO,MAAxB,EAAgCS,CAAC,EAAjC,EAAqC;AACnCF,IAAAA,MAAM,CAACE,CAAD,CAAN,GAAYhB,GAAG,CAACiB,UAAJ,CAAeD,CAAf,CAAZ;AACD;;AACD,SAAOF,MAAP;AACD;;AAEM,SAASI,eAAT,CAAyBlB,GAAzB,EAA8B;AACnC,SAAO,qBAAKI,iBAAiB,CAACJ,GAAD,CAAtB,CAAP;AACD,C,CAED;;;AACO,SAASmB,iBAAT,CAA2Bd,IAA3B,EAAiC;AACtC,SAAOU,UAAU,CAACK,IAAX,CAAgBF,eAAe,CAACb,IAAD,CAA/B,EAAwCgB,CAAD,IAAeA,CAAC,CAACJ,UAAF,CAAa,CAAb,CAAtD,CAAP;AACD,C,CAED;;;AACO,SAASK,iBAAT,CAA2BC,GAA3B,EAAgC;AAAA;;AACrC,SAAO,qBAAK,oCAAIR,UAAJ,CAAeQ,GAAf,kBAA2B,CAACC,CAAD,EAAIC,IAAJ,KAAaD,CAAC,GAAGE,MAAM,CAACC,YAAP,CAAoBF,IAApB,CAA5C,EAAuE,EAAvE,CAAL,CAAP;AACD","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 { AuthSdkError } from '../errors';\nimport { atob, btoa } from './webcrypto';\n\n// converts a string to base64 (url/filename safe variant)\nexport function stringToBase64Url(str) {\n var b64 = btoa(str);\n return base64ToBase64Url(b64);\n}\n\n// converts a standard base64-encoded string to a \"url/filename safe\" variant\nexport function base64ToBase64Url(b64) {\n return b64.replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=+$/, '');\n}\n\n// converts a \"url/filename safe\" base64 string to a \"standard\" base64 string\nexport function base64UrlToBase64(b64u) {\n return b64u.replace(/-/g, '+').replace(/_/g, '/');\n}\n\nexport function base64UrlToString(b64u) {\n var b64 = base64UrlToBase64(b64u);\n switch (b64.length % 4) {\n case 0:\n break;\n case 2:\n b64 += '==';\n break;\n case 3:\n b64 += '=';\n break;\n default:\n throw new AuthSdkError('Not a valid Base64Url');\n }\n var utf8 = atob(b64);\n try {\n return decodeURIComponent(escape(utf8));\n } catch (e) {\n return utf8;\n }\n}\n\nexport function stringToBuffer(str) {\n var buffer = new Uint8Array(str.length);\n for (var i = 0; i < str.length; i++) {\n buffer[i] = str.charCodeAt(i);\n }\n return buffer;\n}\n\nexport function base64UrlDecode(str) {\n return atob(base64UrlToBase64(str));\n}\n\n// Converts base64 string to binary data view\nexport function base64UrlToBuffer(b64u) {\n return Uint8Array.from(base64UrlDecode(b64u), (c: string) => c.charCodeAt(0));\n}\n\n// Converts an ArrayBuffer object that contains binary data to base64 encoded string\nexport function bufferToBase64Url(bin) {\n return btoa(new Uint8Array(bin).reduce((s, byte) => s + String.fromCharCode(byte), ''));\n}\n\n\n"],"file":"base64.js"}
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
 
3
+ var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
4
+
3
5
  var _base = require("./base64");
4
6
 
5
- Object.keys(_base).forEach(function (key) {
7
+ _Object$keys(_base).forEach(function (key) {
6
8
  if (key === "default" || key === "__esModule") return;
7
9
  if (key in exports && exports[key] === _base[key]) return;
8
10
  Object.defineProperty(exports, key, {
@@ -15,7 +17,7 @@ Object.keys(_base).forEach(function (key) {
15
17
 
16
18
  var _oidcHash = require("./oidcHash");
17
19
 
18
- Object.keys(_oidcHash).forEach(function (key) {
20
+ _Object$keys(_oidcHash).forEach(function (key) {
19
21
  if (key === "default" || key === "__esModule") return;
20
22
  if (key in exports && exports[key] === _oidcHash[key]) return;
21
23
  Object.defineProperty(exports, key, {
@@ -28,7 +30,7 @@ Object.keys(_oidcHash).forEach(function (key) {
28
30
 
29
31
  var _verifyToken = require("./verifyToken");
30
32
 
31
- Object.keys(_verifyToken).forEach(function (key) {
33
+ _Object$keys(_verifyToken).forEach(function (key) {
32
34
  if (key === "default" || key === "__esModule") return;
33
35
  if (key in exports && exports[key] === _verifyToken[key]) return;
34
36
  Object.defineProperty(exports, key, {
@@ -41,7 +43,7 @@ Object.keys(_verifyToken).forEach(function (key) {
41
43
 
42
44
  var _webcrypto = require("./webcrypto");
43
45
 
44
- Object.keys(_webcrypto).forEach(function (key) {
46
+ _Object$keys(_webcrypto).forEach(function (key) {
45
47
  if (key === "default" || key === "__esModule") return;
46
48
  if (key in exports && exports[key] === _webcrypto[key]) return;
47
49
  Object.defineProperty(exports, key, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/crypto/index.ts"],"names":[],"mappings":";;AAaA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nexport * from './base64';\nexport * from './oidcHash';\nexport * from './verifyToken';\nexport * from './webcrypto';\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../lib/crypto/index.ts"],"names":[],"mappings":";;;;AAaA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nexport * from './base64';\nexport * from './oidcHash';\nexport * from './verifyToken';\nexport * from './webcrypto';\n"],"file":"index.js"}
@@ -1,7 +1,15 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
+
3
5
  exports.webcrypto = exports.btoa = exports.atob = void 0;
4
6
 
7
+ var _atob = _interopRequireDefault(require("atob"));
8
+
9
+ var _btoa = _interopRequireDefault(require("btoa"));
10
+
11
+ var _webcrypto = require("@peculiar/webcrypto");
12
+
5
13
  /*!
6
14
  * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
7
15
  * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
@@ -23,7 +31,7 @@ exports.atob = a;
23
31
  if (typeof atob !== 'undefined') {
24
32
  exports.atob = a = atob;
25
33
  } else {
26
- exports.atob = a = require('atob');
34
+ exports.atob = a = _atob.default;
27
35
  }
28
36
 
29
37
  let b;
@@ -32,15 +40,17 @@ exports.btoa = b;
32
40
  if (typeof btoa !== 'undefined') {
33
41
  exports.btoa = b = btoa;
34
42
  } else {
35
- exports.btoa = b = require('btoa');
43
+ exports.btoa = b = _btoa.default;
36
44
  }
37
45
 
38
- let crypto;
39
-
40
- try {
41
- crypto = require('crypto');
42
- } catch (err) {// this environment has no crypto module!
43
- }
46
+ const crypto = (async () => {
47
+ try {
48
+ return await import('crypto');
49
+ } catch (err) {
50
+ // this environment has no crypto module!
51
+ return undefined;
52
+ }
53
+ })();
44
54
 
45
55
  let webcrypto;
46
56
  exports.webcrypto = webcrypto;
@@ -48,10 +58,6 @@ exports.webcrypto = webcrypto;
48
58
  if (typeof crypto !== 'undefined' && crypto['webcrypto']) {
49
59
  exports.webcrypto = webcrypto = crypto['webcrypto'];
50
60
  } else {
51
- const {
52
- Crypto
53
- } = require('@peculiar/webcrypto');
54
-
55
- exports.webcrypto = webcrypto = new Crypto();
61
+ exports.webcrypto = webcrypto = new _webcrypto.Crypto();
56
62
  }
57
63
  //# sourceMappingURL=node.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/crypto/node.ts"],"names":["a","atob","require","b","btoa","crypto","err","webcrypto","Crypto"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AAEA;AACA;AAEA,IAAIA,CAAJ;;;AACA,IAAI,OAAOC,IAAP,KAAgB,WAApB,EAAiC;AAC/B,iBAAAD,CAAC,GAAGC,IAAJ;AACD,CAFD,MAEO;AACL,iBAAAD,CAAC,GAAGE,OAAO,CAAC,MAAD,CAAX;AACD;;AAID,IAAIC,CAAJ;;;AACA,IAAI,OAAOC,IAAP,KAAgB,WAApB,EAAiC;AAC/B,iBAAAD,CAAC,GAAGC,IAAJ;AACD,CAFD,MAEO;AACL,iBAAAD,CAAC,GAAGD,OAAO,CAAC,MAAD,CAAX;AACD;;AAGD,IAAIG,MAAJ;;AACA,IAAI;AACFA,EAAAA,MAAM,GAAGH,OAAO,CAAC,QAAD,CAAhB;AACD,CAFD,CAEE,OAAOI,GAAP,EAAY,CACZ;AACD;;AAED,IAAIC,SAAJ;;;AACA,IAAI,OAAOF,MAAP,KAAkB,WAAlB,IAAiCA,MAAM,CAAC,WAAD,CAA3C,EAA0D;AACxD,sBAAAE,SAAS,GAAGF,MAAM,CAAC,WAAD,CAAlB;AACD,CAFD,MAEO;AACL,QAAM;AAAEG,IAAAA;AAAF,MAAaN,OAAO,CAAC,qBAAD,CAA1B;;AACA,sBAAAK,SAAS,GAAG,IAAIC,MAAJ,EAAZ;AACD","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\n/* global atob, btoa */\n\n// Ponyfill for NodeJS\n// Webpack config excludes this file\n\nlet a;\nif (typeof atob !== 'undefined') {\n a = atob;\n} else {\n a = require('atob');\n}\nexport { a as atob };\n\n\nlet b;\nif (typeof btoa !== 'undefined') {\n b = btoa;\n} else {\n b = require('btoa');\n}\nexport { b as btoa };\n\nlet crypto;\ntry {\n crypto = require('crypto');\n} catch (err) {\n // this environment has no crypto module!\n}\n\nlet webcrypto;\nif (typeof crypto !== 'undefined' && crypto['webcrypto']) {\n webcrypto = crypto['webcrypto'];\n} else {\n const { Crypto } = require('@peculiar/webcrypto');\n webcrypto = new Crypto();\n}\n\nexport { webcrypto };\n"],"file":"node.js"}
1
+ {"version":3,"sources":["../../../lib/crypto/node.ts"],"names":["a","atob","atobModule","b","btoa","btoaModule","crypto","err","undefined","webcrypto","Crypto"],"mappings":";;;;;;AAkBA;;AACA;;AACA;;AApBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AAEA;AACA;AAMA,IAAIA,CAAJ;;;AACA,IAAI,OAAOC,IAAP,KAAgB,WAApB,EAAiC;AAC/B,iBAAAD,CAAC,GAAGC,IAAJ;AACD,CAFD,MAEO;AACL,iBAAAD,CAAC,GAAGE,aAAJ;AACD;;AAID,IAAIC,CAAJ;;;AACA,IAAI,OAAOC,IAAP,KAAgB,WAApB,EAAiC;AAC/B,iBAAAD,CAAC,GAAGC,IAAJ;AACD,CAFD,MAEO;AACL,iBAAAD,CAAC,GAAGE,aAAJ;AACD;;AAGD,MAAMC,MAAM,GAAG,CAAC,YAAY;AAC1B,MAAI;AACF,WAAO,MAAM,OAAO,QAAP,CAAb;AACD,GAFD,CAEE,OAAOC,GAAP,EAAY;AACZ;AACA,WAAOC,SAAP;AACD;AACF,CAPc,GAAf;;AASA,IAAIC,SAAJ;;;AACA,IAAI,OAAOH,MAAP,KAAkB,WAAlB,IAAiCA,MAAM,CAAC,WAAD,CAA3C,EAA0D;AACxD,sBAAAG,SAAS,GAAGH,MAAM,CAAC,WAAD,CAAlB;AACD,CAFD,MAEO;AACL,sBAAAG,SAAS,GAAG,IAAIC,iBAAJ,EAAZ;AACD","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\n/* global atob, btoa */\n\n// Ponyfill for NodeJS\n// Webpack config excludes this file\n\nimport atobModule from 'atob';\nimport btoaModule from 'btoa';\nimport { Crypto } from '@peculiar/webcrypto';\n\nlet a;\nif (typeof atob !== 'undefined') {\n a = atob;\n} else {\n a = atobModule;\n}\nexport { a as atob };\n\n\nlet b;\nif (typeof btoa !== 'undefined') {\n b = btoa;\n} else {\n b = btoaModule;\n}\nexport { b as btoa };\n\nconst crypto = (async () => {\n try {\n return await import('crypto');\n } catch (err) {\n // this environment has no crypto module!\n return undefined;\n }\n})();\n\nlet webcrypto;\nif (typeof crypto !== 'undefined' && crypto['webcrypto']) {\n webcrypto = crypto['webcrypto'];\n} else {\n webcrypto = new Crypto();\n}\n\nexport { webcrypto };\n"],"file":"node.js"}
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
+
3
5
  exports.getOidcHash = getOidcHash;
4
6
 
7
+ var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
8
+
5
9
  var _base = require("./base64");
6
10
 
7
11
  var _webcrypto = require("./webcrypto");
@@ -23,7 +27,7 @@ function getOidcHash(str) {
23
27
  var buffer = new TextEncoder().encode(str);
24
28
  return _webcrypto.webcrypto.subtle.digest('SHA-256', buffer).then(function (arrayBuffer) {
25
29
  var intBuffer = new Uint8Array(arrayBuffer);
26
- var firstHalf = intBuffer.slice(0, 16);
30
+ var firstHalf = (0, _slice.default)(intBuffer).call(intBuffer, 0, 16);
27
31
  var hash = String.fromCharCode.apply(null, firstHalf);
28
32
  var b64u = (0, _base.stringToBase64Url)(hash); // url-safe base64 variant
29
33
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/crypto/oidcHash.ts"],"names":["getOidcHash","str","buffer","TextEncoder","encode","webcrypto","subtle","digest","then","arrayBuffer","intBuffer","Uint8Array","firstHalf","slice","hash","String","fromCharCode","apply","b64u"],"mappings":";;;;AAaA;;AACA;;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AAIO,SAASA,WAAT,CAAqBC,GAArB,EAA0B;AAC/B,MAAIC,MAAM,GAAG,IAAIC,WAAJ,GAAkBC,MAAlB,CAAyBH,GAAzB,CAAb;AACA,SAAOI,qBAAUC,MAAV,CAAiBC,MAAjB,CAAwB,SAAxB,EAAmCL,MAAnC,EAA2CM,IAA3C,CAAgD,UAASC,WAAT,EAAsB;AAC3E,QAAIC,SAAS,GAAG,IAAIC,UAAJ,CAAeF,WAAf,CAAhB;AACA,QAAIG,SAAS,GAAGF,SAAS,CAACG,KAAV,CAAgB,CAAhB,EAAmB,EAAnB,CAAhB;AACA,QAAIC,IAAI,GAAGC,MAAM,CAACC,YAAP,CAAoBC,KAApB,CAA0B,IAA1B,EAAgCL,SAAhC,CAAX;AACA,QAAIM,IAAI,GAAG,6BAAkBJ,IAAlB,CAAX,CAJ2E,CAIvC;;AACpC,WAAOI,IAAP;AACD,GANM,CAAP;AAOD","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n/* global TextEncoder */\nimport { stringToBase64Url } from './base64';\nimport { webcrypto } from './webcrypto';\n\nexport function getOidcHash(str) { \n var buffer = new TextEncoder().encode(str);\n return webcrypto.subtle.digest('SHA-256', buffer).then(function(arrayBuffer) {\n var intBuffer = new Uint8Array(arrayBuffer);\n var firstHalf = intBuffer.slice(0, 16);\n var hash = String.fromCharCode.apply(null, firstHalf as unknown as number[]);\n var b64u = stringToBase64Url(hash); // url-safe base64 variant\n return b64u;\n });\n}\n"],"file":"oidcHash.js"}
1
+ {"version":3,"sources":["../../../lib/crypto/oidcHash.ts"],"names":["getOidcHash","str","buffer","TextEncoder","encode","webcrypto","subtle","digest","then","arrayBuffer","intBuffer","Uint8Array","firstHalf","hash","String","fromCharCode","apply","b64u"],"mappings":";;;;;;;;AAaA;;AACA;;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AAIO,SAASA,WAAT,CAAqBC,GAArB,EAA0B;AAC/B,MAAIC,MAAM,GAAG,IAAIC,WAAJ,GAAkBC,MAAlB,CAAyBH,GAAzB,CAAb;AACA,SAAOI,qBAAUC,MAAV,CAAiBC,MAAjB,CAAwB,SAAxB,EAAmCL,MAAnC,EAA2CM,IAA3C,CAAgD,UAASC,WAAT,EAAsB;AAC3E,QAAIC,SAAS,GAAG,IAAIC,UAAJ,CAAeF,WAAf,CAAhB;AACA,QAAIG,SAAS,GAAG,oBAAAF,SAAS,MAAT,CAAAA,SAAS,EAAO,CAAP,EAAU,EAAV,CAAzB;AACA,QAAIG,IAAI,GAAGC,MAAM,CAACC,YAAP,CAAoBC,KAApB,CAA0B,IAA1B,EAAgCJ,SAAhC,CAAX;AACA,QAAIK,IAAI,GAAG,6BAAkBJ,IAAlB,CAAX,CAJ2E,CAIvC;;AACpC,WAAOI,IAAP;AACD,GANM,CAAP;AAOD","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n/* global TextEncoder */\nimport { stringToBase64Url } from './base64';\nimport { webcrypto } from './webcrypto';\n\nexport function getOidcHash(str) { \n var buffer = new TextEncoder().encode(str);\n return webcrypto.subtle.digest('SHA-256', buffer).then(function(arrayBuffer) {\n var intBuffer = new Uint8Array(arrayBuffer);\n var firstHalf = intBuffer.slice(0, 16);\n var hash = String.fromCharCode.apply(null, firstHalf as unknown as number[]);\n var b64u = stringToBase64Url(hash); // url-safe base64 variant\n return b64u;\n });\n}\n"],"file":"oidcHash.js"}
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+
3
+ exports.getAssertion = exports.getAttestation = exports.buildCredentialRequestOptions = exports.buildCredentialCreationOptions = void 0;
4
+
5
+ var _base = require("./base64");
6
+
7
+ /*!
8
+ * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
9
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
10
+ *
11
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ *
16
+ * See the License for the specific language governing permissions and limitations under the License.
17
+ */
18
+ // Get known credentials from list of enrolled authenticators
19
+ const getEnrolledCredentials = (authenticatorEnrollments = []) => {
20
+ const credentials = [];
21
+ authenticatorEnrollments.forEach(enrollement => {
22
+ if (enrollement.key === 'webauthn') {
23
+ credentials.push({
24
+ type: 'public-key',
25
+ id: (0, _base.base64UrlToBuffer)(enrollement.credentialId)
26
+ });
27
+ }
28
+ });
29
+ return credentials;
30
+ }; // Build options for navigator.credentials.create
31
+ // https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer/create
32
+
33
+
34
+ const buildCredentialCreationOptions = (activationData, authenticatorEnrollments) => {
35
+ return {
36
+ publicKey: {
37
+ rp: activationData.rp,
38
+ user: {
39
+ id: (0, _base.base64UrlToBuffer)(activationData.user.id),
40
+ name: activationData.user.name,
41
+ displayName: activationData.user.displayName
42
+ },
43
+ challenge: (0, _base.base64UrlToBuffer)(activationData.challenge),
44
+ pubKeyCredParams: activationData.pubKeyCredParams,
45
+ attestation: activationData.attestation,
46
+ authenticatorSelection: activationData.authenticatorSelection,
47
+ excludeCredentials: getEnrolledCredentials(authenticatorEnrollments)
48
+ }
49
+ };
50
+ }; // Build options for navigator.credentials.get
51
+ // https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer/get
52
+
53
+
54
+ exports.buildCredentialCreationOptions = buildCredentialCreationOptions;
55
+
56
+ const buildCredentialRequestOptions = (challengeData, authenticatorEnrollments) => {
57
+ return {
58
+ publicKey: {
59
+ challenge: (0, _base.base64UrlToBuffer)(challengeData.challenge),
60
+ userVerification: challengeData.userVerification,
61
+ allowCredentials: getEnrolledCredentials(authenticatorEnrollments)
62
+ }
63
+ };
64
+ }; // Build attestation for webauthn enroll
65
+ // https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorAttestationResponse
66
+
67
+
68
+ exports.buildCredentialRequestOptions = buildCredentialRequestOptions;
69
+
70
+ const getAttestation = credential => {
71
+ const response = credential.response;
72
+ const id = credential.id;
73
+ const clientData = (0, _base.bufferToBase64Url)(response.clientDataJSON);
74
+ const attestation = (0, _base.bufferToBase64Url)(response.attestationObject);
75
+ return {
76
+ id,
77
+ clientData,
78
+ attestation
79
+ };
80
+ }; // Build assertion for webauthn verification
81
+ // https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorAssertionResponse
82
+
83
+
84
+ exports.getAttestation = getAttestation;
85
+
86
+ const getAssertion = credential => {
87
+ const response = credential.response;
88
+ const id = credential.id;
89
+ const clientData = (0, _base.bufferToBase64Url)(response.clientDataJSON);
90
+ const authenticatorData = (0, _base.bufferToBase64Url)(response.authenticatorData);
91
+ const signatureData = (0, _base.bufferToBase64Url)(response.signature);
92
+ return {
93
+ id,
94
+ clientData,
95
+ authenticatorData,
96
+ signatureData
97
+ };
98
+ };
99
+
100
+ exports.getAssertion = getAssertion;
101
+ //# sourceMappingURL=webauthn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../lib/crypto/webauthn.ts"],"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"],"mappings":";;;;AAYA;;AAZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA,MAAMA,sBAAsB,GAAG,CAACC,wBAA4C,GAAG,EAAhD,KAAuD;AACpF,QAAMC,WAA4C,GAAG,EAArD;AACAD,EAAAA,wBAAwB,CAACE,OAAzB,CAAkCC,WAAD,IAAiB;AAChD,QAAIA,WAAW,CAACC,GAAZ,KAAoB,UAAxB,EAAoC;AAClCH,MAAAA,WAAW,CAACI,IAAZ,CAAiB;AACfC,QAAAA,IAAI,EAAE,YADS;AAEfC,QAAAA,EAAE,EAAE,6BAAkBJ,WAAW,CAACK,YAA9B;AAFW,OAAjB;AAID;AACF,GAPD;AAQA,SAAOP,WAAP;AACD,CAXD,C,CAaA;AACA;;;AACO,MAAMQ,8BAA8B,GAAG,CAC5CC,cAD4C,EACZV,wBADY,KAEzC;AACH,SAAO;AACLW,IAAAA,SAAS,EAAE;AACTC,MAAAA,EAAE,EAAEF,cAAc,CAACE,EADV;AAETC,MAAAA,IAAI,EAAE;AACJN,QAAAA,EAAE,EAAE,6BAAkBG,cAAc,CAACG,IAAf,CAAoBN,EAAtC,CADA;AAEJO,QAAAA,IAAI,EAAEJ,cAAc,CAACG,IAAf,CAAoBC,IAFtB;AAGJC,QAAAA,WAAW,EAAEL,cAAc,CAACG,IAAf,CAAoBE;AAH7B,OAFG;AAOTC,MAAAA,SAAS,EAAE,6BAAkBN,cAAc,CAACM,SAAjC,CAPF;AAQTC,MAAAA,gBAAgB,EAAEP,cAAc,CAACO,gBARxB;AASTC,MAAAA,WAAW,EAAER,cAAc,CAACQ,WATnB;AAUTC,MAAAA,sBAAsB,EAAET,cAAc,CAACS,sBAV9B;AAWTC,MAAAA,kBAAkB,EAAErB,sBAAsB,CAACC,wBAAD;AAXjC;AADN,GAAP;AAeD,CAlBM,C,CAqBP;AACA;;;;;AACO,MAAMqB,6BAA6B,GAAG,CAC3CC,aAD2C,EACbtB,wBADa,KAExC;AACH,SAAO;AACLW,IAAAA,SAAS,EAAE;AACTK,MAAAA,SAAS,EAAE,6BAAkBM,aAAa,CAACN,SAAhC,CADF;AAETO,MAAAA,gBAAgB,EAAED,aAAa,CAACC,gBAFvB;AAGTC,MAAAA,gBAAgB,EAAEzB,sBAAsB,CAACC,wBAAD;AAH/B;AADN,GAAP;AAOD,CAVM,C,CAYP;AACA;;;;;AACO,MAAMyB,cAAc,GAAIC,UAAD,IAAqC;AACjE,QAAMC,QAAQ,GAAGD,UAAU,CAACC,QAA5B;AACA,QAAMpB,EAAE,GAAGmB,UAAU,CAACnB,EAAtB;AACA,QAAMqB,UAAU,GAAG,6BAAkBD,QAAQ,CAACE,cAA3B,CAAnB;AACA,QAAMX,WAAW,GAAG,6BAAkBS,QAAQ,CAACG,iBAA3B,CAApB;AACA,SAAO;AACLvB,IAAAA,EADK;AAELqB,IAAAA,UAFK;AAGLV,IAAAA;AAHK,GAAP;AAKD,CAVM,C,CAYP;AACA;;;;;AACO,MAAMa,YAAY,GAAIL,UAAD,IAAqC;AAC/D,QAAMC,QAAQ,GAAGD,UAAU,CAACC,QAA5B;AACA,QAAMpB,EAAE,GAAGmB,UAAU,CAACnB,EAAtB;AACA,QAAMqB,UAAU,GAAG,6BAAkBD,QAAQ,CAACE,cAA3B,CAAnB;AACA,QAAMG,iBAAiB,GAAG,6BAAkBL,QAAQ,CAACK,iBAA3B,CAA1B;AACA,QAAMC,aAAa,GAAG,6BAAkBN,QAAQ,CAACO,SAA3B,CAAtB;AACA,SAAO;AACL3B,IAAAA,EADK;AAELqB,IAAAA,UAFK;AAGLI,IAAAA,iBAHK;AAILC,IAAAA;AAJK,GAAP;AAMD,CAZM","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"],"file":"webauthn.js"}
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
 
3
+ var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
4
+
3
5
  var _node = require("./node");
4
6
 
5
- Object.keys(_node).forEach(function (key) {
7
+ _Object$keys(_node).forEach(function (key) {
6
8
  if (key === "default" || key === "__esModule") return;
7
9
  if (key in exports && exports[key] === _node[key]) return;
8
10
  Object.defineProperty(exports, key, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/crypto/webcrypto.ts"],"names":[],"mappings":";;AAcA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\n// ./node is swapped for ./browser in webpack config\nexport * from './node';"],"file":"webcrypto.js"}
1
+ {"version":3,"sources":["../../../lib/crypto/webcrypto.ts"],"names":[],"mappings":";;;;AAcA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\n// ./node is swapped for ./browser in webpack config\nexport * from './node';"],"file":"webcrypto.js"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
4
 
5
5
  exports.default = void 0;
6
6
 
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
4
 
5
5
  exports.default = void 0;
6
6
 
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
4
 
5
5
  exports.default = void 0;
6
6
 
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
+
3
5
  exports.default = void 0;
4
6
 
7
+ var _setPrototypeOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/set-prototype-of"));
8
+
5
9
  /*!
6
10
  * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
7
11
  * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
@@ -18,7 +22,7 @@ class CustomError extends Error {
18
22
  // https://stackoverflow.com/questions/41102060/typescript-extending-error-class
19
23
  super(message); // 'Error' breaks prototype chain here
20
24
 
21
- Object.setPrototypeOf(this, new.target.prototype); // restore prototype chain
25
+ (0, _setPrototypeOf.default)(this, new.target.prototype); // restore prototype chain
22
26
  }
23
27
 
24
28
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/errors/CustomError.ts"],"names":["CustomError","Error","constructor","message","Object","setPrototypeOf","new","target","prototype"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEe,MAAMA,WAAN,SAA0BC,KAA1B,CAAgC;AAC7CC,EAAAA,WAAW,CAACC,OAAD,EAAkB;AAC3B;AACA,UAAMA,OAAN,EAF2B,CAEX;;AAChBC,IAAAA,MAAM,CAACC,cAAP,CAAsB,IAAtB,EAA4BC,GAAG,CAACC,MAAJ,CAAWC,SAAvC,EAH2B,CAGwB;AACpD;;AAL4C","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\nexport default class CustomError extends Error {\n constructor(message: string) {\n // https://stackoverflow.com/questions/41102060/typescript-extending-error-class\n super(message); // 'Error' breaks prototype chain here\n Object.setPrototypeOf(this, new.target.prototype); // restore prototype chain\n }\n}\n"],"file":"CustomError.js"}
1
+ {"version":3,"sources":["../../../lib/errors/CustomError.ts"],"names":["CustomError","Error","constructor","message","new","target","prototype"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEe,MAAMA,WAAN,SAA0BC,KAA1B,CAAgC;AAC7CC,EAAAA,WAAW,CAACC,OAAD,EAAkB;AAC3B;AACA,UAAMA,OAAN,EAF2B,CAEX;;AAChB,iCAAsB,IAAtB,EAA4BC,GAAG,CAACC,MAAJ,CAAWC,SAAvC,EAH2B,CAGwB;AACpD;;AAL4C","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\nexport default class CustomError extends Error {\n constructor(message: string) {\n // https://stackoverflow.com/questions/41102060/typescript-extending-error-class\n super(message); // 'Error' breaks prototype chain here\n Object.setPrototypeOf(this, new.target.prototype); // restore prototype chain\n }\n}\n"],"file":"CustomError.js"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
4
 
5
5
  exports.default = void 0;
6
6
 
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
4
 
5
5
  exports.isAuthApiError = isAuthApiError;
6
6
  Object.defineProperty(exports, "AuthApiError", {
@@ -1,9 +1,17 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
4
 
5
5
  exports.default = void 0;
6
6
 
7
+ var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
8
+
9
+ var _entries = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/entries"));
10
+
11
+ var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/json/stringify"));
12
+
13
+ var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
14
+
7
15
  var _crossFetch = _interopRequireDefault(require("cross-fetch"));
8
16
 
9
17
  /*!
@@ -18,8 +26,10 @@ var _crossFetch = _interopRequireDefault(require("cross-fetch"));
18
26
  * See the License for the specific language governing permissions and limitations under the License.
19
27
  */
20
28
  function readData(response) {
29
+ var _context;
30
+
21
31
  if (response.headers.get('Content-Type') && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
22
- response.headers.get('Content-Type').toLowerCase().indexOf('application/json') >= 0) {
32
+ (0, _indexOf.default)(_context = response.headers.get('Content-Type').toLowerCase()).call(_context, 'application/json') >= 0) {
23
33
  return response.json() // JSON parse can fail if response is not a valid object
24
34
  .catch(e => {
25
35
  return {
@@ -36,12 +46,14 @@ function formatResult(status, data, response) {
36
46
  const isObject = typeof data === 'object';
37
47
  const headers = {};
38
48
 
39
- for (const pair of response.headers.entries()) {
49
+ for (const pair of (0, _entries.default)(_context2 = response.headers).call(_context2)) {
50
+ var _context2;
51
+
40
52
  headers[pair[0]] = pair[1];
41
53
  }
42
54
 
43
55
  const result = {
44
- responseText: isObject ? JSON.stringify(data) : data,
56
+ responseText: isObject ? (0, _stringify.default)(data) : data,
45
57
  status: status,
46
58
  headers
47
59
  };
@@ -62,7 +74,7 @@ function fetchRequest(method, url, args) {
62
74
  var contentType = headers['Content-Type'] || headers['content-type'] || ''; // JSON encode body (if appropriate)
63
75
 
64
76
  if (contentType === 'application/json' && body && typeof body !== 'string') {
65
- body = JSON.stringify(body);
77
+ body = (0, _stringify.default)(body);
66
78
  }
67
79
 
68
80
  var fetch = global.fetch || _crossFetch.default;
@@ -74,7 +86,7 @@ function fetchRequest(method, url, args) {
74
86
  });
75
87
 
76
88
  if (!fetchPromise.finally) {
77
- fetchPromise = Promise.resolve(fetchPromise);
89
+ fetchPromise = _promise.default.resolve(fetchPromise);
78
90
  }
79
91
 
80
92
  return fetchPromise.then(function (response) {