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


-- | Bindings for secp256k1 library from Bitcoin Core
--   
--   Please see README.md
@package secp256k1
@version 0.5.2


-- | The API for this module may change at any time. This is an internal
--   module only exposed for hacking and experimentation.
module Crypto.Secp256k1.Internal
data Ctx
Ctx :: Ctx
newtype PubKey64
PubKey64 :: ShortByteString -> PubKey64
[getPubKey64] :: PubKey64 -> ShortByteString
newtype Msg32
Msg32 :: ShortByteString -> Msg32
[getMsg32] :: Msg32 -> ShortByteString
newtype Sig64
Sig64 :: ShortByteString -> Sig64
[getSig64] :: Sig64 -> ShortByteString
data CompactSig
CompactSig :: !ShortByteString -> !ShortByteString -> CompactSig
[getCompactSigR] :: CompactSig -> !ShortByteString
[getCompactSigS] :: CompactSig -> !ShortByteString
newtype RecSig65
RecSig65 :: ShortByteString -> RecSig65
[getRecSig65] :: RecSig65 -> ShortByteString
data CompactRecSig
CompactRecSig :: !ShortByteString -> !ShortByteString -> !Word8 -> CompactRecSig
[getCompactRecSigR] :: CompactRecSig -> !ShortByteString
[getCompactRecSigS] :: CompactRecSig -> !ShortByteString
[getCompactRecSigV] :: CompactRecSig -> !Word8
newtype Seed32
Seed32 :: ShortByteString -> Seed32
[getSeed32] :: Seed32 -> ShortByteString
newtype SecKey32
SecKey32 :: ShortByteString -> SecKey32
[getSecKey32] :: SecKey32 -> ShortByteString
newtype Tweak32
Tweak32 :: ShortByteString -> Tweak32
[getTweak32] :: Tweak32 -> ShortByteString
newtype Nonce32
Nonce32 :: ShortByteString -> Nonce32
[getNonce32] :: Nonce32 -> ShortByteString
newtype Algo16
Algo16 :: ShortByteString -> Algo16
[getAlgo16] :: Algo16 -> ShortByteString
newtype CtxFlags
CtxFlags :: CUInt -> CtxFlags
[getCtxFlags] :: CtxFlags -> CUInt
newtype SerFlags
SerFlags :: CUInt -> SerFlags
[getSerFlags] :: SerFlags -> CUInt
newtype Ret
Ret :: CInt -> Ret
[getRet] :: Ret -> CInt

-- | Nonce32-generating function
type NonceFunction a = Ptr Nonce32 -> Ptr Msg32 -> Ptr SecKey32 -> Ptr Algo16 -> Ptr a  extra data -> CUInt  attempt -> Ret
verify :: CtxFlags
sign :: CtxFlags
signVerify :: CtxFlags
compressed :: SerFlags
uncompressed :: SerFlags
useByteString :: ByteString -> ((Ptr CUChar, CSize) -> IO a) -> IO a
packByteString :: (Ptr CUChar, CSize) -> IO ByteString
isSuccess :: Ret -> Bool
fctx :: ForeignPtr Ctx
withContext :: (Ptr Ctx -> IO a) -> a
contextCreate :: CtxFlags -> IO (Ptr Ctx)
contextClone :: Ptr Ctx -> IO (Ptr Ctx)
contextDestroy :: FunPtr (Ptr Ctx -> IO ())
setIllegalCallback :: Ptr Ctx -> FunPtr (CString -> Ptr a -> IO ()) -> Ptr a -> IO ()
setErrorCallback :: Ptr Ctx -> FunPtr (CString -> Ptr a -> IO ()) -> Ptr a -> IO ()
ecPubKeyParse :: Ptr Ctx -> Ptr PubKey64 -> Ptr CUChar -> CSize -> IO Ret
ecPubKeySerialize :: Ptr Ctx -> Ptr CUChar -> Ptr CSize -> Ptr PubKey64 -> SerFlags -> IO Ret
ecdsaSignatureParseCompact :: Ptr Ctx -> Ptr Sig64 -> Ptr CompactSig -> IO Ret
ecdsaSignatureParseDer :: Ptr Ctx -> Ptr Sig64 -> Ptr CUChar -> CSize -> IO Ret
ecdsaSignatureSerializeDer :: Ptr Ctx -> Ptr CUChar -> Ptr CSize -> Ptr Sig64 -> IO Ret
ecdsaSignatureSerializeCompact :: Ptr Ctx -> Ptr CompactSig -> Ptr Sig64 -> IO Ret
ecdsaVerify :: Ptr Ctx -> Ptr Sig64 -> Ptr Msg32 -> Ptr PubKey64 -> IO Ret
ecdsaSignatureNormalize :: Ptr Ctx -> Ptr Sig64 -> Ptr Sig64 -> IO Ret
laxDerParse :: Ptr Ctx -> Ptr Sig64 -> Ptr CUChar -> CSize -> IO Ret
ecdsaSign :: Ptr Ctx -> Ptr Sig64 -> Ptr Msg32 -> Ptr SecKey32 -> FunPtr (NonceFunction a) -> Ptr a -> IO Ret
ecSecKeyVerify :: Ptr Ctx -> Ptr SecKey32 -> IO Ret
ecPubKeyCreate :: Ptr Ctx -> Ptr PubKey64 -> Ptr SecKey32 -> IO Ret
ecSecKeyTweakAdd :: Ptr Ctx -> Ptr SecKey32 -> Ptr Tweak32 -> IO Ret
ecPubKeyTweakAdd :: Ptr Ctx -> Ptr PubKey64 -> Ptr Tweak32 -> IO Ret
ecSecKeyTweakMul :: Ptr Ctx -> Ptr SecKey32 -> Ptr Tweak32 -> IO Ret
ecPubKeyTweakMul :: Ptr Ctx -> Ptr PubKey64 -> Ptr Tweak32 -> IO Ret
contextRandomize :: Ptr Ctx -> Ptr Seed32 -> IO Ret
ecPubKeyCombine :: Ptr Ctx -> Ptr PubKey64 -> Ptr (Ptr PubKey64) -> CInt -> IO Ret
ecdsaRecoverableSignatureParseCompact :: Ptr Ctx -> Ptr RecSig65 -> Ptr CompactSig -> CInt -> IO Ret
ecdsaRecoverableSignatureConvert :: Ptr Ctx -> Ptr Sig64 -> Ptr RecSig65 -> IO Ret
ecdsaRecoverableSignatureSerializeCompact :: Ptr Ctx -> Ptr CompactSig -> Ptr CInt -> Ptr RecSig65 -> IO Ret
ecdsaSignRecoverable :: Ptr Ctx -> Ptr RecSig65 -> Ptr Msg32 -> Ptr SecKey32 -> FunPtr (NonceFunction a) -> Ptr a -> IO Ret
ecdsaRecover :: Ptr Ctx -> Ptr PubKey64 -> Ptr RecSig65 -> Ptr Msg32 -> IO Ret
instance GHC.Classes.Ord Crypto.Secp256k1.Internal.Ret
instance GHC.Classes.Eq Crypto.Secp256k1.Internal.Ret
instance GHC.Show.Show Crypto.Secp256k1.Internal.Ret
instance GHC.Read.Read Crypto.Secp256k1.Internal.Ret
instance GHC.Classes.Ord Crypto.Secp256k1.Internal.SerFlags
instance GHC.Classes.Eq Crypto.Secp256k1.Internal.SerFlags
instance GHC.Show.Show Crypto.Secp256k1.Internal.SerFlags
instance GHC.Read.Read Crypto.Secp256k1.Internal.SerFlags
instance GHC.Classes.Ord Crypto.Secp256k1.Internal.CtxFlags
instance GHC.Classes.Eq Crypto.Secp256k1.Internal.CtxFlags
instance GHC.Show.Show Crypto.Secp256k1.Internal.CtxFlags
instance GHC.Read.Read Crypto.Secp256k1.Internal.CtxFlags
instance GHC.Classes.Ord Crypto.Secp256k1.Internal.Algo16
instance GHC.Classes.Eq Crypto.Secp256k1.Internal.Algo16
instance GHC.Show.Show Crypto.Secp256k1.Internal.Algo16
instance GHC.Read.Read Crypto.Secp256k1.Internal.Algo16
instance GHC.Classes.Ord Crypto.Secp256k1.Internal.Nonce32
instance GHC.Classes.Eq Crypto.Secp256k1.Internal.Nonce32
instance GHC.Show.Show Crypto.Secp256k1.Internal.Nonce32
instance GHC.Read.Read Crypto.Secp256k1.Internal.Nonce32
instance GHC.Classes.Ord Crypto.Secp256k1.Internal.Tweak32
instance GHC.Classes.Eq Crypto.Secp256k1.Internal.Tweak32
instance GHC.Show.Show Crypto.Secp256k1.Internal.Tweak32
instance GHC.Read.Read Crypto.Secp256k1.Internal.Tweak32
instance GHC.Classes.Ord Crypto.Secp256k1.Internal.SecKey32
instance GHC.Classes.Eq Crypto.Secp256k1.Internal.SecKey32
instance GHC.Show.Show Crypto.Secp256k1.Internal.SecKey32
instance GHC.Read.Read Crypto.Secp256k1.Internal.SecKey32
instance GHC.Classes.Ord Crypto.Secp256k1.Internal.Seed32
instance GHC.Classes.Eq Crypto.Secp256k1.Internal.Seed32
instance GHC.Show.Show Crypto.Secp256k1.Internal.Seed32
instance GHC.Read.Read Crypto.Secp256k1.Internal.Seed32
instance GHC.Classes.Ord Crypto.Secp256k1.Internal.CompactRecSig
instance GHC.Classes.Eq Crypto.Secp256k1.Internal.CompactRecSig
instance GHC.Show.Show Crypto.Secp256k1.Internal.CompactRecSig
instance GHC.Classes.Ord Crypto.Secp256k1.Internal.RecSig65
instance GHC.Classes.Eq Crypto.Secp256k1.Internal.RecSig65
instance GHC.Show.Show Crypto.Secp256k1.Internal.RecSig65
instance GHC.Read.Read Crypto.Secp256k1.Internal.RecSig65
instance GHC.Classes.Ord Crypto.Secp256k1.Internal.CompactSig
instance GHC.Classes.Eq Crypto.Secp256k1.Internal.CompactSig
instance GHC.Show.Show Crypto.Secp256k1.Internal.CompactSig
instance GHC.Classes.Ord Crypto.Secp256k1.Internal.Sig64
instance GHC.Classes.Eq Crypto.Secp256k1.Internal.Sig64
instance GHC.Show.Show Crypto.Secp256k1.Internal.Sig64
instance GHC.Read.Read Crypto.Secp256k1.Internal.Sig64
instance GHC.Classes.Ord Crypto.Secp256k1.Internal.Msg32
instance GHC.Classes.Eq Crypto.Secp256k1.Internal.Msg32
instance GHC.Show.Show Crypto.Secp256k1.Internal.Msg32
instance GHC.Read.Read Crypto.Secp256k1.Internal.Msg32
instance GHC.Classes.Ord Crypto.Secp256k1.Internal.PubKey64
instance GHC.Classes.Eq Crypto.Secp256k1.Internal.PubKey64
instance GHC.Show.Show Crypto.Secp256k1.Internal.PubKey64
instance GHC.Read.Read Crypto.Secp256k1.Internal.PubKey64
instance Foreign.Storable.Storable Crypto.Secp256k1.Internal.Algo16
instance Foreign.Storable.Storable Crypto.Secp256k1.Internal.Nonce32
instance Foreign.Storable.Storable Crypto.Secp256k1.Internal.Tweak32
instance Foreign.Storable.Storable Crypto.Secp256k1.Internal.SecKey32
instance Foreign.Storable.Storable Crypto.Secp256k1.Internal.Seed32
instance Foreign.Storable.Storable Crypto.Secp256k1.Internal.CompactRecSig
instance Data.Serialize.Serialize Crypto.Secp256k1.Internal.CompactRecSig
instance Foreign.Storable.Storable Crypto.Secp256k1.Internal.RecSig65
instance Foreign.Storable.Storable Crypto.Secp256k1.Internal.CompactSig
instance Data.Serialize.Serialize Crypto.Secp256k1.Internal.CompactSig
instance Foreign.Storable.Storable Crypto.Secp256k1.Internal.Sig64
instance Foreign.Storable.Storable Crypto.Secp256k1.Internal.Msg32
instance Foreign.Storable.Storable Crypto.Secp256k1.Internal.PubKey64


-- | Crytpographic functions from Bitcoin’s secp256k1 library.
module Crypto.Secp256k1
data Msg

-- | Import 32-byte <a>ByteString</a> as <a>Msg</a>.
msg :: ByteString -> Maybe Msg

-- | Get 32-byte message.
getMsg :: Msg -> ByteString
data SecKey

-- | Import 32-byte <a>ByteString</a> as <a>SecKey</a>.
secKey :: ByteString -> Maybe SecKey

-- | Get 32-byte secret key.
getSecKey :: SecKey -> ByteString
derivePubKey :: SecKey -> PubKey
data PubKey

-- | Import DER-encoded public key.
importPubKey :: ByteString -> Maybe PubKey

-- | Encode public key as DER. First argument <a>True</a> for compressed
--   output.
exportPubKey :: Bool -> PubKey -> ByteString
data Sig
signMsg :: SecKey -> Msg -> Sig

-- | Verify message signature. <a>True</a> means that the signature is
--   correct.
verifySig :: PubKey -> Sig -> Msg -> Bool

-- | Convert signature to a normalized lower-S form. Boolean value
--   <a>True</a> indicates that the signature changed, <a>False</a>
--   indicates that it was already normal.
normalizeSig :: Sig -> (Sig, Bool)

-- | Import DER-encoded signature.
importSig :: ByteString -> Maybe Sig

-- | Relaxed DER parsing. Allows certain DER errors and violations.
laxImportSig :: ByteString -> Maybe Sig

-- | Encode signature as strict DER.
exportSig :: Sig -> ByteString
data CompactSig
CompactSig :: !ShortByteString -> !ShortByteString -> CompactSig
[getCompactSigR] :: CompactSig -> !ShortByteString
[getCompactSigS] :: CompactSig -> !ShortByteString
exportCompactSig :: Sig -> CompactSig
importCompactSig :: CompactSig -> Maybe Sig
data RecSig
data CompactRecSig
CompactRecSig :: !ShortByteString -> !ShortByteString -> !Word8 -> CompactRecSig
[getCompactRecSigR] :: CompactRecSig -> !ShortByteString
[getCompactRecSigS] :: CompactRecSig -> !ShortByteString
[getCompactRecSigV] :: CompactRecSig -> !Word8

-- | Parse a compact ECDSA signature (64 bytes + recovery id).
importCompactRecSig :: CompactRecSig -> Maybe RecSig

-- | Serialize an ECDSA signature in compact format (64 bytes + recovery
--   id).
exportCompactRecSig :: RecSig -> CompactRecSig

-- | Convert a recoverable signature into a normal signature.
convertRecSig :: RecSig -> Sig

-- | Create a recoverable ECDSA signature.
signRecMsg :: SecKey -> Msg -> RecSig

-- | Recover an ECDSA public key from a signature.
recover :: RecSig -> Msg -> Maybe PubKey
data Tweak

-- | 32-Byte <a>ByteString</a> as <a>Tweak</a>.
tweak :: ByteString -> Maybe Tweak

-- | Get 32-byte tweak.
getTweak :: Tweak -> ByteString

-- | Add tweak to secret key.
tweakAddSecKey :: SecKey -> Tweak -> Maybe SecKey

-- | Multiply secret key by tweak.
tweakMulSecKey :: SecKey -> Tweak -> Maybe SecKey

-- | Add tweak to public key. Tweak is multiplied first by G to obtain a
--   point.
tweakAddPubKey :: PubKey -> Tweak -> Maybe PubKey

-- | Multiply public key by tweak. Tweak is multiplied first by G to obtain
--   a point.
tweakMulPubKey :: PubKey -> Tweak -> Maybe PubKey

-- | Add multiple public keys together.
combinePubKeys :: [PubKey] -> Maybe PubKey
instance GHC.Read.Read Crypto.Secp256k1.RecSig
instance Data.String.IsString Crypto.Secp256k1.RecSig
instance GHC.Show.Show Crypto.Secp256k1.RecSig
instance GHC.Classes.Eq Crypto.Secp256k1.RecSig
instance GHC.Read.Read Crypto.Secp256k1.Tweak
instance Data.String.IsString Crypto.Secp256k1.Tweak
instance GHC.Show.Show Crypto.Secp256k1.Tweak
instance GHC.Classes.Eq Crypto.Secp256k1.Tweak
instance GHC.Read.Read Crypto.Secp256k1.SecKey
instance Data.String.IsString Crypto.Secp256k1.SecKey
instance GHC.Show.Show Crypto.Secp256k1.SecKey
instance GHC.Classes.Eq Crypto.Secp256k1.SecKey
instance Test.QuickCheck.Arbitrary.Arbitrary Crypto.Secp256k1.SecKey
instance GHC.Read.Read Crypto.Secp256k1.Sig
instance Data.String.IsString Crypto.Secp256k1.Sig
instance GHC.Show.Show Crypto.Secp256k1.Sig
instance GHC.Classes.Eq Crypto.Secp256k1.Sig
instance GHC.Read.Read Crypto.Secp256k1.Msg
instance Data.String.IsString Crypto.Secp256k1.Msg
instance GHC.Show.Show Crypto.Secp256k1.Msg
instance GHC.Classes.Eq Crypto.Secp256k1.Msg
instance Test.QuickCheck.Arbitrary.Arbitrary Crypto.Secp256k1.Msg
instance GHC.Read.Read Crypto.Secp256k1.PubKey
instance Data.String.IsString Crypto.Secp256k1.PubKey
instance GHC.Show.Show Crypto.Secp256k1.PubKey
instance GHC.Classes.Eq Crypto.Secp256k1.PubKey
instance Test.QuickCheck.Arbitrary.Arbitrary Crypto.Secp256k1.PubKey
