Closed smallhive closed 1 year ago
what about
object.Object
?
Nothing, it has a different API for signing with different names. I tend to think we may rewrite it to be compatible with SignedComponent
interface. I did these changes in the last commit
type SignedComponent interface { SignedData() []byte Sign(neofscrypto.Signer) error VerifySignature() bool }
I've added the suggested test, but we had some changes in code, according to this
SignedData returns data that _would be signed_
breaks me a little. MabeSignedData returns the data that is signed after a [Token.Sign] call
?
// SignedData returns signed data of the T.
//
// See also [T.Sign].
?
Updated. Make two test interfaces/functions for each user.Signer
and neofscrypto.Signer
. But Object functions I renamed to be compatible with new test interface and more important with other signable components
No problem with the signer it is OK. Problem with checking functions
func SignedDataComponent(tb testing.TB, signer neofscrypto.Signer, cmp SignedComponent)
func SignedDataComponentUser(tb testing.TB, signer user.Signer, cmp SignedComponentUserSigner)
They don't want to accept the wrong types for cmp
parameter.
Cannot use 'val' (type *session.Container) as the type SignedComponent Type does not implement 'SignedComponent'
need the method: Sign(neofscrypto.Signer) error
have the method: Sign(signer user.Signer) error
That is why we have two interfaces and two functions to check them
need the method: Sign(neofscrypto.Signer) error
have the method: Sign(signer user.Signer) error
needed method is more generic and may be implemented in-place
closes #510
Added func to known places with
Sign
method, plus for some places when I think it would be useful. Of course, in some way it is almost similar toMarshal
func, but for consistency called it SignedData.If I missed any place, just mention it