LeastAuthority/haskell-magic-wormhole

Helpers for JSON mailbox messages

jml opened this issue · 0 comments

jml commented

Lots of mailbox messages (i.e. the bytes in Messages.Body) are JSON encoded. The Magic Wormhole protocol documentation doesn't insist that this is the case, but all extant messages are JSON encoded.

There are some ways we can make this more convenient:

  • A pair of ToBody and FromBody typeclasses

    class ToBody a where
        toBody :: a -> Messages.Body
    
    class FromBody a where
        fromBody :: Messages.Body -> Maybe a
  • sendEncryptedJSON and receiveEncryptedJSON helpers

Probably other ways too.