diff options
author | Joey Hess <joey@kitenet.net> | 2012-09-11 12:26:42 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-09-11 12:26:42 -0400 |
commit | 16d27e9c023231dcf80923d72633c80dbd91116e (patch) | |
tree | 76bc9acd1b735da1fde1c0796146cc774d0928a5 /Assistant/Pairing.hs | |
parent | 91edb58d326e59a34c0457c3ea619a1a7953f54f (diff) |
work around a bug in Yesod
The PathPiece instance for Text results in a 404 for T.empty.
Diffstat (limited to 'Assistant/Pairing.hs')
-rw-r--r-- | Assistant/Pairing.hs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Assistant/Pairing.hs b/Assistant/Pairing.hs index de69d8410..ca0cc2f39 100644 --- a/Assistant/Pairing.hs +++ b/Assistant/Pairing.hs @@ -13,6 +13,8 @@ import Assistant.Ssh import Control.Concurrent import Network.Socket +import Data.Char +import qualified Data.Text as T data PairStage {- "I'll pair with anybody who shares the secret that can be used @@ -68,3 +70,14 @@ data PairingInProgress = PairingInProgress data SomeAddr = IPv4Addr HostAddress | IPv6Addr HostAddress6 deriving (Ord, Eq, Read, Show) + +{- This contains the whole secret, just lightly obfuscated to make it not + - too obvious. It's only displayed in the user's web browser. -} +data SecretReminder = SecretReminder [Int] + deriving (Show, Eq, Ord, Read) + +toSecretReminder :: T.Text -> SecretReminder +toSecretReminder = SecretReminder . map ord . T.unpack + +fromSecretReminder :: SecretReminder -> T.Text +fromSecretReminder (SecretReminder s) = T.pack $ map chr s |