Liferay.Loader.define("@liferay/multi-factor-authentication-fido2-web@1.0.28/js/webauthn",["module","exports","require","./base64url"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.create=function create(e){return navigator.credentials.create({publicKey:decodeCredentialCreationOptions(e)})},t.credentialToObject=function credentialToObject(e){let t={};try{t=e.getClientExtensionResults()}catch(e){console.error("getClientExtensionResults failed",e)}const{id:r,response:a,type:o}=e;return a.attestationObject?{clientExtensionResults:t,id:r,response:{attestationObject:n.fromByteArray(a.attestationObject),clientDataJSON:n.fromByteArray(a.clientDataJSON)},type:o}:{clientExtensionResults:t,id:r,response:{authenticatorData:n.fromByteArray(a.authenticatorData),clientDataJSON:n.fromByteArray(a.clientDataJSON),signature:n.fromByteArray(a.signature),userHandle:a.userHandle&&n.fromByteArray(a.userHandle)},type:o}},t.get=function get(e){return navigator.credentials.get({publicKey:decodeCredentialRequestOptions(e)})};var n=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var o=n?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(r,a,o):r[a]=e[a]}r.default=e,t&&t.set(e,r);return r}(r("./base64url"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function decodeCredentialCreationOptions(e){const t=e.excludeCredentials.map((e=>_objectSpread(_objectSpread({},e),{},{id:n.toByteArray(e.id)})));return _objectSpread(_objectSpread({},e),{},{attestation:"direct",challenge:n.toByteArray(e.challenge),excludeCredentials:t,user:_objectSpread(_objectSpread({},e.user),{},{id:n.toByteArray(e.user.id)})})}function decodeCredentialRequestOptions(e){const t=e.allowCredentials&&e.allowCredentials.map((e=>_objectSpread(_objectSpread({},e),{},{id:n.toByteArray(e.id)})));return _objectSpread(_objectSpread({},e),{},{allowCredentials:t,challenge:n.toByteArray(e.challenge)})}}}));
//# sourceMappingURL=webauthn.js.map