web3.js icon indicating copy to clipboard operation
web3.js copied to clipboard

Implement a utility helper class that ease dealing with Ethereum Signature and support something similar to `ethers.Signature.from({r, s, v} | string)`

Open Muhammad-Altabba opened this issue 1 year ago • 3 comments

Implement a utility helper class that ease dealing with Ethereum Signature and support something similar to `ethers.Signature.from({r, s, v} | string).

(The new class would be used at: https://github.com/web3/web3-plugin-zksync/blob/758df6f2cf324a7c8e17730672f2ce0a831d407b/src/utils.ts#L499 and https://github.com/web3/web3-plugin-zksync/blob/758df6f2cf324a7c8e17730672f2ce0a831d407b/src/utils.ts#L737)

Muhammad-Altabba avatar May 28 '24 04:05 Muhammad-Altabba

hello sir, sir are { r, s, v } signature variables generated from Externally Owned Accounts's private keys and used for digital signature creation and verification?

and are asking for a helper class sort of like this class SignatureHelper { static from(input) { if (typeof input === 'string') { return this.fromString(input); } else if (typeof input === 'object' && input.r && input.s && input.v !== undefined) { return this.fromObject(input); } else { throw new Error('Invalid input format for Signature'); } }

Vishalll07 avatar Jun 03 '24 16:06 Vishalll07

Add outside test cases

mconnelly8 avatar Jun 25 '24 14:06 mconnelly8

For reference: SignatureObject

And: https://docs.ethers.org/v6/api/crypto/#Signature_from

Need to add to this the migration guide, next.

Muhammad-Altabba avatar Jun 25 '24 14:06 Muhammad-Altabba