aboutsummaryrefslogtreecommitdiff
path: root/src/Web/ZeroBin/Utils.hs
blob: 8f29ec4e909ac95ee815ce405a60384a5c1ebe44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
module Web.ZeroBin.Utils (
  toWeb
, makePassword
) where

import Crypto.Random.Entropy (getEntropy)
import Data.ByteString (ByteString)
import Data.ByteString.Base64 (encode)
import Data.ByteString.Char8 (unpack)


toWeb :: ByteString -> String
toWeb = takeWhile (/= '=') . unpack . encode

makePassword :: Int -> IO String
makePassword n = toWeb `fmap` getEntropy n