diff --git a/pkg/object/object.go b/pkg/object/object.go index d86c965b..22688dd5 100644 --- a/pkg/object/object.go +++ b/pkg/object/object.go @@ -39,6 +39,8 @@ type rwObject struct { payloadChecksum *refs.Checksum + payload []byte + // TODO: add other fields } @@ -75,6 +77,14 @@ func (o *Object) Verify() error { return nil } +func (o *Object) GetPayload() []byte { + if o != nil { + return o.payload + } + + return nil +} + // ToV2 converts object to v2 Object message. func (o *Object) ToV2() *object.Object { obj, _ := o.rwObject.ToV2(nil) @@ -147,6 +157,7 @@ func (o *rwObject) ToV2(key *ecdsa.PrivateKey) (*object.Object, error) { obj := new(object.Object) obj.SetObjectID(o.id.ToV2()) obj.SetHeader(hdr) + obj.SetPayload(o.payload) sig := new(refs.Signature) sig.SetKey(o.key) @@ -195,6 +206,7 @@ func FromV2(oV2 *object.Object) (*Object, error) { cid: cid, ownerID: ownerID, payloadChecksum: hdr.GetPayloadHash(), + payload: oV2.GetPayload(), }, }, nil }