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
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