@okta/okta-auth-js 6.5.0 → 6.5.3

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.
package/esm/esm.node.mjs CHANGED
@@ -6035,19 +6035,22 @@ var WebauthnEnrollment = function (_Authenticator) {
6035
6035
  _createClass(WebauthnEnrollment, [{
6036
6036
  key: "canVerify",
6037
6037
  value: function canVerify(values) {
6038
- var clientData = values.clientData,
6039
- attestation = values.attestation;
6038
+ var credentials = values.credentials;
6039
+ var obj = credentials || values;
6040
+ var clientData = obj.clientData,
6041
+ attestation = obj.attestation;
6040
6042
  return !!(clientData && attestation);
6041
6043
  }
6042
6044
  }, {
6043
6045
  key: "mapCredentials",
6044
6046
  value: function mapCredentials(values) {
6045
- var clientData = values.clientData,
6047
+ var credentials = values.credentials,
6048
+ clientData = values.clientData,
6046
6049
  attestation = values.attestation;
6047
- if (!clientData && !attestation) {
6050
+ if (!credentials && !clientData && !attestation) {
6048
6051
  return;
6049
6052
  }
6050
- return {
6053
+ return credentials || {
6051
6054
  clientData: clientData,
6052
6055
  attestation: attestation
6053
6056
  };
@@ -6085,21 +6088,24 @@ var WebauthnVerification = function (_Authenticator) {
6085
6088
  _createClass(WebauthnVerification, [{
6086
6089
  key: "canVerify",
6087
6090
  value: function canVerify(values) {
6088
- var clientData = values.clientData,
6089
- authenticatorData = values.authenticatorData,
6090
- signatureData = values.signatureData;
6091
+ var credentials = values.credentials;
6092
+ var obj = credentials || values;
6093
+ var clientData = obj.clientData,
6094
+ authenticatorData = obj.authenticatorData,
6095
+ signatureData = obj.signatureData;
6091
6096
  return !!(clientData && authenticatorData && signatureData);
6092
6097
  }
6093
6098
  }, {
6094
6099
  key: "mapCredentials",
6095
6100
  value: function mapCredentials(values) {
6096
- var authenticatorData = values.authenticatorData,
6101
+ var credentials = values.credentials,
6102
+ authenticatorData = values.authenticatorData,
6097
6103
  clientData = values.clientData,
6098
6104
  signatureData = values.signatureData;
6099
- if (!authenticatorData && !clientData && !signatureData) {
6105
+ if (!credentials && !authenticatorData && !clientData && !signatureData) {
6100
6106
  return;
6101
6107
  }
6102
- return {
6108
+ return credentials || {
6103
6109
  authenticatorData: authenticatorData,
6104
6110
  clientData: clientData,
6105
6111
  signatureData: signatureData
@@ -7197,19 +7203,53 @@ function hasValidInputValue(input, values) {
7197
7203
  var fn = function fn(input, values, requiredTracker) {
7198
7204
  var name = input.name,
7199
7205
  value = input.value,
7206
+ type = input.type,
7207
+ options = input.options,
7200
7208
  required = input.required;
7201
- var isRequired = required || requiredTracker
7202
- || name === 'authenticator';
7203
- if (!isRequired) {
7204
- return true;
7205
- }
7209
+ var isRequired = required || requiredTracker;
7206
7210
  if (Array.isArray(value)) {
7207
7211
  return _reduceInstanceProperty(value).call(value, function (acc, item) {
7208
7212
  return acc && fn(item, values[name], isRequired);
7209
7213
  }, true);
7210
- } else {
7211
- return !!(values && values[name]);
7212
7214
  }
7215
+ if (options) {
7216
+ if (type === 'object') {
7217
+ var _context4, _context5;
7218
+ var selectedOption = values[name];
7219
+ if (!(selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.id)) {
7220
+ return false;
7221
+ }
7222
+ var optionSchema = _findInstanceProperty(options).call(options, function (option) {
7223
+ var _context3;
7224
+ var idSchema = _findInstanceProperty(_context3 = option.value).call(_context3, function (_ref3) {
7225
+ var name = _ref3.name;
7226
+ return name === 'id';
7227
+ });
7228
+ return idSchema.value === selectedOption.id;
7229
+ });
7230
+ if (!optionSchema) {
7231
+ return false;
7232
+ }
7233
+ return _reduceInstanceProperty(_context4 = _filterInstanceProperty(_context5 = optionSchema.value).call(_context5, function (_ref4) {
7234
+ var required = _ref4.required;
7235
+ return !!required;
7236
+ })).call(_context4, function (acc, _ref5) {
7237
+ var name = _ref5.name;
7238
+ return acc && !!selectedOption[name];
7239
+ }, true);
7240
+ }
7241
+ if (required === false) {
7242
+ return true;
7243
+ }
7244
+ if (required === true) {
7245
+ return !!values[name];
7246
+ }
7247
+ throw new AuthSdkError("Unknown options type, ".concat(_JSON$stringify(input)));
7248
+ }
7249
+ if (!isRequired) {
7250
+ return true;
7251
+ }
7252
+ return !!(values && values[name]);
7213
7253
  };
7214
7254
  return fn(input, values, false);
7215
7255
  }
@@ -7611,30 +7651,31 @@ function getRemediator(idxRemediations, values, options) {
7611
7651
  }
7612
7652
  }
7613
7653
  var remediatorCandidates = [];
7614
- var _iterator3 = _createForOfIteratorHelper$1(idxRemediations),
7615
- _step3;
7616
- try {
7617
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
7618
- var _context12;
7619
- var _remediation = _step3.value;
7620
- var isRemeditionInFlow = _includesInstanceProperty(_context12 = _Object$keys(remediators)).call(_context12, _remediation.name);
7621
- if (!isRemeditionInFlow) {
7622
- continue;
7623
- }
7624
- var _T = getRemediatorClass(_remediation, options);
7625
- remediator = new _T(_remediation, values, options);
7626
- if (remediator.canRemediate()) {
7627
- return remediator;
7654
+ if (useGenericRemediator) {
7655
+ remediatorCandidates.push(new GenericRemediator(idxRemediations[0], values, options));
7656
+ } else {
7657
+ var _iterator3 = _createForOfIteratorHelper$1(idxRemediations),
7658
+ _step3;
7659
+ try {
7660
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
7661
+ var _context12;
7662
+ var _remediation = _step3.value;
7663
+ var isRemeditionInFlow = _includesInstanceProperty(_context12 = _Object$keys(remediators)).call(_context12, _remediation.name);
7664
+ if (!isRemeditionInFlow) {
7665
+ continue;
7666
+ }
7667
+ var _T = getRemediatorClass(_remediation, options);
7668
+ remediator = new _T(_remediation, values, options);
7669
+ if (remediator.canRemediate()) {
7670
+ return remediator;
7671
+ }
7672
+ remediatorCandidates.push(remediator);
7628
7673
  }
7629
- remediatorCandidates.push(remediator);
7674
+ } catch (err) {
7675
+ _iterator3.e(err);
7676
+ } finally {
7677
+ _iterator3.f();
7630
7678
  }
7631
- } catch (err) {
7632
- _iterator3.e(err);
7633
- } finally {
7634
- _iterator3.f();
7635
- }
7636
- if (!remediatorCandidates.length && !!idxRemediations.length && useGenericRemediator) {
7637
- return new GenericRemediator(idxRemediations[0], values, options);
7638
7679
  }
7639
7680
  return remediatorCandidates[0];
7640
7681
  }
@@ -7707,7 +7748,7 @@ function remediate(_x, _x2, _x3, _x4) {
7707
7748
  function _remediate() {
7708
7749
  _remediate = _asyncToGenerator( _regeneratorRuntime.mark(function _callee(authClient, idxResponse, values, options) {
7709
7750
  var _context2;
7710
- var _idxResponse, neededToProceed, interactionCode, _options, flow, remediator, actionFromValues, actionFromOptions, actions, _iterator, _step, _loop, _ret, terminal, messages, nextStep, name, data;
7751
+ var _idxResponse, neededToProceed, interactionCode, _options, flow, remediator, actionFromValues, actionFromOptions, actions, _iterator, _step, _loop, _ret, terminal, messages, nextStep, name, data, gr, _nextStep;
7711
7752
  return _regeneratorRuntime.wrap(function _callee$(_context4) {
7712
7753
  while (1) {
7713
7754
  switch (_context4.prev = _context4.next) {
@@ -7920,17 +7961,29 @@ function _remediate() {
7920
7961
  options = _Object$assign(_Object$assign({}, options), {
7921
7962
  step: undefined
7922
7963
  });
7964
+ if (!(options.useGenericRemediator && !idxResponse.interactionCode)) {
7965
+ _context4.next = 65;
7966
+ break;
7967
+ }
7968
+ gr = getRemediator(idxResponse.neededToProceed, values, options);
7969
+ _nextStep = getNextStep(authClient, gr, idxResponse);
7970
+ return _context4.abrupt("return", {
7971
+ idxResponse: idxResponse,
7972
+ nextStep: _nextStep,
7973
+ messages: messages.length ? messages : undefined
7974
+ });
7975
+ case 65:
7923
7976
  return _context4.abrupt("return", remediate(authClient, idxResponse, values, options));
7924
- case 64:
7925
- _context4.prev = 64;
7977
+ case 68:
7978
+ _context4.prev = 68;
7926
7979
  _context4.t3 = _context4["catch"](54);
7927
7980
  return _context4.abrupt("return", handleIdxError(authClient, _context4.t3, remediator));
7928
- case 67:
7981
+ case 71:
7929
7982
  case "end":
7930
7983
  return _context4.stop();
7931
7984
  }
7932
7985
  }
7933
- }, _callee, null, [[10, 22, 25, 28], [35, 43], [54, 64]]);
7986
+ }, _callee, null, [[10, 22, 25, 28], [35, 43], [54, 68]]);
7934
7987
  }));
7935
7988
  return _remediate.apply(this, arguments);
7936
7989
  }
@@ -8360,6 +8413,7 @@ function _run() {
8360
8413
  proceed,
8361
8414
  rawIdxState,
8362
8415
  requestDidSucceed,
8416
+ stepUp,
8363
8417
  _args5 = arguments;
8364
8418
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
8365
8419
  while (1) {
@@ -8408,8 +8462,8 @@ function _run() {
8408
8462
  });
8409
8463
  }
8410
8464
  }
8411
- _ref = idxResponse || {}, actions = _ref.actions, context = _ref.context, neededToProceed = _ref.neededToProceed, proceed = _ref.proceed, rawIdxState = _ref.rawIdxState, requestDidSucceed = _ref.requestDidSucceed;
8412
- return _context5.abrupt("return", _Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign({
8465
+ _ref = idxResponse || {}, actions = _ref.actions, context = _ref.context, neededToProceed = _ref.neededToProceed, proceed = _ref.proceed, rawIdxState = _ref.rawIdxState, requestDidSucceed = _ref.requestDidSucceed, stepUp = _ref.stepUp;
8466
+ return _context5.abrupt("return", _Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign({
8413
8467
  status: status
8414
8468
  }, meta && {
8415
8469
  meta: meta
@@ -8425,6 +8479,8 @@ function _run() {
8425
8479
  messages: messages
8426
8480
  }), error && {
8427
8481
  error: error
8482
+ }), stepUp && {
8483
+ stepUp: stepUp
8428
8484
  }), {
8429
8485
  interactionCode: interactionCode,
8430
8486
  actions: actions,
@@ -8850,7 +8906,7 @@ function _unlockAccount() {
8850
8906
  var OktaUserAgent = function () {
8851
8907
  function OktaUserAgent() {
8852
8908
  _classCallCheck(this, OktaUserAgent);
8853
- this.environments = ["okta-auth-js/".concat("6.5.0")];
8909
+ this.environments = ["okta-auth-js/".concat("6.5.3")];
8854
8910
  }
8855
8911
  _createClass(OktaUserAgent, [{
8856
8912
  key: "addEnvironment",
@@ -8868,7 +8924,7 @@ var OktaUserAgent = function () {
8868
8924
  }, {
8869
8925
  key: "getVersion",
8870
8926
  value: function getVersion() {
8871
- return "6.5.0";
8927
+ return "6.5.3";
8872
8928
  }
8873
8929
  }, {
8874
8930
  key: "maybeAddNodeEnvironment",