@okta/okta-auth-js 6.5.0 → 6.5.1

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
  }
@@ -8360,6 +8401,7 @@ function _run() {
8360
8401
  proceed,
8361
8402
  rawIdxState,
8362
8403
  requestDidSucceed,
8404
+ stepUp,
8363
8405
  _args5 = arguments;
8364
8406
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
8365
8407
  while (1) {
@@ -8408,8 +8450,8 @@ function _run() {
8408
8450
  });
8409
8451
  }
8410
8452
  }
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({
8453
+ _ref = idxResponse || {}, actions = _ref.actions, context = _ref.context, neededToProceed = _ref.neededToProceed, proceed = _ref.proceed, rawIdxState = _ref.rawIdxState, requestDidSucceed = _ref.requestDidSucceed, stepUp = _ref.stepUp;
8454
+ return _context5.abrupt("return", _Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign({
8413
8455
  status: status
8414
8456
  }, meta && {
8415
8457
  meta: meta
@@ -8425,6 +8467,8 @@ function _run() {
8425
8467
  messages: messages
8426
8468
  }), error && {
8427
8469
  error: error
8470
+ }), stepUp && {
8471
+ stepUp: stepUp
8428
8472
  }), {
8429
8473
  interactionCode: interactionCode,
8430
8474
  actions: actions,
@@ -8850,7 +8894,7 @@ function _unlockAccount() {
8850
8894
  var OktaUserAgent = function () {
8851
8895
  function OktaUserAgent() {
8852
8896
  _classCallCheck(this, OktaUserAgent);
8853
- this.environments = ["okta-auth-js/".concat("6.5.0")];
8897
+ this.environments = ["okta-auth-js/".concat("6.5.1")];
8854
8898
  }
8855
8899
  _createClass(OktaUserAgent, [{
8856
8900
  key: "addEnvironment",
@@ -8868,7 +8912,7 @@ var OktaUserAgent = function () {
8868
8912
  }, {
8869
8913
  key: "getVersion",
8870
8914
  value: function getVersion() {
8871
- return "6.5.0";
8915
+ return "6.5.1";
8872
8916
  }
8873
8917
  }, {
8874
8918
  key: "maybeAddNodeEnvironment",