-- 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, <tt>Ed25519</tt> 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
--   <a>http://ed25519.cr.yp.to</a>. There are two papers that discuss the
--   design of EdDSA/Ed25519 in detail:
--   
--   <ul>
--   <li><a>"High-speed high-security signatures"</a> - The original
--   specification by Bernstein, Duif, Lange, Schwabe, and Yang.</li>
--   <li><a>"EdDSA for more curves"</a> - 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 <b>message
--   prehashing</b>. 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.)</li>
--   </ul>
module Crypto.Sign.Ed25519

-- | A <tt><a>PublicKey</a></tt> created by <tt><a>createKeypair</a></tt>.
newtype PublicKey
PublicKey :: ByteString -> PublicKey

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

-- | A <tt><a>SecretKey</a></tt> created by <tt><a>createKeypair</a></tt>.
--   <b>Be sure to keep this</b> <b>safe!</b>
newtype SecretKey
SecretKey :: ByteString -> SecretKey

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

-- | Randomly generate a <tt><a>SecretKey</a></tt> and
--   <tt><a>PublicKey</a></tt> for doing authenticated signing and
--   verification. This essentically calls
--   <tt><a>createKeypairFromSeed_</a></tt> 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
--   <tt><a>createKeypairFromSeed_</a></tt> instead.
createKeypair :: IO (PublicKey, SecretKey)

-- | Generate a deterministic <tt><a>PublicKey</a></tt> and
--   <tt><a>SecretKey</a></tt> 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,
--   <tt><a>createKeypairFromSeed_</a></tt> returns
--   <tt><a>Nothing</a></tt>. Otherwise, it always returns <tt><a>Just</a>
--   (pk, sk)</tt> for the given seed.
--   
--   <b><i>NOTE</i></b>: This function will replace
--   <tt><a>createKeypairFromSeed</a></tt> in the future.
createKeypairFromSeed_ :: ByteString -> Maybe (PublicKey, SecretKey)

-- | Generate a deterministic <tt><a>PublicKey</a></tt> and
--   <tt><a>SecretKey</a></tt> 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 <tt><a>error</a></tt> if the given input is not 32
--   bytes in length, so you must be careful with this input.

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

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

-- | Sign a message with a particular <tt><a>SecretKey</a></tt>. 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 <tt><a>dsign</a></tt>.
sign :: SecretKey -> ByteString -> ByteString

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

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

-- | Unwrapper for getting the raw <tt><a>ByteString</a></tt> in a
--   <tt><a>Signature</a></tt>. 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 <tt><a>SecretKey</a></tt>, only
--   returning the <tt><a>Signature</a></tt> without the message.
dsign :: SecretKey -> ByteString -> Signature

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

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

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

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

-- | <i>Deprecated: <tt><a>verify'</a></tt> will be removed in a future
--   release; use <tt><a>dverify</a></tt> instead.</i>
verify' :: PublicKey -> ByteString -> Signature -> Bool
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
