[#190] Refactor cryptographic functionality

Remove `signature` and `util/signature` packages. Re-implement their
functionality in new `crypto` package. Generalize the approach of
digital signature computation and verification by adding `Signer` and
`PublicKey` primitives similar to standard `crypto` package. Support
already exising in protocol signature schemes.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2022-04-05 14:13:34 +03:00 committed by LeL
parent 2deaaeef05
commit ea043f4ca3
33 changed files with 728 additions and 627 deletions

View file

@ -5,7 +5,6 @@ import (
"github.com/mr-tron/base58"
"github.com/nspcc-dev/neofs-api-go/v2/reputation"
"github.com/nspcc-dev/neofs-sdk-go/util/signature"
)
// PeerID represents peer ID compatible with NeoFS API v2.
@ -27,7 +26,7 @@ func PeerIDFromV2(id *reputation.PeerID) *PeerID {
}
// SetPublicKey sets peer ID as a compressed public key.
func (x *PeerID) SetPublicKey(v [signature.PublicKeyCompressedSize]byte) {
func (x *PeerID) SetPublicKey(v [33]byte) {
(*reputation.PeerID)(x).SetPublicKey(v[:])
}