[#520] objectcore: Refactor format validator
All checks were successful
ci/woodpecker/push/pre-commit Pipeline was successful

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 committed by Evgenii Stratonikov
parent 11027945d8
commit 397131b0ea

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 errTombstoneExpiration = errors.New("tombstone body and header contain different expiration values")
var errMissingSignature = errors.New("missing signature")
func defaultCfg() *cfg { func defaultCfg() *cfg {
return new(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 { func (v *FormatValidator) validateSignatureKey(obj *objectSDK.Object) error {
sig := obj.Signature() sig := obj.Signature()
if sig == nil { if sig == nil {
// TODO(@cthulhu-rider): #468 use "const" error return errMissingSignature
return errors.New("missing signature")
} }
var sigV2 refs.Signature var sigV2 refs.Signature
@ -157,8 +158,6 @@ func (v *FormatValidator) validateSignatureKey(obj *objectSDK.Object) error {
return v.checkOwnerKey(*obj.OwnerID(), key) return v.checkOwnerKey(*obj.OwnerID(), key)
} }
// FIXME: #1159 perform token verification
return nil return nil
} }