bat-go icon indicating copy to clipboard operation
bat-go copied to clipboard

Eliminate redundant crypto.SignerOpts argument

Open ibukanov opened this issue 6 months ago • 0 comments

Presently various methods in httpsignature take crypto.SignerOpts argument. The reason for that is that the code eventually calls the Sign() method of the Singnator interface. The signature of that method is derived from https://pkg.go.dev/crypto/ed25519#PrivateKey.Sign. However, for all relevant implementations of the Signer (ED25519/HMAC/Nitro) that argument is not used or should be crypto.Hash(0). As a result the code needs to pass crypto.Hash(0) in quite a few places where the signing is requred.

The same happens with the Verify method.

It will be nice to change the interface to avoid taking useless arguments and pass crypto.Hash(0) only once where a particular implementation requires that.

ibukanov avatar Aug 07 '24 15:08 ibukanov