eosjs
provides an example implementation of the SignatureProvider
interface called JsSignatureProvider
.
Although JsSignatureProvider
is insecure and should not be used in production, it provides a basic example of what a SignatureProvider
is and does. JsSignatureProvider
simply takes a list of private keys as strings in its constructor and maps these private keys to their respective public keys. When JsSignatureProvider
's sign
is called, a buffer of the chainId
and serializedTransaction
is created and eosjs-ecc
's ecc
object is used to sign the buffer with the private key corresponding to the required public key.