-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Fast implementations of the curve25519 elliptic curve primitives.
--   
--   Haskell bindings and extensions to the curve25519-donna codebase. This
--   module is a pretty straightforward implementation of the basic
--   cryptographic routines you'd want from a project that uses curve25519:
--   key generation, and key agreement. For further functionality, you'll
--   want to look elsewhere.
@package curve25519
@version 0.2.8

-- | An implementation of the core methods of the elliptic curve Curve25519
--   suite. These functions are largely wrappers over the curve25519-donna
--   library from Google. While this version is theoretically pure, in that
--   it doesn't generate any exceptions, you should be warned that it uses
--   unsafePerformIO under the hood.
module Crypto.Curve25519.Pure

-- | The type of a Curve25519 private key.
data PrivateKey

-- | The type of a Curve25519 public key.
data PublicKey

-- | Import a public key from a ByteString. The ByteString
--   must be exactly 32 bytes long for this to work.
importPublic :: ByteString -> Maybe PublicKey

-- | Export a public key to a ByteString.
exportPublic :: PublicKey -> ByteString

-- | Imports a ByteString to use as private key. The
--   ByteString must be exactly 32 bytes long for this to work.
--   
--   Though minor changes may be made to create a valid key this property
--   is guaranteed: prop> (x -> importPrivate x >>=
--   (importPrivate . exportPrivate)) = importPrivate
importPrivate :: ByteString -> Maybe PrivateKey

-- | Export a private key to a ByteString
exportPrivate :: PrivateKey -> ByteString

-- | Randomly generate a Curve25519 private key.
generatePrivate :: CryptoRandomGen g => g -> Either GenError (PrivateKey, g)

-- | Randomly generate a Curve25519 public key.
generatePublic :: PrivateKey -> PublicKey

-- | Randomly generate a key pair.
generateKeyPair :: CryptoRandomGen g => g -> Either GenError (PrivateKey, PublicKey, g)

-- | Generate a shared secret from a private key and a public key.
makeShared :: PrivateKey -> PublicKey -> ByteString
instance GHC.Internal.Show.Show Crypto.Curve25519.Pure.PrivateKey
instance GHC.Internal.Show.Show Crypto.Curve25519.Pure.PublicKey

-- | An implementation of the core methods of the elliptic curve Curve25519
--   suite. These functions are largely wrappers over the curve25519-donna
--   library from Google. Note that those functions that utilize a
--   CryptoRandomGen instance may throw a GenError exception if the
--   generator fails for any reason.
module Crypto.Curve25519.Exceptions

-- | The type of a Curve25519 private key.
data PrivateKey

-- | The type of a Curve25519 public key.
data PublicKey

-- | Import a public key from a ByteString. The ByteString must be exactly
--   32 bytes long for this to work.
importPublic :: ByteString -> Maybe PublicKey

-- | Export a public key to a ByteString.
exportPublic :: PublicKey -> ByteString

-- | Randomly generate a Curve25519 private key.
generatePrivate :: CryptoRandomGen g => g -> (PrivateKey, g)

-- | Randomly generate a Curve25519 public key.
generatePublic :: PrivateKey -> PublicKey

-- | Randomly generate a key pair.
generateKeyPair :: CryptoRandomGen g => g -> (PrivateKey, PublicKey, g)

-- | Generate a shared secret from a private key and a public key.
makeShared :: PrivateKey -> PublicKey -> ByteString

module Crypto.Curve25519
