How do i validate if user entered correct active public and owner public key (e.g. length, no forbidden characters entered) using javascript?

1 Answer 1


Use the eosjs-ecc library to validate keys in JavaScript:

const ecc = require('eosjs-ecc')

const pubkey = 'EOS7rHHE6Gp11zLdTio5xCcGd8KtnDcDYNRC5595hfeKTizePAKZP'
const wif = '5HzevvzwHzcQAZiMSJpZapj87QwtBrtPAwXc4yGwHowLhbujKbg'

console.log(ecc.isValidPublic(pubkey)) // true
console.log(ecc.isValidPrivate(wif)) // true

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.