index.js
function(signatureObject, publicKey, bufferEncoding = DEFAULT_ENCODING, cb = null){
        var clonedSignatureObj = {
            signature: signatureObject.signature,
            recovery: signatureObject.recovery,
            publicKey: publicKey
        }
        bufferEncoding = getEncodingOrDefault(bufferEncoding)
        if(isFunction(cb)){
            convertBuffersToStrings(clonedSignatureObj, bufferEncoding, function(convertedObj){
                var base64String = Buffer.from(JSON.stringify(convertedObj)).toString('base64')
                return cb(null, base64String)
            })
        } else {
            var convertedObj = convertBuffersToStrings(clonedSignatureObj, bufferEncoding)
            var base64String = Buffer.from(JSON.stringify(convertedObj)).toString('base64')
            return base64String
        }
    }
function(signatureObject, publicKey, bufferEncoding = DEFAULT_ENCODING, cb = null){
        var clonedSignatureObj = {
            signature: signatureObject.signature,
            recovery: signatureObject.recovery,
            publicKey: publicKey
        }
        bufferEncoding = getEncodingOrDefault(bufferEncoding)
        if(isFunction(cb)){
            convertBuffersToStrings(clonedSignatureObj, bufferEncoding, function(convertedObj){
                var base64String = Buffer.from(JSON.stringify(convertedObj)).toString('base64')
                return cb(null, base64String)
            })
        } else {
            var convertedObj = convertBuffersToStrings(clonedSignatureObj, bufferEncoding)
            var base64String = Buffer.from(JSON.stringify(convertedObj)).toString('base64')
            return base64String
        }
    }
function ( signatureObject , publicKey , bufferEncoding = DEFAULT_ENCODING , cb = null ) { var clonedSignatureObj = { signature : signatureObject . signature , recovery : signatureObject . recovery , publicKey : publicKey } bufferEncoding = getEncodingOrDefault ( bufferEncoding ) if ( isFunction ( cb ) ) { convertBuffersToStrings ( clonedSignatureObj , bufferEncoding , function ( convertedObj ) { var base64String = Buffer . from ( JSON . stringify ( convertedObj ) ) . toString ( 'base64' ) return cb ( null , base64String ) } ) } else { var convertedObj = convertBuffersToStrings ( clonedSignatureObj , bufferEncoding ) var base64String = Buffer . from ( JSON . stringify ( convertedObj ) ) . toString ( 'base64' ) return base64String } }
creates a new object containing the values of the signature object plus the public key, encoded as a base64 string
@param  {Object}   signatureObject the signature object containing signature and recovery
@param  {Buffer}   publicKey       the ethereum public key for later signature verification
@param  {String}   bufferEncoding  (optional) the encoding to be used for remaining buffers
@param  {Function} cb              (optional) callback function
@return {String}                   Base64-encoded String representation of the input
creates a new object containing the values of the signature object plus the public key encoded as a base64 string