DoctorMcKay / node-steam-user

Allows interaction with the Steam network via the Steam client protocol
https://dev.doctormckay.com/forum/7-node-steam-user/
MIT License
888 stars 157 forks source link

throw new ERR_INVALID_ARG_TYPE( #340

Closed Galacringe closed 3 years ago

Galacringe commented 3 years ago

== DO NOT PROCEED TO OPEN THIS ISSUE ==

GitHub issues in this repository are for bugs and feature requests ONLY! Please use the dedicated forum instead at https://dev.doctormckay.com/forum/7-node-steam-user/

the original code is it:

const SteamUser = require('steam-user'); const SteamTotp = require('steam-totp'); const config = require('./config.json'); const client = new SteamUser();

const logonOptions = { accoutName: config.username, password: config.password, twoFactorCode: SteamTotp.generateAuthCode(config.shareedSecret)

};

client.logOn(logonOptions);

client.on('loggedOn', () => { console.log(' GarlicBot successfully logged on. '); client.setPersona(SteamUser.EPersonaState.Online); client.gamesPlayed(["Custom Game",440]); });

client.on("friendMessage", function(steamID, message) { if (message == "hi") { client.chatMessage(steamID, "hello! GarlicBot Online!") }

});

and cmd failed to run and send to me this msg.

TypeError [ERR_INVALID_ARG_TYPE]: The "key" argument must be of type string or an instance of Buffer, TypedArray, DataView, or KeyObject. Received undefined  at prepareSecretKey (internal/crypto/keys.js:322:11)  at new Hmac (internal/crypto/hash.js:111:9)  at Object.createHmac (crypto.js:147:10) at Object.exports.generateAuthCode.exports.getAuthCode (C:\Users\user\Desktop\steambot\node_modules\steam-totp\index.js:43:20) at Object. (C:\Users\user\Desktop\steambot\steambot.js:9:27)  at Module._compile (internal/modules/cjs/loader.js:1063:30)  at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)  at Module.load (internal/modules/cjs/loader.js:928:32)  at Function.Module._load (internal/modules/cjs/loader.js:769:14)  at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) { code: 'ERR_INVALID_ARG_TYPE' }

how can i fix it?

DoctorMcKay commented 3 years ago

Next time read what the box says before you paste stuff into it.

Also you made a typo with shareedSecret instead of sharedSecret.