summaryrefslogtreecommitdiffhomepage
path: root/ProtocolBuffers.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2017-05-04 14:02:37 -0400
committerJoey Hess <joeyh@joeyh.name>2017-05-04 14:02:37 -0400
commit0aebedadd392e495ffc8f7c2fa74d712f16c2d7d (patch)
tree8f6af2ccc4e9bc4526ea8b8bf09bdfda327d9fdb /ProtocolBuffers.hs
parent2cd4c53ece2d935b044c65802824810eb712b1c2 (diff)
downloaddebug-me-0aebedadd392e495ffc8f7c2fa74d712f16c2d7d.tar.gz
include gpg public key export in GpgSigned
This makes debug-me not rely on the gpg keyservers at all. Before, it was only working when the user had the developer's public key already. I thought that --verify would download from --keyserver, but seems not. This is a protocol breaking change! Luckily done before any release, so ok. ProtocolBuffers renumbered. This commit was sponsored by Denis Dzyubenko on Patreon.
Diffstat (limited to 'ProtocolBuffers.hs')
-rw-r--r--ProtocolBuffers.hs62
1 files changed, 38 insertions, 24 deletions
diff --git a/ProtocolBuffers.hs b/ProtocolBuffers.hs
index 2d59528..42d3e0b 100644
--- a/ProtocolBuffers.hs
+++ b/ProtocolBuffers.hs
@@ -48,49 +48,50 @@ data MessageP a
data ActivityP a = ActivityP
{ activityP :: Required 6 (Message a)
- , elapsedTimeP :: Required 8 (Message ElapsedTimeP)
- , activitySignatureP :: Required 9 (Message SignatureP)
+ , elapsedTimeP :: Required 7 (Message ElapsedTimeP)
+ , activitySignatureP :: Required 8 (Message SignatureP)
}
deriving (Generic)
data ControlP = ControlP
- { controlP :: Required 10 (Message ControlActionP)
- , controlSignatureP ::Required 11 (Message SignatureP)
+ { controlP :: Required 9 (Message ControlActionP)
+ , controlSignatureP ::Required 10 (Message SignatureP)
}
deriving (Generic)
data ControlActionP
= EnteredRejectedP
- { enteredRejectedP :: Required 12 (Message HashP)
- , enteredLastAcceptedP :: Optional 13 (Message HashP)
+ { enteredRejectedP :: Required 11 (Message HashP)
+ , enteredLastAcceptedP :: Optional 12 (Message HashP)
}
| SessionKeyP
- { sessionKeyP :: Required 14 (Message (PerhapsSignedP PublicKeyP)) }
+ { sessionKeyP :: Required 13 (Message (PerhapsSignedP PublicKeyP)) }
| SessionKeyAcceptedP
- { sessionKeyAcceptedP :: Required 15 (Message PublicKeyP) }
+ { sessionKeyAcceptedP :: Required 14 (Message PublicKeyP) }
| SessionKeyRejectedP
- { sessionKeyRejectedP :: Required 16 (Message PublicKeyP) }
+ { sessionKeyRejectedP :: Required 15 (Message PublicKeyP) }
| ChatMessageP
- { chatMessageSenderName :: Required 17 (Value B.ByteString)
- , chatMessage :: Required 18 (Value B.ByteString)
+ { chatMessageSenderName :: Required 16 (Value B.ByteString)
+ , chatMessage :: Required 17 (Value B.ByteString)
}
deriving (Generic)
data SignatureP
= Ed25519SignatureP
- { ed25519SignatureP :: Required 19 (Value B.ByteString) }
+ { ed25519SignatureP :: Required 18 (Value B.ByteString) }
| OtherSignatureP
- { otherSignatureP :: Required 20 (Value B.ByteString) }
+ { otherSignatureP :: Required 19 (Value B.ByteString) }
deriving (Generic)
data PublicKeyP = PublicKeyP
- { mkPublicKeyP :: Required 21 (Value B.ByteString) }
+ { mkPublicKeyP :: Required 20 (Value B.ByteString) }
deriving (Generic)
data PerhapsSignedP a
= GpgSignedP
- { gpgSignedValP :: Required 22 (Message a)
- , gpgSigP :: Required 23 (Message GpgSigP)
+ { gpgSignedValP :: Required 21 (Message a)
+ , gpgSigP :: Required 22 (Message GpgSigP)
+ , gpgKeyExportP :: Required 23 (Message GpgKeyExportP)
}
| UnSignedP
{ mkUnSignedP :: Required 24 (Message a )
@@ -101,24 +102,28 @@ data GpgSigP = GpgSigP
{ mkGpgSigP :: Required 25 (Value B.ByteString) }
deriving (Generic)
+data GpgKeyExportP = GpgKeyExportP
+ { mkGpgKeyExportP :: Required 26 (Value B.ByteString) }
+ deriving (Generic)
+
data ElapsedTimeP = ElapsedTimeP
- { mkElapsedTimeP :: Required 26 (Value Double) }
+ { mkElapsedTimeP :: Required 27 (Value Double) }
deriving (Generic)
data AnyMessageP
- = UserP { mkUserP :: Required 27 (Message (MessageP SeenP)) }
- | DeveloperP { mkDeveloperP :: Required 28 (Message (MessageP EnteredP)) }
+ = UserP { mkUserP :: Required 28 (Message (MessageP SeenP)) }
+ | DeveloperP { mkDeveloperP :: Required 29 (Message (MessageP EnteredP)) }
deriving (Generic)
data HashP = HashP
- { hashMethodP :: Required 29 (Message HashMethodP)
- , hashValueP :: Required 30 (Value B.ByteString)
+ { hashMethodP :: Required 30 (Message HashMethodP)
+ , hashValueP :: Required 31 (Value B.ByteString)
}
deriving (Generic)
data HashMethodP
- = SHA512P { mkSHA512P :: Required 31 (Value Bool) }
- | SHA3P { mkSHA3P :: Required 32 (Value Bool) }
+ = SHA512P { mkSHA512P :: Required 32 (Value Bool) }
+ | SHA3P { mkSHA3P :: Required 33 (Value Bool) }
deriving (Generic)
-- | Conversion between protocol buffer messages and debug-me's main Types.
@@ -241,9 +246,10 @@ instance ProtocolBuffer PublicKeyP T.PublicKey where
fromProtocolBuffer p = T.PublicKey $ Val $ getField $ mkPublicKeyP p
instance ProtocolBuffer p t => ProtocolBuffer (PerhapsSignedP p) (T.PerhapsSigned t) where
- toProtocolBuffer (T.GpgSigned tv tg) = GpgSignedP
+ toProtocolBuffer (T.GpgSigned tv tg tk) = GpgSignedP
{ gpgSignedValP = putField $ toProtocolBuffer tv
, gpgSigP = putField $ toProtocolBuffer tg
+ , gpgKeyExportP = putField $ toProtocolBuffer tk
}
toProtocolBuffer (T.UnSigned tv) = UnSignedP
{ mkUnSignedP = putField $ toProtocolBuffer tv
@@ -251,6 +257,7 @@ instance ProtocolBuffer p t => ProtocolBuffer (PerhapsSignedP p) (T.PerhapsSigne
fromProtocolBuffer p@(GpgSignedP {}) = T.GpgSigned
(fromProtocolBuffer $ getField $ gpgSignedValP p)
(fromProtocolBuffer $ getField $ gpgSigP p)
+ (fromProtocolBuffer $ getField $ gpgKeyExportP p)
fromProtocolBuffer p@(UnSignedP {}) = T.UnSigned
(fromProtocolBuffer $ getField $ mkUnSignedP p)
@@ -259,6 +266,11 @@ instance ProtocolBuffer GpgSigP T.GpgSig where
{ mkGpgSigP = putField ( val t) }
fromProtocolBuffer p = T.GpgSig $ Val $ getField $ mkGpgSigP p
+instance ProtocolBuffer GpgKeyExportP T.GpgKeyExport where
+ toProtocolBuffer (T.GpgKeyExport t) = GpgKeyExportP
+ { mkGpgKeyExportP = putField ( val t) }
+ fromProtocolBuffer p = T.GpgKeyExport $ Val $ getField $ mkGpgKeyExportP p
+
instance ProtocolBuffer ElapsedTimeP T.ElapsedTime where
toProtocolBuffer (T.ElapsedTime t) = ElapsedTimeP
{ mkElapsedTimeP = putField t }
@@ -292,6 +304,8 @@ instance Encode PublicKeyP
instance Decode PublicKeyP
instance Encode GpgSigP
instance Decode GpgSigP
+instance Encode GpgKeyExportP
+instance Decode GpgKeyExportP
instance Encode ElapsedTimeP
instance Decode ElapsedTimeP
instance Encode AnyMessageP