frostfs-api-go/util/signature/options.go
Leonard Lyubich 6191903326 Implement new request signing mechanism
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-09-18 10:40:45 +03:00

26 lines
487 B
Go

package signature
import (
"crypto/ecdsa"
crypto "github.com/nspcc-dev/neofs-crypto"
)
type cfg struct {
signFunc func(key *ecdsa.PrivateKey, msg []byte) ([]byte, error)
verifyFunc func(key *ecdsa.PublicKey, msg []byte, sig []byte) error
}
func defaultCfg() *cfg {
return &cfg{
signFunc: crypto.Sign,
verifyFunc: crypto.Verify,
}
}
func SignWithRFC6979() SignOption {
return func(c *cfg) {
c.signFunc = crypto.SignRFC6979
c.verifyFunc = crypto.VerifyRFC6979
}
}