Safe Haskell | None |
---|---|
Language | Haskell2010 |
Secp256k1 cryptographic primitives.
Synopsis
- newtype PublicKey = PublicKey {}
- data SecretKey
- newtype Signature = Signature {}
- detSecretKey :: ByteString -> SecretKey
- detSecretKeyDo :: MonadRandom m => m SecretKey
- toPublic :: SecretKey -> PublicKey
- publicKeyToBytes :: forall ba. ByteArray ba => PublicKey -> ba
- mkPublicKey :: ByteArrayAccess ba => ba -> Either CryptoParseError PublicKey
- publicKeyLengthBytes :: Integral n => n
- signatureToBytes :: ByteArray ba => Signature -> ba
- mkSignature :: ByteArray ba => ba -> Either CryptoParseError Signature
- signatureLengthBytes :: Integral n => n
- formatPublicKey :: PublicKey -> Text
- mformatPublicKey :: PublicKey -> MText
- parsePublicKey :: Text -> Either CryptoParseError PublicKey
- formatSignature :: Signature -> Text
- mformatSignature :: Signature -> MText
- parseSignature :: Text -> Either CryptoParseError Signature
- formatSecretKey :: SecretKey -> Text
- parseSecretKey :: Text -> Either CryptoParseError SecretKey
- sign :: MonadRandom m => SecretKey -> ByteString -> m Signature
- checkSignature :: PublicKey -> Signature -> ByteString -> Bool
Cryptographic primitive types
Secp256k1 public cryptographic key.
Secp256k1 secret cryptographic key.
Secp256k1 cryptographic signature.
detSecretKey :: ByteString -> SecretKey Source #
Deterministicaly generate a secret key from seed.
detSecretKeyDo :: MonadRandom m => m SecretKey Source #
Raw bytes (no checksums, tags or anything)
publicKeyToBytes :: forall ba. ByteArray ba => PublicKey -> ba Source #
Convert a PublicKey
to raw bytes.
mkPublicKey :: ByteArrayAccess ba => ba -> Either CryptoParseError PublicKey Source #
Make a PublicKey
from raw bytes.
publicKeyLengthBytes :: Integral n => n Source #
mkSignature :: ByteArray ba => ba -> Either CryptoParseError Signature Source #
Make a Signature
from raw bytes.
signatureLengthBytes :: Integral n => n Source #
Formatting and parsing
formatPublicKey :: PublicKey -> Text Source #
mformatPublicKey :: PublicKey -> MText Source #
formatSignature :: Signature -> Text Source #
mformatSignature :: Signature -> MText Source #
formatSecretKey :: SecretKey -> Text Source #
Signing
sign :: MonadRandom m => SecretKey -> ByteString -> m Signature Source #
Sign a message using the secret key.
checkSignature :: PublicKey -> Signature -> ByteString -> Bool Source #
Check that a sequence of bytes has been signed with a given key.