From 8c43d2969eaa4404675252480befa0642fca5dc4 Mon Sep 17 00:00:00 2001 From: Laria Carolin Chabowski Date: Tue, 25 Jul 2017 08:05:53 +0200 Subject: Add API for snapshot signing --- objects/object_snapshot.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/objects/object_snapshot.go b/objects/object_snapshot.go index 59c7121..7edbc2a 100644 --- a/objects/object_snapshot.go +++ b/objects/object_snapshot.go @@ -62,6 +62,14 @@ func (s Snapshot) Payload() (out []byte) { return out } +type Signer interface { + Sign([]byte) ([]byte, error) +} + +func (s Snapshot) SignedPayload(signer Signer) ([]byte, error) { + return signer.Sign(s.Payload()) +} + func (s *Snapshot) FromPayload(payload []byte) error { r := bytes.NewBuffer(payload) -- cgit v1.2.3-70-g09d2