aboutsummaryrefslogtreecommitdiff
path: root/objects
diff options
context:
space:
mode:
authorLaria Carolin Chabowski <laria@laria.me>2017-07-25 08:05:53 +0200
committerLaria Carolin Chabowski <laria@laria.me>2017-08-02 08:01:22 +0200
commit8c43d2969eaa4404675252480befa0642fca5dc4 (patch)
treebc950c93aba8d10f0025f8fd7386be7574c16c90 /objects
parent9670737ae3fe9be30bd94ac51206160ce18f51a0 (diff)
downloadpetrific-8c43d2969eaa4404675252480befa0642fca5dc4.tar.gz
petrific-8c43d2969eaa4404675252480befa0642fca5dc4.tar.bz2
petrific-8c43d2969eaa4404675252480befa0642fca5dc4.zip
Add API for snapshot signing
Diffstat (limited to 'objects')
-rw-r--r--objects/object_snapshot.go8
1 files changed, 8 insertions, 0 deletions
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)