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

-- | Ed25519 cryptographic signatures
--   
--   This package provides a simple, fast, self-contained copy of the
--   Ed25519 public-key signature system with a clean interface. It also
--   includes support for detached signatures, and thorough documentation
--   on the design and implementation, including usage guidelines.
@package ed25519
@version 0.0.5.0

-- | This module provides bindings to the Ed25519 public-key signature
--   system, including detached signatures. The documentation should be
--   self explanatory with complete examples.
--   
--   Below the basic documentation you'll find API, performance and
--   security notes, which you may want to read carefully before
--   continuing. (Nonetheless, Ed25519 is one of the
--   easiest-to-use signature systems around, and is simple to get started
--   with for building more complex protocols. But the below details are
--   highly educational and should help adjust your expectations properly.)
--   
--   For more reading on the underlying implementation and theory
--   (including how to get a copy of the Ed25519 software), visit
--   http://ed25519.cr.yp.to. There are two papers that discuss the
--   design of EdDSA/Ed25519 in detail:
--   
--   
--   
- "High-speed high-security signatures" - The original
--   specification by Bernstein, Duif, Lange, Schwabe, and Yang.
--   
- "EdDSA for more curves" - An extension of the original
--   EdDSA specification allowing it to be used with more curves (such as
--   Ed41417, or Ed488), as well as defining the support for message
--   prehashing. The original EdDSA is easily derived from the extended
--   version through a few parameter defaults. (This package won't consider
--   non-Ed25519 EdDSA systems any further.)
--   
module Crypto.Sign.Ed25519

-- | A PublicKey created by createKeypair.
newtype PublicKey
PublicKey :: ByteString -> PublicKey

-- | Unwrapper for getting the raw ByteString in a
--   PublicKey. In general you should not make any
--   assumptions about the underlying blob; this is only provided for
--   interoperability.
[unPublicKey] :: PublicKey -> ByteString

-- | A SecretKey created by createKeypair.
--   Be sure to keep this safe!
newtype SecretKey
SecretKey :: ByteString -> SecretKey

-- | Unwrapper for getting the raw ByteString in a
--   SecretKey. In general you should not make any
--   assumptions about the underlying blob; this is only provided for
--   interoperability.
[unSecretKey] :: SecretKey -> ByteString

-- | Randomly generate a SecretKey and
--   PublicKey for doing authenticated signing and
--   verification. This essentically calls
--   createKeypairFromSeed_ with a randomly generated
--   32-byte seed, the source of which is operating-system dependent (see
--   security notes below). However, internally it is implemented more
--   efficiently (with less allocations and copies).
--   
--   If you wish to use your own seed (for design purposes so you may
--   recreate keys, due to high paranoia, or because you have your own
--   source of randomness), please use
--   createKeypairFromSeed_ instead.
createKeypair :: IO (PublicKey, SecretKey)

-- | Generate a deterministic PublicKey and
--   SecretKey from a given 32-byte seed, allowing you to
--   recreate a keypair at any point in time, providing you have the seed
--   available.
--   
--   If the input seed is not 32 bytes in length,
--   createKeypairFromSeed_ returns
--   Nothing. Otherwise, it always returns Just
--   (pk, sk) for the given seed.
--   
--   NOTE: This function will replace
--   createKeypairFromSeed in the future.
createKeypairFromSeed_ :: ByteString -> Maybe (PublicKey, SecretKey)

-- | Generate a deterministic PublicKey and
--   SecretKey from a given 32-byte seed, allowing you to
--   recreate a keypair at any point in time, providing you have the seed
--   available.
--   
--   Note that this will error if the given input is not 32
--   bytes in length, so you must be careful with this input.

-- | Deprecated: This function is unsafe as it can fail
--   with an invalid input. Use createKeypairWithSeed_
--   instead.
createKeypairFromSeed :: ByteString -> (PublicKey, SecretKey)

-- | Derive the PublicKey for a given
--   SecretKey. This is a convenience which allows (for
--   example) using createKeypair and only ever storing the
--   returned SecretKey for any future operations.
toPublicKey :: SecretKey -> PublicKey

-- | Sign a message with a particular SecretKey. Note that
--   the resulting signed message contains both the message itself, and the
--   signature attached. If you only want the signature of a given input
--   string, please see dsign.
sign :: SecretKey -> ByteString -> ByteString

-- | Verifies a signed message against a PublicKey. Note
--   that the input message must be generated by sign (that
--   is, it is the message itself plus its signature). If you want to
--   verify an arbitrary signature against an arbitrary message, please see
--   dverify.
verify :: PublicKey -> ByteString -> Bool

-- | A Signature which is detached from the message it
--   signed.
newtype Signature
Signature :: ByteString -> Signature

-- | Unwrapper for getting the raw ByteString in a
--   Signature. In general you should not make any
--   assumptions about the underlying blob; this is only provided for
--   interoperability.
[unSignature] :: Signature -> ByteString

-- | Sign a message with a particular SecretKey, only
--   returning the Signature without the message.
dsign :: SecretKey -> ByteString -> Signature

-- | Verify a message with a detached Signature against a
--   given PublicKey.
dverify :: PublicKey -> ByteString -> Signature -> Bool

-- | Sign a message with a particular SecretKey, only
--   returning the Signature without the message. Simply an
--   alias for dsign.

-- | Deprecated: sign' will be removed in a future
--   release; use dsign instead.
sign' :: SecretKey -> ByteString -> Signature

-- | Verify a message with a detached Signature against a
--   given PublicKey. Simply an alias for
--   dverify.

-- | Deprecated: verify' will be removed in a future
--   release; use dverify instead.
verify' :: PublicKey -> ByteString -> Signature -> Bool
instance GHC.Generics.Selector Crypto.Sign.Ed25519.S1_0_0PublicKey
instance GHC.Generics.Constructor Crypto.Sign.Ed25519.C1_0PublicKey
instance GHC.Generics.Datatype Crypto.Sign.Ed25519.D1PublicKey
instance GHC.Generics.Selector Crypto.Sign.Ed25519.S1_0_0SecretKey
instance GHC.Generics.Constructor Crypto.Sign.Ed25519.C1_0SecretKey
instance GHC.Generics.Datatype Crypto.Sign.Ed25519.D1SecretKey
instance GHC.Generics.Selector Crypto.Sign.Ed25519.S1_0_0Signature
instance GHC.Generics.Constructor Crypto.Sign.Ed25519.C1_0Signature
instance GHC.Generics.Datatype Crypto.Sign.Ed25519.D1Signature
instance GHC.Classes.Ord Crypto.Sign.Ed25519.Signature
instance GHC.Show.Show Crypto.Sign.Ed25519.Signature
instance GHC.Classes.Eq Crypto.Sign.Ed25519.Signature
instance GHC.Classes.Ord Crypto.Sign.Ed25519.SecretKey
instance GHC.Show.Show Crypto.Sign.Ed25519.SecretKey
instance GHC.Classes.Eq Crypto.Sign.Ed25519.SecretKey
instance GHC.Classes.Ord Crypto.Sign.Ed25519.PublicKey
instance GHC.Show.Show Crypto.Sign.Ed25519.PublicKey
instance GHC.Classes.Eq Crypto.Sign.Ed25519.PublicKey
instance GHC.Generics.Generic Crypto.Sign.Ed25519.PublicKey
instance GHC.Generics.Generic Crypto.Sign.Ed25519.SecretKey
instance GHC.Generics.Generic Crypto.Sign.Ed25519.Signature
