@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.
@@ -5937,19 +5937,22 @@ var WebauthnEnrollment = function (_Authenticator) {
5937
5937
  _createClass(WebauthnEnrollment, [{
5938
5938
  key: "canVerify",
5939
5939
  value: function canVerify(values) {
5940
- var clientData = values.clientData,
5941
- attestation = values.attestation;
5940
+ var credentials = values.credentials;
5941
+ var obj = credentials || values;
5942
+ var clientData = obj.clientData,
5943
+ attestation = obj.attestation;
5942
5944
  return !!(clientData && attestation);
5943
5945
  }
5944
5946
  }, {
5945
5947
  key: "mapCredentials",
5946
5948
  value: function mapCredentials(values) {
5947
- var clientData = values.clientData,
5949
+ var credentials = values.credentials,
5950
+ clientData = values.clientData,
5948
5951
  attestation = values.attestation;
5949
- if (!clientData && !attestation) {
5952
+ if (!credentials && !clientData && !attestation) {
5950
5953
  return;
5951
5954
  }
5952
- return {
5955
+ return credentials || {
5953
5956
  clientData: clientData,
5954
5957
  attestation: attestation
5955
5958
  };
@@ -5987,21 +5990,24 @@ var WebauthnVerification = function (_Authenticator) {
5987
5990
  _createClass(WebauthnVerification, [{
5988
5991
  key: "canVerify",
5989
5992
  value: function canVerify(values) {
5990
- var clientData = values.clientData,
5991
- authenticatorData = values.authenticatorData,
5992
- signatureData = values.signatureData;
5993
+ var credentials = values.credentials;
5994
+ var obj = credentials || values;
5995
+ var clientData = obj.clientData,
5996
+ authenticatorData = obj.authenticatorData,
5997
+ signatureData = obj.signatureData;
5993
5998
  return !!(clientData && authenticatorData && signatureData);
5994
5999
  }
5995
6000
  }, {
5996
6001
  key: "mapCredentials",
5997
6002
  value: function mapCredentials(values) {
5998
- var authenticatorData = values.authenticatorData,
6003
+ var credentials = values.credentials,
6004
+ authenticatorData = values.authenticatorData,
5999
6005
  clientData = values.clientData,
6000
6006
  signatureData = values.signatureData;
6001
- if (!authenticatorData && !clientData && !signatureData) {
6007
+ if (!credentials && !authenticatorData && !clientData && !signatureData) {
6002
6008
  return;
6003
6009
  }
6004
- return {
6010
+ return credentials || {
6005
6011
  authenticatorData: authenticatorData,
6006
6012
  clientData: clientData,
6007
6013
  signatureData: signatureData
@@ -7099,19 +7105,53 @@ function hasValidInputValue(input, values) {
7099
7105
  var fn = function fn(input, values, requiredTracker) {
7100
7106
  var name = input.name,
7101
7107
  value = input.value,
7108
+ type = input.type,
7109
+ options = input.options,
7102
7110
  required = input.required;
7103
- var isRequired = required || requiredTracker
7104
- || name === 'authenticator';
7105
- if (!isRequired) {
7106
- return true;
7107
- }
7111
+ var isRequired = required || requiredTracker;
7108
7112
  if (Array.isArray(value)) {
7109
7113
  return _reduceInstanceProperty(value).call(value, function (acc, item) {
7110
7114
  return acc && fn(item, values[name], isRequired);
7111
7115
  }, true);
7112
- } else {
7113
- return !!(values && values[name]);
7114
7116
  }
7117
+ if (options) {
7118
+ if (type === 'object') {
7119
+ var _context4, _context5;
7120
+ var selectedOption = values[name];
7121
+ if (!(selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.id)) {
7122
+ return false;
7123
+ }
7124
+ var optionSchema = _findInstanceProperty(options).call(options, function (option) {
7125
+ var _context3;
7126
+ var idSchema = _findInstanceProperty(_context3 = option.value).call(_context3, function (_ref3) {
7127
+ var name = _ref3.name;
7128
+ return name === 'id';
7129
+ });
7130
+ return idSchema.value === selectedOption.id;
7131
+ });
7132
+ if (!optionSchema) {
7133
+ return false;
7134
+ }
7135
+ return _reduceInstanceProperty(_context4 = _filterInstanceProperty(_context5 = optionSchema.value).call(_context5, function (_ref4) {
7136
+ var required = _ref4.required;
7137
+ return !!required;
7138
+ })).call(_context4, function (acc, _ref5) {
7139
+ var name = _ref5.name;
7140
+ return acc && !!selectedOption[name];
7141
+ }, true);
7142
+ }
7143
+ if (required === false) {
7144
+ return true;
7145
+ }
7146
+ if (required === true) {
7147
+ return !!values[name];
7148
+ }
7149
+ throw new AuthSdkError("Unknown options type, ".concat(_JSON$stringify(input)));
7150
+ }
7151
+ if (!isRequired) {
7152
+ return true;
7153
+ }
7154
+ return !!(values && values[name]);
7115
7155
  };
7116
7156
  return fn(input, values, false);
7117
7157
  }
@@ -7513,30 +7553,31 @@ function getRemediator(idxRemediations, values, options) {
7513
7553
  }
7514
7554
  }
7515
7555
  var remediatorCandidates = [];
7516
- var _iterator3 = _createForOfIteratorHelper$1(idxRemediations),
7517
- _step3;
7518
- try {
7519
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
7520
- var _context12;
7521
- var _remediation = _step3.value;
7522
- var isRemeditionInFlow = _includesInstanceProperty(_context12 = _Object$keys(remediators)).call(_context12, _remediation.name);
7523
- if (!isRemeditionInFlow) {
7524
- continue;
7525
- }
7526
- var _T = getRemediatorClass(_remediation, options);
7527
- remediator = new _T(_remediation, values, options);
7528
- if (remediator.canRemediate()) {
7529
- return remediator;
7556
+ if (useGenericRemediator) {
7557
+ remediatorCandidates.push(new GenericRemediator(idxRemediations[0], values, options));
7558
+ } else {
7559
+ var _iterator3 = _createForOfIteratorHelper$1(idxRemediations),
7560
+ _step3;
7561
+ try {
7562
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
7563
+ var _context12;
7564
+ var _remediation = _step3.value;
7565
+ var isRemeditionInFlow = _includesInstanceProperty(_context12 = _Object$keys(remediators)).call(_context12, _remediation.name);
7566
+ if (!isRemeditionInFlow) {
7567
+ continue;
7568
+ }
7569
+ var _T = getRemediatorClass(_remediation, options);
7570
+ remediator = new _T(_remediation, values, options);
7571
+ if (remediator.canRemediate()) {
7572
+ return remediator;
7573
+ }
7574
+ remediatorCandidates.push(remediator);
7530
7575
  }
7531
- remediatorCandidates.push(remediator);
7576
+ } catch (err) {
7577
+ _iterator3.e(err);
7578
+ } finally {
7579
+ _iterator3.f();
7532
7580
  }
7533
- } catch (err) {
7534
- _iterator3.e(err);
7535
- } finally {
7536
- _iterator3.f();
7537
- }
7538
- if (!remediatorCandidates.length && !!idxRemediations.length && useGenericRemediator) {
7539
- return new GenericRemediator(idxRemediations[0], values, options);
7540
7581
  }
7541
7582
  return remediatorCandidates[0];
7542
7583
  }
@@ -7609,7 +7650,7 @@ function remediate(_x, _x2, _x3, _x4) {
7609
7650
  function _remediate() {
7610
7651
  _remediate = _asyncToGenerator( _regeneratorRuntime.mark(function _callee(authClient, idxResponse, values, options) {
7611
7652
  var _context2;
7612
- var _idxResponse, neededToProceed, interactionCode, _options, flow, remediator, actionFromValues, actionFromOptions, actions, _iterator, _step, _loop, _ret, terminal, messages, nextStep, name, data;
7653
+ var _idxResponse, neededToProceed, interactionCode, _options, flow, remediator, actionFromValues, actionFromOptions, actions, _iterator, _step, _loop, _ret, terminal, messages, nextStep, name, data, gr, _nextStep;
7613
7654
  return _regeneratorRuntime.wrap(function _callee$(_context4) {
7614
7655
  while (1) {
7615
7656
  switch (_context4.prev = _context4.next) {
@@ -7822,17 +7863,29 @@ function _remediate() {
7822
7863
  options = _Object$assign(_Object$assign({}, options), {
7823
7864
  step: undefined
7824
7865
  });
7866
+ if (!(options.useGenericRemediator && !idxResponse.interactionCode)) {
7867
+ _context4.next = 65;
7868
+ break;
7869
+ }
7870
+ gr = getRemediator(idxResponse.neededToProceed, values, options);
7871
+ _nextStep = getNextStep(authClient, gr, idxResponse);
7872
+ return _context4.abrupt("return", {
7873
+ idxResponse: idxResponse,
7874
+ nextStep: _nextStep,
7875
+ messages: messages.length ? messages : undefined
7876
+ });
7877
+ case 65:
7825
7878
  return _context4.abrupt("return", remediate(authClient, idxResponse, values, options));
7826
- case 64:
7827
- _context4.prev = 64;
7879
+ case 68:
7880
+ _context4.prev = 68;
7828
7881
  _context4.t3 = _context4["catch"](54);
7829
7882
  return _context4.abrupt("return", handleIdxError(authClient, _context4.t3, remediator));
7830
- case 67:
7883
+ case 71:
7831
7884
  case "end":
7832
7885
  return _context4.stop();
7833
7886
  }
7834
7887
  }
7835
- }, _callee, null, [[10, 22, 25, 28], [35, 43], [54, 64]]);
7888
+ }, _callee, null, [[10, 22, 25, 28], [35, 43], [54, 68]]);
7836
7889
  }));
7837
7890
  return _remediate.apply(this, arguments);
7838
7891
  }
@@ -8262,6 +8315,7 @@ function _run() {
8262
8315
  proceed,
8263
8316
  rawIdxState,
8264
8317
  requestDidSucceed,
8318
+ stepUp,
8265
8319
  _args5 = arguments;
8266
8320
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
8267
8321
  while (1) {
@@ -8310,8 +8364,8 @@ function _run() {
8310
8364
  });
8311
8365
  }
8312
8366
  }
8313
- _ref = idxResponse || {}, actions = _ref.actions, context = _ref.context, neededToProceed = _ref.neededToProceed, proceed = _ref.proceed, rawIdxState = _ref.rawIdxState, requestDidSucceed = _ref.requestDidSucceed;
8314
- return _context5.abrupt("return", _Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign({
8367
+ _ref = idxResponse || {}, actions = _ref.actions, context = _ref.context, neededToProceed = _ref.neededToProceed, proceed = _ref.proceed, rawIdxState = _ref.rawIdxState, requestDidSucceed = _ref.requestDidSucceed, stepUp = _ref.stepUp;
8368
+ return _context5.abrupt("return", _Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign({
8315
8369
  status: status
8316
8370
  }, meta && {
8317
8371
  meta: meta
@@ -8327,6 +8381,8 @@ function _run() {
8327
8381
  messages: messages
8328
8382
  }), error && {
8329
8383
  error: error
8384
+ }), stepUp && {
8385
+ stepUp: stepUp
8330
8386
  }), {
8331
8387
  interactionCode: interactionCode,
8332
8388
  actions: actions,
@@ -8752,7 +8808,7 @@ function _unlockAccount() {
8752
8808
  var OktaUserAgent = function () {
8753
8809
  function OktaUserAgent() {
8754
8810
  _classCallCheck(this, OktaUserAgent);
8755
- this.environments = ["okta-auth-js/".concat("6.5.0")];
8811
+ this.environments = ["okta-auth-js/".concat("6.5.3")];
8756
8812
  }
8757
8813
  _createClass(OktaUserAgent, [{
8758
8814
  key: "addEnvironment",
@@ -8770,7 +8826,7 @@ var OktaUserAgent = function () {
8770
8826
  }, {
8771
8827
  key: "getVersion",
8772
8828
  value: function getVersion() {
8773
- return "6.5.0";
8829
+ return "6.5.3";
8774
8830
  }
8775
8831
  }, {
8776
8832
  key: "maybeAddNodeEnvironment",