summaryrefslogtreecommitdiff
path: root/Assistant/Pairing.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Assistant/Pairing.hs')
-rw-r--r--Assistant/Pairing.hs30
1 files changed, 14 insertions, 16 deletions
diff --git a/Assistant/Pairing.hs b/Assistant/Pairing.hs
index ef7b66d5c..f384895bd 100644
--- a/Assistant/Pairing.hs
+++ b/Assistant/Pairing.hs
@@ -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)