Socket
Socket
Sign inDemoInstall

yub

Package Overview
Dependencies
23
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.10.5 to 0.10.6

16

lib/modhex.js

@@ -9,3 +9,3 @@ // lookup table for modhex codes

// decode a modhex string to an integer
// decode a modhex string to a hexadecimal string
// see http://static.yubico.com/var/uploads/pdfs/YubiKey_manual-2.2.pdf

@@ -34,8 +34,16 @@ var decode = function (src) {

// return as decimal number
return parseInt(hex,16);
// return as hexadecimal number
return hex;
}
// decode a modhex string to an integer
// see http://static.yubico.com/var/uploads/pdfs/YubiKey_manual-2.2.pdf
var decodeInt = function (src) {
var d = decode(src);
return (d == null)? null : parseInt(decode(src), 16);
}
module.exports = {
decode: decode
decode: decode,
decodeInt: decodeInt
}

@@ -48,2 +48,9 @@ var crypto = require('crypto');

// extract the encrypted portion of the Yubikey OTP i.e.
// the last 32 characters
var calculateEncrypted = function(otp) {
var len = otp.length;
return (len > 32) ? otp.substring(len - 32, len) : null;
};
// calculate the string that is required to be hashed i.e.

@@ -117,6 +124,10 @@ // keys in alphabetical order, separated from values by '='

body.identity = null;
body.encrypted = null;
body.encryptedHex = null;
body.serial = null;
if (typeof body.status != "undefined" && body.status === "OK") {
body.identity = calculateIdentity(otp);
body.serial = modhex.decode(body.identity);
body.encrypted = calculateEncrypted(otp);
body.encryptedHex = modhex.decode(body.encrypted);
body.serial = modhex.decodeInt(body.identity);
}

@@ -135,2 +146,3 @@

var identity = calculateIdentity(otp);
var encrypted = calculateEncrypted(otp);

@@ -146,3 +158,5 @@ var body = {

identity: identity,
serial: modhex.decode(identity)
encrypted: encrypted,
encryptedHex: modhex.decode(encrypted),
serial: modhex.decodeInt(identity)
};

@@ -149,0 +163,0 @@

{
"name": "yub",
"version": "0.10.5",
"description": "Yubico Yubikey API Client",
"version": "0.10.6",
"description": "Yubico Yubikey API Client for Node.js",
"main": "index.js",

@@ -6,0 +6,0 @@ "repository": "https://github.com/glynnbird/yub.git",

@@ -95,2 +95,4 @@ # YUB

* identity - the unique identifier of the Yubikey that generated the password. If you want to write software the detects the presence of a specific Yubikey (not just any Yubikey), then data.identity is your friend.
* encrypted - the 32 digit encrypted portion of the OTP in 'modhex' format
* encryptedHex - the encrypted portion of the OTP in hexadecimal
* serial - the serial number of the Yubikey. This is derived by decoding the identity's modhex encoding.

@@ -97,0 +99,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc