Safe Haskell | None |
---|---|
Language | Haskell2010 |
Cryptographic primitives used in Tezos.
Synopsis
- data PublicKey
- data SecretKey
- data Signature
- newtype KeyHash = KeyHash {}
- toPublic :: SecretKey -> PublicKey
- data CryptoParseError
- formatPublicKey :: PublicKey -> Text
- parsePublicKey :: Text -> Either CryptoParseError PublicKey
- formatSecretKey :: SecretKey -> Text
- parseSecretKey :: Text -> Either CryptoParseError SecretKey
- formatSignature :: Signature -> Text
- parseSignature :: Text -> Either CryptoParseError Signature
- formatKeyHash :: KeyHash -> Text
- 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.
ED25519 secret cryptographic key.
ED25519 cryptographic signature.
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 | |
FromCVal KeyHash Source # | |
ToCVal KeyHash Source # | |
FromVal KeyHash Source # | |
ToVal KeyHash Source # | |
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 #
formatSecretKey :: SecretKey -> Text Source #
formatSignature :: Signature -> Text Source #
formatKeyHash :: KeyHash -> Text 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.