forked from TrueCloudLab/frostfs-node
Initial commit
Initial public review release v0.10.0
This commit is contained in:
commit
dadfd90dcd
276 changed files with 46331 additions and 0 deletions
22
lib/core/validator.go
Normal file
22
lib/core/validator.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neofs-api-go/service"
|
||||
"github.com/nspcc-dev/neofs-node/internal"
|
||||
)
|
||||
|
||||
// ErrMissingKeySignPairs is returned by functions that expect
|
||||
// a non-empty SignKeyPair slice, but received empty.
|
||||
const ErrMissingKeySignPairs = internal.Error("missing key-signature pairs")
|
||||
|
||||
// VerifyRequestWithSignatures checks if request has signatures and all of them are valid.
|
||||
//
|
||||
// Returns ErrMissingKeySignPairs if request does not have signatures.
|
||||
// Otherwise, behaves like service.VerifyRequestData.
|
||||
func VerifyRequestWithSignatures(req service.RequestVerifyData) error {
|
||||
if len(req.GetSignKeyPairs()) == 0 {
|
||||
return ErrMissingKeySignPairs
|
||||
}
|
||||
|
||||
return service.VerifyRequestData(req)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue