Comparing version 0.1.0 to 0.1.1
'use strict'; | ||
var coreApi = require( './google-u2f-api' ); | ||
module.exports = API; | ||
var _global = | ||
typeof window !== 'undefined' | ||
? window | ||
: typeof global !== 'undefined' | ||
? global | ||
: { }; | ||
var hasNativeSupport = | ||
( typeof window.u2f !== 'undefined' ) && | ||
( typeof window.u2f.sign === 'function' ); | ||
var _u2f = hasNativeSupport ? window.u2f : null; | ||
var chromeApi = hasNativeSupport ? null : require( './google-u2f-api' ); | ||
var hasNativeSupport = _global.u2f && typeof _global.u2f.sign === 'function'; | ||
var _u2f = hasNativeSupport ? _global.u2f : coreApi; | ||
function API( Promise ) | ||
@@ -35,3 +29,3 @@ { | ||
var backendErrorCodes = hasNativeSupport ? _global.u2f : coreApi.ErrorCodes; | ||
var backendErrorCodes = hasNativeSupport ? _u2f : chromeApi.ErrorCodes; | ||
( | ||
@@ -47,3 +41,3 @@ hasNativeSupport | ||
] | ||
: Object.keys( coreApi.ErrorCodes ) | ||
: Object.keys( chromeApi.ErrorCodes ) | ||
) | ||
@@ -90,3 +84,3 @@ .forEach( function( key ) { | ||
if ( disconnect && !hasNativeSupport ) | ||
coreApi.disconnect( ); | ||
chromeApi.disconnect( ); | ||
@@ -120,3 +114,3 @@ ret.reject( makeError( msg, { errorCode: -1 } ) ); | ||
return defer( Promise, coreApi.isSupported ).promise; | ||
return defer( Promise, chromeApi.isSupported ).promise; | ||
} | ||
@@ -185,3 +179,3 @@ | ||
} | ||
coreApi.register( registerRequests, signRequests, cb, timeout ); | ||
chromeApi.register( registerRequests, signRequests, cb, timeout ); | ||
} | ||
@@ -229,3 +223,3 @@ } ).promise; | ||
coreApi.sign( signRequests, cb, timeout ); | ||
chromeApi.sign( signRequests, cb, timeout ); | ||
} | ||
@@ -232,0 +226,0 @@ } ).promise; |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"author": "Gustaf Räntilä <g.rantila@gmail.com>", | ||
@@ -8,0 +8,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21875
573