//Copyright 2014-2015 Google Inc. All rights reserved. "use strict";var u2f=u2f||{};var js_api_version;u2f.EXTENSION_ID="kmendfapggjehodndflmmgagdbamhnfd";u2f.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"};u2f.ErrorCodes={OK:0,OTHER_ERROR:1,BAD_REQUEST:2,CONFIGURATION_UNSUPPORTED:3,DEVICE_INELIGIBLE:4,TIMEOUT:5};u2f.U2fRequest;u2f.U2fResponse;u2f.Error;u2f.Transport;u2f.Transports;u2f.SignRequest;u2f.SignResponse;u2f.RegisterRequest;u2f.RegisterResponse;u2f.RegisteredKey;u2f.GetJsApiVersionResponse;u2f.getMessagePort=function(callback){if(typeof chrome!="undefined"&&chrome.runtime){var msg={type:u2f.MessageTypes.U2F_SIGN_REQUEST,signRequests:[]};chrome.runtime.sendMessage(u2f.EXTENSION_ID,msg,function(){if(!chrome.runtime.lastError){u2f.getChromeRuntimePort_(callback)}else{u2f.getIframePort_(callback)}})}else if(u2f.isAndroidChrome_()){u2f.getAuthenticatorPort_(callback)}else if(u2f.isIosChrome_()){u2f.getIosPort_(callback)}else{u2f.getIframePort_(callback)}};u2f.isAndroidChrome_=function(){var userAgent=navigator.userAgent;return userAgent.indexOf("Chrome")!=-1&&userAgent.indexOf("Android")!=-1};u2f.isIosChrome_=function(){return $.inArray(navigator.platform,["iPhone","iPad","iPod"])>-1};u2f.getChromeRuntimePort_=function(callback){var port=chrome.runtime.connect(u2f.EXTENSION_ID,{includeTlsChannelId:true});setTimeout(function(){callback(new u2f.WrappedChromeRuntimePort_(port))},0)};u2f.getAuthenticatorPort_=function(callback){setTimeout(function(){callback(new u2f.WrappedAuthenticatorPort_)},0)};u2f.getIosPort_=function(callback){setTimeout(function(){callback(new u2f.WrappedIosPort_)},0)};u2f.WrappedChromeRuntimePort_=function(port){this.port_=port};u2f.formatSignRequest_=function(appId,challenge,registeredKeys,timeoutSeconds,reqId){if(js_api_version===undefined||js_api_version<1.1){var signRequests=[];for(var i=0;i