You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I needed a function to generate the r, s, v parameters of the signature of a message that I signed with web3, and was surprised that I couldn't find such a function available in web3 (unless I missed something of course). Does it fit within the scope of the project to include this? I can make a pull request if so, this is my current implementation:
getSignatureParameters( signature ) {
const r = signature.slice( 0, 66 );
const s = `0x${signature.slice( 66, 130 )}`;
let v = `0x${signature.slice( 130, 132 )}`;
v = this.web3.utils.toDecimal( v );
if ( ![ 27, 28 ].includes( v ) ) v += 27;
return {
r,
s,
v
};
};
The text was updated successfully, but these errors were encountered:
Hi,
I needed a function to generate the r, s, v parameters of the signature of a message that I signed with web3, and was surprised that I couldn't find such a function available in web3 (unless I missed something of course). Does it fit within the scope of the project to include this? I can make a pull request if so, this is my current implementation:
The text was updated successfully, but these errors were encountered: