Last active
February 27, 2018 09:55
-
-
Save epexa/1482a2fbb1655469b89f00a457ecae26 to your computer and use it in GitHub Desktop.
golos check username and master password
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var username = 'epexa'; | |
var password = 'P5H...'; // мастер-пароль | |
golos.api.getAccounts([username], function(err, response) { | |
if ( ! err) { | |
// получение публичного ключа | |
var roles = ['posting']; // параметр необязательный, если не указаывать, то вернутся все ключи | |
var keys = golos.auth.getPrivateKeys(username, password, roles); | |
// проверка публичного ключа аккаунта и с полученым публичным ключом | |
if (response[0].posting.key_auths[0][0] == keys.postingPubkey) console.log('правильный логин и мастер-пароль!'); | |
else console.log('не правильный логин и\или мастер-пароль!'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment