Return `error` from all `ReadFromV2` methods in order to support
backward compatibility if message will be extended with some formatted
field.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This reverts commit 458c882ff4.
If `issuerSet` is set after signature calculation then issuer ID isn't
written to signed data, in other words not signed.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Make `Sign` method implementation to not modify `issuerSet` state
variable after signature calculation's failures.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
`Container` and `Object` types are transmitted in single `session.Token`
message. They differ only by session context.
Share common parts of the message in `commonData` struct. Embed struct
into `Container` and `Object`. Make `ReadFromV2` methods to check
protocol compliance. Make `Unmarshal`/`UmarshalJSON` to check field
format in case of presence only.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>