Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

u2f-api

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

u2f-api - npm Package Compare versions

Comparing version 1.0.9 to 1.0.10

8

dist/lib/u2f-api.d.ts

@@ -19,2 +19,10 @@ export interface RegisterRequest {

}
export declare type Transport = 'bt' | 'ble' | 'nfc' | 'usb';
export declare type Transports = Array<Transport>;
export interface RegisteredKey {
version: string;
keyHandle: string;
transports: Transports;
appId: string;
}
export declare const ErrorCodes: {

@@ -21,0 +29,0 @@ OK: number;

32

dist/lib/u2f-api.js

@@ -92,5 +92,12 @@ 'use strict';

exports.ensureSupport = ensureSupport;
function arrayify(value) {
if (value != null && Array.isArray(value))
return value;
return value == null
? []
: Array.isArray(value)
? value.slice() : [value];
}
function register(registerRequests, signRequests, timeout) {
if (!Array.isArray(registerRequests))
registerRequests = [registerRequests];
var _registerRequests = arrayify(registerRequests);
if (typeof signRequests === 'number' && typeof timeout === 'undefined') {

@@ -100,4 +107,3 @@ timeout = signRequests;

}
if (!signRequests)
signRequests = [];
var _signRequests = arrayify(signRequests);
return getBackend()

@@ -116,4 +122,4 @@ .then(function (backend) {

}
var appId = registerRequests[0].appId;
u2f.register(appId, registerRequests, signRequests, callback, timeout);
var appId = _registerRequests[0].appId;
u2f.register(appId, _registerRequests, _signRequests, callback, timeout);
});

@@ -124,4 +130,3 @@ });

function sign(signRequests, timeout) {
if (!Array.isArray(signRequests))
signRequests = [signRequests];
var _signRequests = arrayify(signRequests);
return getBackend()

@@ -140,5 +145,10 @@ .then(function (backend) {

}
var appId = signRequests[0].appId;
var challenge = signRequests[0].challenge;
u2f.sign(appId, challenge, signRequests, callback, timeout);
var appId = _signRequests[0].appId;
var challenge = _signRequests[0].challenge;
var registeredKeys = _signRequests
.map(function (_a) {
var version = _a.version, keyHandle = _a.keyHandle, appId = _a.appId;
return ({ version: version, keyHandle: keyHandle, appId: appId });
});
u2f.sign(appId, challenge, registeredKeys, callback, timeout);
});

@@ -145,0 +155,0 @@ });

@@ -0,1 +1,2 @@

import 'source-map-support/register';
import 'mocha';

@@ -52,2 +52,3 @@ 'use strict';

Object.defineProperty(exports, "__esModule", { value: true });
require("source-map-support/register");
require("mocha");

@@ -147,11 +148,9 @@ var chai_1 = require("chai");

return {
sign: function (appId, challenge, signRequests, cbNative, timeout) {
sign: function (appId, challenge, registeredKeys, cbNative, timeout) {
return handleTimeout(props, timeout, function () {
if (props.appId && props.appId !== appId)
return { errorCode: ErrorCodesEnum.BAD_REQUEST };
var found = signRequests.some(function (req) {
var found = registeredKeys.some(function (req) {
return store.some(function (storeReq) {
return storeReq.request === req.request
&&
storeReq.appId === req.appId;
return storeReq.appId === req.appId;
});

@@ -158,0 +157,0 @@ });

@@ -5,3 +5,3 @@ {

"license": "MIT",
"version": "1.0.9",
"version": "1.0.10",
"author": "Gustaf Räntilä <g.rantila@gmail.com>",

@@ -42,2 +42,3 @@ "repository": {

"chai": "4.x",
"commitizen": "3.x",
"cz-conventional-changelog": "2.x",

@@ -49,2 +50,3 @@ "jsdom": "11.x",

"semantic-release": "15.x",
"source-map-support": "0.x",
"travis-deploy-once": "5.x",

@@ -51,0 +53,0 @@ "typescript": "3.x"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc