@levminer/speakeasy
Advanced tools
Comparing version 1.0.1 to 1.0.2
13
main.js
@@ -38,3 +38,3 @@ const base32 = require("base32.js") | ||
if (!Buffer.isBuffer(secret)) { | ||
secret = encoding === "base32" ? Buffer.alloc(base32.decode(secret)) : Buffer.alloc(secret, encoding) | ||
secret = encoding === "base32" ? Buffer.from(base32.decode(secret)) : Buffer.from(secret, encoding) | ||
} | ||
@@ -56,3 +56,3 @@ | ||
if (secret_buffer_size && secret.length !== secret_buffer_size) { | ||
secret = Buffer.alloc(Array(Math.ceil(secret_buffer_size / secret.length) + 1).join(secret.toString("hex")), "hex").slice( | ||
secret = Buffer.from(Array(Math.ceil(secret_buffer_size / secret.length) + 1).join(secret.toString("hex")), "hex").slice( | ||
0, | ||
@@ -94,4 +94,3 @@ secret_buffer_size | ||
* @param {Buffer} [options.digest] Digest, automatically generated by default | ||
* @param {Integer} [options.digits=6] The number of digits for the one-time | ||
* passcode. | ||
* @param {Integer} [options.digits=6] The number of digits for the one-time passcode. | ||
* @param {String} [options.encoding="ascii"] Key encoding (ascii, hex, | ||
@@ -519,4 +518,4 @@ * base32, base64). | ||
SecretKey.ascii = key | ||
SecretKey.hex = Buffer.alloc(key, "ascii").toString("hex") | ||
SecretKey.base32 = base32.encode(Buffer.alloc(key)).toString().replace(/=/g, "") | ||
SecretKey.hex = Buffer.from(key, "ascii").toString("hex") | ||
SecretKey.base32 = base32.encode(Buffer.from(key)).toString().replace(/=/g, "") | ||
@@ -658,3 +657,3 @@ // generate some qr codes if requested | ||
// convert secret to base32 | ||
if (encoding !== "base32") secret = Buffer.alloc(secret, encoding) | ||
if (encoding !== "base32") secret = Buffer.from(secret, encoding) | ||
if (Buffer.isBuffer(secret)) secret = base32.encode(secret) | ||
@@ -661,0 +660,0 @@ |
{ | ||
"name": "@levminer/speakeasy", | ||
"description": "Two-factor authentication for Node.js. Generate One-time passcode generator (HOTP/TOTP) with support for Google Authenticator.", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"homepage": "http://github.com/Levminer/speakeasy", | ||
@@ -6,0 +6,0 @@ "bugs": "https://github.com/Levminer/speakeasy/issues", |
@@ -39,3 +39,3 @@ # @levminer/speakeasy | ||
<a name="#two-factor"></a> | ||
<a name="two-factor"></a> | ||
@@ -80,3 +80,3 @@ ## Two-Factor Usage | ||
// npm i qrcode | ||
let QRCode = require("qrcode") | ||
const QRCode = require("qrcode") | ||
@@ -83,0 +83,0 @@ // Get the data URL of the authenticator URL |
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
86836
669