geforkt von mirrored/vaultwarden
1 Zeile
16 KiB
JavaScript
1 Zeile
16 KiB
JavaScript
|
var AdminLTEOptions={controlSidebarOptions:{selector:"#adminlte-fakeselector"}};!function(e){var t=-1!==navigator.userAgent.indexOf("Firefox")||-1!==navigator.userAgent.indexOf("Gecko/"),r=!(void 0===e.u2f||!e.u2f.register);if(t&&r)e.u2f.isSupported=!0;else{var n,o=e.u2f||{};o.isSupported=!!(void 0!==o&&o.register||"undefined"!=typeof chrome&&chrome.runtime),o.EXTENSION_ID="kmendfapggjehodndflmmgagdbamhnfd",o.MessageTypes={U2F_REGISTER_REQUEST:"u2f_register_request",U2F_REGISTER_RESPONSE:"u2f_register_response",U2F_SIGN_REQUEST:"u2f_sign_request",U2F_SIGN_RESPONSE:"u2f_sign_response",U2F_GET_API_VERSION_REQUEST:"u2f_get_api_version_request",U2F_GET_API_VERSION_RESPONSE:"u2f_get_api_version_response"},o.ErrorCodes={OK:0,OTHER_ERROR:1,BAD_REQUEST:2,CONFIGURATION_UNSUPPORTED:3,DEVICE_INELIGIBLE:4,TIMEOUT:5},o.U2fRequest,o.U2fResponse,o.Error,o.Transport,o.Transports,o.SignRequest,o.SignResponse,o.RegisterRequest,o.RegisterResponse,o.RegisteredKey,o.GetJsApiVersionResponse,o.getMessagePort=function(e){if("undefined"!=typeof chrome&&chrome.runtime){var t={type:o.MessageTypes.U2F_SIGN_REQUEST,signRequests:[]};chrome.runtime.sendMessage(o.EXTENSION_ID,t,function(){chrome.runtime.lastError?o.getIframePort_(e):o.getChromeRuntimePort_(e)})}else o.isAndroidChrome_()?o.getAuthenticatorPort_(e):o.isIosChrome_()?o.getIosPort_(e):o.getIframePort_(e)},o.isAndroidChrome_=function(){var e=navigator.userAgent;return-1!=e.indexOf("Chrome")&&-1!=e.indexOf("Android")},o.isIosChrome_=function(){return["iPhone","iPad","iPod"].indexOf(navigator.platform)>-1},o.getChromeRuntimePort_=function(e){var t=chrome.runtime.connect(o.EXTENSION_ID,{includeTlsChannelId:!0});setTimeout(function(){e(new o.WrappedChromeRuntimePort_(t))},0)},o.getAuthenticatorPort_=function(e){setTimeout(function(){e(new o.WrappedAuthenticatorPort_)},0)},o.getIosPort_=function(e){setTimeout(function(){e(new o.WrappedIosPort_)},0)},o.WrappedChromeRuntimePort_=function(e){this.port_=e},o.formatSignRequest_=function(e,t,r,a,s){if(void 0===n||n<1.1){for(var i=[],p=0;p<r.length;p++)i[p]={version:r[p].version,challenge:t,keyHandle:r[p].keyHandle,appId:e};return{type:o.MessageTypes.U2F_SIGN_REQUEST,signRequests:i,timeoutSeconds:a,requestId:s}}return{type:o.MessageTypes.U2F_SIGN_REQUEST,appId:e,challenge:t,registeredKeys:r,timeoutSeconds:a,requestId:s}},o.formatRegisterRequest_=function(e,t,r,a,s){if(void 0===n||n<1.1){for(var i=0;i<r.length;i++)r[i].appId=e;var p=[];for(i=0;i<t.length;i++)p[i]={version:t[i].version,challenge:r[0],keyHandle:t[i].keyHandle,appId:e};return{type:o.MessageTypes.U2F_REGISTER_REQUEST,signRequests:p,registerRequests:r,timeoutSeconds:a,requestId:s}}return{type:o.MessageTypes.U2F_REGISTER_REQUEST,appId:e,registerRequests:r,registeredKeys:t,timeoutSeconds:a,requestId:s}},o.WrappedChromeRuntimePort_.prototype.postMessage=function(e){this.port_.postMessage(e)},o.WrappedChromeRuntimePort_.prototype.addEventListener=function(e,t){var r=e.toLowerCase();"message"==r||"onmessage"==r?this.port_.onMessage.addListener(function(e){t({data:e})}):console.error("WrappedChromeRuntimePort only supports onMessage")},o.WrappedAuthenticatorPort_=function(){this.requestId_=-1,this.requestObject_=null},o.WrappedAuthenticatorPort_.prototype.postMessage=function(e){var t=o.WrappedAuthenticatorPort_.INTENT_URL_BASE_+";S.request="+encodeURIComponent(JSON.stringify(e))+";end";document.location=t},o.WrappedAuthenticatorPort_.prototype.getPortType=function(){return"WrappedAuthenticatorPort_"},o.WrappedAuthenticatorPort_.prototype.addEventListener=function(e,t){if("message"==e.toLowerCase()){window.addEventListener("message",this.onRequestUpdate_.bind(this,t),!1)}else console.error("WrappedAuthenticatorPort only supports message")},o.WrappedAuthenticatorPort_.prototype.onRequestUpdate_=function(e,t){var r=JSON.parse(t.data),n=(r.intentURL,r.errorCode,null);r.hasOwnProperty("data")&&(n=JSON.parse(r.data)),e({data:n})},o.WrappedAuthenticatorPort_.INTENT_URL_BASE_="intent:#Intent;action=com.google.android.apps.authenticator.AUTHENTICATE",o.WrappedIosPort_=function(){},o.WrappedIosPort_.protot
|