Safe Haskell | None |
---|---|
Language | Haskell2010 |
Cryptographic primitives used in Tezos.
Synopsis
- newtype PublicKey = PublicKey {}
- data SecretKey
- newtype Signature = Signature {}
- newtype KeyHash = KeyHash {}
- detSecretKey :: ByteString -> SecretKey
- toPublic :: SecretKey -> PublicKey
- data CryptoParseError
- formatPublicKey :: PublicKey -> Text
- mformatPublicKey :: PublicKey -> MText
- parsePublicKey :: Text -> Either CryptoParseError PublicKey
- mkPublicKey :: ByteArrayAccess ba => ba -> Either Text PublicKey
- formatSecretKey :: SecretKey -> Text
- parseSecretKey :: Text -> Either CryptoParseError SecretKey
- formatSignature :: Signature -> Text
- mformatSignature :: Signature -> MText
- parseSignature :: Text -> Either CryptoParseError Signature
- mkSignature :: ByteArrayAccess ba => ba -> Either Text Signature
- formatKeyHash :: KeyHash -> Text
- mformatKeyHash :: KeyHash -> MText
- parseKeyHash :: Text -> Either CryptoParseError KeyHash
- sign :: SecretKey -> ByteString -> Signature
- checkSignature :: PublicKey -> Signature -> ByteString -> Bool
- hashKey :: PublicKey -> KeyHash
- blake2b :: ByteString -> ByteString
- blake2b160 :: ByteString -> ByteString
- sha256 :: ByteString -> ByteString
- sha512 :: ByteString -> ByteString
- encodeBase58Check :: ByteString -> Text
- decodeBase58Check :: Text -> Maybe ByteString
- data B58CheckWithPrefixError
- decodeBase58CheckWithPrefix :: ByteString -> Text -> Either B58CheckWithPrefixError ByteString
Cryptographic primitive types
ED25519 public cryptographic key.
Instances
Eq PublicKey Source # | |
Show PublicKey Source # | |
Arbitrary PublicKey Source # | |
ToJSON PublicKey Source # | |
Defined in Tezos.Crypto | |
FromJSON PublicKey Source # | |
Buildable PublicKey Source # | |
Defined in Tezos.Crypto | |
IsoValue PublicKey Source # | |
type ToT PublicKey Source # | |
Defined in Michelson.Typed.Haskell.Value |
ED25519 secret cryptographic key.
ED25519 cryptographic signature.
Instances
Eq Signature Source # | |
Show Signature Source # | |
Arbitrary Signature Source # | |
ToJSON Signature Source # | |
Defined in Tezos.Crypto | |
FromJSON Signature Source # | |
Buildable Signature Source # | |
Defined in Tezos.Crypto | |
IsoValue Signature Source # | |
type ToT Signature Source # | |
Defined in Michelson.Typed.Haskell.Value |
b58check of a public key.
Instances
Eq KeyHash Source # | |
Ord KeyHash Source # | |
Show KeyHash Source # | |
Arbitrary KeyHash Source # | |
ToJSON KeyHash Source # | |
Defined in Tezos.Crypto | |
FromJSON KeyHash Source # | |
Buildable KeyHash Source # | |
Defined in Tezos.Crypto | |
IsoValue KeyHash Source # | |
IsoCValue KeyHash Source # | |
ArithOpHs Compare KeyHash KeyHash Source # | |
Defined in Lorentz.Arith | |
type ToT KeyHash Source # | |
type ToCT KeyHash Source # | |
Defined in Michelson.Typed.Haskell.Value | |
type ArithResHs Compare KeyHash KeyHash Source # | |
Defined in Lorentz.Arith |
detSecretKey :: ByteString -> SecretKey Source #
Deterministicaly generate a secret key from seed.
Formatting
data CryptoParseError Source #
Error that can happen during parsing of cryptographic primitive types.
Instances
Eq CryptoParseError Source # | |
Defined in Tezos.Crypto (==) :: CryptoParseError -> CryptoParseError -> Bool # (/=) :: CryptoParseError -> CryptoParseError -> Bool # | |
Show CryptoParseError Source # | |
Defined in Tezos.Crypto showsPrec :: Int -> CryptoParseError -> ShowS # show :: CryptoParseError -> String # showList :: [CryptoParseError] -> ShowS # | |
Buildable CryptoParseError Source # | |
Defined in Tezos.Crypto build :: CryptoParseError -> Builder # |
formatPublicKey :: PublicKey -> Text Source #
mformatPublicKey :: PublicKey -> MText Source #
mkPublicKey :: ByteArrayAccess ba => ba -> Either Text PublicKey Source #
formatSecretKey :: SecretKey -> Text Source #
formatSignature :: Signature -> Text Source #
mformatSignature :: Signature -> MText Source #
mkSignature :: ByteArrayAccess ba => ba -> Either Text Signature Source #
formatKeyHash :: KeyHash -> Text Source #
mformatKeyHash :: KeyHash -> MText Source #
Signing
checkSignature :: PublicKey -> Signature -> ByteString -> Bool Source #
Check that a sequence of bytes has been signed with a given key.
Hashing
blake2b :: ByteString -> ByteString Source #
Compute a cryptographic hash of a bytestring using the Blake2b_256 cryptographic hash function. It's used by the BLAKE2B instruction in Michelson.
blake2b160 :: ByteString -> ByteString Source #
Compute a cryptographic hash of a bytestring using the Blake2b_160 cryptographic hash function.
sha256 :: ByteString -> ByteString Source #
Compute a cryptographic hash of a bytestring using the Sha256 cryptographic hash function.
sha512 :: ByteString -> ByteString Source #
Compute a cryptographic hash of a bytestring using the Sha512 cryptographic hash function.
Utilities
encodeBase58Check :: ByteString -> Text Source #
Encode a bytestring in Base58Check format.
decodeBase58Check :: Text -> Maybe ByteString Source #
Decode a bytestring from Base58Check format.
data B58CheckWithPrefixError Source #
Instances
Show B58CheckWithPrefixError Source # | |
Defined in Tezos.Crypto showsPrec :: Int -> B58CheckWithPrefixError -> ShowS # show :: B58CheckWithPrefixError -> String # showList :: [B58CheckWithPrefixError] -> ShowS # |
decodeBase58CheckWithPrefix :: ByteString -> Text -> Either B58CheckWithPrefixError ByteString Source #
Parse a base58check encoded value expecting some prefix. If the actual prefix matches the expected one, it's stripped of and the resulting payload is returned.