server/src/Keys.hs

27 lines
508 B
Haskell

module Keys (
T(..)
, getKeys
, public
, secret
) where
import qualified Crypto.Saltine.Core.SecretBox as Encrypt (Key, newKey)
import qualified Crypto.Saltine.Core.Sign as Sign (
Keypair, PublicKey, SecretKey, newKeypair
)
data T = T {
encrypt :: Encrypt.Key
, sign :: Sign.Keypair
}
getKeys :: IO T
getKeys = do
T <$> Encrypt.newKey <*> Sign.newKeypair
public :: Sign.Keypair -> Sign.PublicKey
public = snd
secret :: Sign.Keypair -> Sign.SecretKey
secret = fst