From 2288820b8a17cf3329b8655c4df1cff63ac735cf Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 12 Apr 2017 15:29:19 -0400 Subject: use Activity types for user<->developer communication Still all in a single process with no serialization, but now there are separate threads for the user and developer sides, and they communicate Activity back and forth. Signatures are not checked yet, but both user and developer check that the other side is sending Activity that forms a valid hash chain with previous Activity. The echo simulation is included, but may be buggy. This seems to work well enough with 0 latency at least. This commit was sponsored by Thom May on Patreon. --- Types.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Types.hs') diff --git a/Types.hs b/Types.hs index c41e30a..3061ba6 100644 --- a/Types.hs +++ b/Types.hs @@ -27,9 +27,13 @@ data Activity a | StartActivity a Signature deriving (Show) +activityContent :: Activity a -> a +activityContent (Activity a _ _) = a +activityContent (StartActivity a _) = a + data Signature = Signature ByteString deriving (Show) -- | A SHA2 hash pointer to something that hashes to this value. newtype HashPointer = HashPointer (H.Digest H.SHA256) - deriving (Show) + deriving (Show, Eq) -- cgit v1.2.3