question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"list" argument must be an Array of Buffers

See original GitHub issue

The following code is throwing an error “list” argument must be an Array of Buffers

speakeasy.hotp({ secret: 'ir6jqgomwnldmrhn', encoding: 'base32', counter: speakeasy._counter({}) })

I am doing this in an angular 5 app.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:10

github_iconTop GitHub Comments

6reactions
mustapha1509commented, Mar 5, 2020

Solved, In “node_modules/speakeasy/index.js” replace from line 39 to 41 with this code

if (!Buffer.isBuffer(secret)) {
    secret = encoding === 'base32' ? new Buffer(base32.decode(secret)) : new Buffer(secret, encoding);
  }
0reactions
zdenda-onlinecommented, Feb 12, 2021

In case anyone had an issues with this. I used @ygweric code more or less but here I added full code (with dependencies and toHex implementation). For base32 decoding, I used `hi-base32: “^0.5.0” in my package.json

const secret = "...."; // retrieved from server as string in base32

const base32 = require('hi-base32');
const secretAscii = base32.decode(secret);
const secretHex = toHex(secretAscii);
const totp = speakeasy.totp({secret: secretHex, encoding: 'hex'});

function toHex(str) {
    let result = '';
    for (let i = 0; i < str.length; i++) {
        result += str.charCodeAt(i).toString(16);
    }
    return result;
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: "list" argument must be an Array of Buffers
I found bug it was in app.js file at 58 line, The bug has been fixed by Buffer.isBuffer(chunk) function. Thanks.
Read more >
Type Error "list" Argument must be an Array - General
Hi there,. I applied a buffer in my node-red flow and have now encountered this problem in my CMD window, stopping the node-red...
Read more >
Node.js Buffer API, for the browser
isBuffer(buf)) { throw new TypeError('"list" argument must be an Array of Buffers') } buf.copy(buffer, pos) pos += buf.length } return buffer }
Read more >
Buffer | Node.js v19.3.0 Documentation
Specifically, the TypedArray variants accept a second argument that is a mapping function that is invoked on every element of the typed array:....
Read more >
TypeError: "list" argument must be an Array of Buffers while ...
TypeError: "list" argument must be an Array of Buffers while reading a tag.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found