[#168] refs: Implement binary/JSON encoders/decoders on Signature

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-13 16:23:41 +03:00 committed by Alex Vanin
parent 1519a02d63
commit 4b55b06780
6 changed files with 110 additions and 4 deletions

View file

@ -266,6 +266,17 @@ func (s *Signature) StableSize() (size int) {
return size
}
func (s *Signature) Unmarshal(data []byte) error {
m := new(refs.Signature)
if err := goproto.Unmarshal(data, m); err != nil {
return err
}
*s = *SignatureFromGRPCMessage(m)
return nil
}
func (v *Version) StableMarshal(buf []byte) ([]byte, error) {
if v == nil {
return []byte{}, nil