Skip to content

Instantly share code, notes, and snippets.

@epexa
Last active February 27, 2018 09:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save epexa/1482a2fbb1655469b89f00a457ecae26 to your computer and use it in GitHub Desktop.
Save epexa/1482a2fbb1655469b89f00a457ecae26 to your computer and use it in GitHub Desktop.
golos check username and master password
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