question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: sign digest method in Signer

See original GitHub issue

Description

The request is to basically offer the functionality you described in this comment as a method in the Signer class.

Just like there is a signMessage method, it’d be nice to have a similar signDigest, which takes the raw digest (a 32 bytes hash) and returns a signature as a JavaScript object with the v, r and s properties.

Use Case

This would be particularly useful for testing contracts that implement EIP-712 and EIP-2612.

A comprehensive testing suite involves many networks: the local chain, the coverage chain, maybe a testnet or a fork of mainnet. Having a signDigest method in the Signer would simplify the writing of tests, insofar developers wouldn’t have to manage a mapping of private keys => accounts for each network. Furthermore, there are tools where the default behaviour is to create a new set of accounts on every run (e.g. solidity-coverage), so additional configuration is required to make them compatible with tests that involve hardcoded private keys.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ricmoocommented, Oct 19, 2020

As a note to anyone following this issue, #687 has been addressed. Please try out EIP-712 support. 😃

0reactions
ricmoocommented, Oct 8, 2020

Closing this and tracking progress in #687 .

Thanks! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

XML Signature Syntax and Processing Version 1.1 - W3C
The signing of the DigestValue is what binds the content of a resource to the signer's key. 2.2 Extended Example ( Object and...
Read more >
Sign - AWS Key Management Service
Creates a digital signature for a message or message digest by using the private key in an asymmetric signing KMS key. To verify...
Read more >
Signing functionality — pyHanko 0.16.0-dev1 documentation
These function as countersignatures to the signer's signature, proving that a signature existed at a certain point in time. This is a necessary...
Read more >
HTTP Message Signatures
The signer chooses an HTTP signature algorithm and key material for signing. · The signer sets the signature's creation time to the current...
Read more >
SubtleCrypto.sign() - Web APIs - MDN Web Docs
These systems all use a digest algorithm to hash the message to a short fixed size before signing. Except for ECDSA (for which...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found