[#520] objectcore: Refactor format validator
All checks were successful
ci/woodpecker/pr/pre-commit Pipeline was successful
Build / Build Components (1.19) (pull_request) Successful in 3m48s
Build / Build Components (1.20) (pull_request) Successful in 3m33s
Tests and linters / Lint (pull_request) Successful in 3m27s
Tests and linters / Tests (1.20) (pull_request) Successful in 6m6s
Tests and linters / Tests with -race (pull_request) Successful in 9m4s
Tests and linters / Staticcheck (pull_request) Successful in 5m6s
Tests and linters / Tests (1.19) (pull_request) Successful in 15m58s

Remove redundant FIXME.
Move error to consts.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-07-13 16:43:41 +03:00
parent 8a9fc2c372
commit fffd1837f2

View file

@ -64,6 +64,8 @@ var errNoExpirationEpoch = errors.New("missing expiration epoch attribute")
var errTombstoneExpiration = errors.New("tombstone body and header contain different expiration values")
var errMissingSignature = errors.New("missing signature")
func defaultCfg() *cfg {
return new(cfg)
}
@ -135,8 +137,7 @@ func (v *FormatValidator) Validate(ctx context.Context, obj *objectSDK.Object, u
func (v *FormatValidator) validateSignatureKey(obj *objectSDK.Object) error {
sig := obj.Signature()
if sig == nil {
// TODO(@cthulhu-rider): #468 use "const" error
return errors.New("missing signature")
return errMissingSignature
}
var sigV2 refs.Signature
@ -157,8 +158,6 @@ func (v *FormatValidator) validateSignatureKey(obj *objectSDK.Object) error {
return v.checkOwnerKey(*obj.OwnerID(), key)
}
// FIXME: #1159 perform token verification
return nil
}