| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Network.LibP2P.Crypto.Key
Description
Key types and KeyPair abstraction for libp2p peer identity.
Synopsis
- data KeyType = Ed25519
- data KeyPair = KeyPair {}
- data PublicKey = PublicKey {
- pkType :: KeyType
- pkBytes :: ByteString
- data PrivateKey = PrivateKey {
- skType :: KeyType
- skBytes :: ByteString
- publicKey :: KeyPair -> PublicKey
- sign :: PrivateKey -> ByteString -> Either String ByteString
- verify :: PublicKey -> ByteString -> ByteString -> Bool
Documentation
Supported key types per the libp2p spec.
Constructors
| Ed25519 |
A key pair containing both public and private keys.
Constructors
| KeyPair | |
Fields
| |
A public key with its type.
Constructors
| PublicKey | |
Fields
| |
data PrivateKey Source #
A private key with its type.
Constructors
| PrivateKey | |
Fields
| |
sign :: PrivateKey -> ByteString -> Either String ByteString Source #
Sign a message with a private key. Returns Left on invalid key bytes.
verify :: PublicKey -> ByteString -> ByteString -> Bool Source #
Verify a signature against a public key and message.