eosjs-ecc icon indicating copy to clipboard operation
eosjs-ecc copied to clipboard

Can the toPublic method add an pubkey_prefix parameter for user-defined use?

Open cppfuns opened this issue 6 years ago • 0 comments

https://github.com/EOSIO/eosjs-ecc/blob/2063257e8d02e82ce4ca1d0fdadf451281b33d1e/src/key_private.js#L62

Original edition

function toPublic() {
        if (public_key) {
            // cache
            // S L O W in the browser
            return public_key
        }
        const Q = secp256k1.G.multiply(d);
        return public_key = PublicKey.fromPoint(Q);
    }

Revised

function toPublic(pubkey_prefix = 'EOS') {
        if (public_key) {
            // cache
            // S L O W in the browser
            return public_key
        }
        const Q = secp256k1.G.multiply(d);
        return public_key = PublicKey.fromPoint(Q, pubkey_prefix );
    }

https://www.bcskill.com/index.php/archives/700.html

cppfuns avatar Jun 14 '19 08:06 cppfuns