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


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, privacy policy and cookie policy

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