libp2p-hs-0.1.0.0: Haskell implementation of the libp2p networking stack
Safe HaskellNone
LanguageGHC2021

Network.LibP2P.Crypto.Key

Description

Key types and KeyPair abstraction for libp2p peer identity.

Synopsis

Documentation

data KeyType Source #

Supported key types per the libp2p spec.

Constructors

Ed25519 

Instances

Instances details
Show KeyType Source # 
Instance details

Defined in Network.LibP2P.Crypto.Key

Eq KeyType Source # 
Instance details

Defined in Network.LibP2P.Crypto.Key

Methods

(==) :: KeyType -> KeyType -> Bool #

(/=) :: KeyType -> KeyType -> Bool #

Ord KeyType Source # 
Instance details

Defined in Network.LibP2P.Crypto.Key

data KeyPair Source #

A key pair containing both public and private keys.

Constructors

KeyPair 

data PublicKey Source #

A public key with its type.

Constructors

PublicKey 

Instances

Instances details
Show PublicKey Source # 
Instance details

Defined in Network.LibP2P.Crypto.Key

Eq PublicKey Source # 
Instance details

Defined in Network.LibP2P.Crypto.Key

data PrivateKey Source #

A private key with its type.

Constructors

PrivateKey 

publicKey :: KeyPair -> PublicKey Source #

Extract the public key from a key pair.

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.