yesod skelton and routes for pairing

yet more changes to pairing message data types
This commit is contained in:
Joey Hess 2012-09-08 00:26:47 -04:00
parent 92df8250fa
commit 3bee6b3c74
5 changed files with 70 additions and 16 deletions

View file

@ -12,26 +12,24 @@ import Utility.Verifiable
import Network.Socket (HostName)
{- Messages sent in pairing are all verifiable using a secret that
- should be shared between the systems being paired. -}
type PairMsg = Verifiable (PairStage, HostInfo, SshPubKey)
mkPairMsg :: Secret -> PairStage -> HostInfo -> SshPubKey -> PairMsg
mkPairMsg secret pairstage hostinfo sshkey = mkVerifiable
(pairstage, hostinfo, sshkey) secret
data PairStage
{- "I'd like to pair with somebody who knows a secret.
- Here's my ssh key, and hostinfo." -}
= PairRequest
{- "I've checked your PairRequest, and like it; I set up
- your ssh key already. Here's mine." -}
| PairAck
{- "I'd like to pair with somebody who knows a secret." -}
data PairReq = PairReq (Verifiable PairData)
deriving (Eq, Read, Show)
data HostInfo = HostInfo
{- "I've checked your PairReq, and like it.
- I set up your ssh key already. Here's mine for you to set up." -}
data PairAck = PairAck (Verifiable PairData)
deriving (Eq, Read, Show)
data PairMsg
= PairReqM PairReq
| PairAckM PairAck
deriving (Eq, Read, Show)
data PairData = PairData
{ hostName :: HostName
, userName :: UserName
, sshPubKey :: Maybe SshPubKey
}
deriving (Eq, Read, Show)