Copyright | © Clément Delafargue 2021 |
---|---|
License | MIT |
Maintainer | clement@delafargue.name |
Safe Haskell | None |
Language | Haskell2010 |
Cryptographic primitives necessary to sign and verify biscuit tokens
Synopsis
- data Keypair = Keypair {}
- data PrivateKey
- data PublicKey
- data Signature = Signature {
- parameters :: [ByteString]
- z :: ByteString
- parsePrivateKey :: ByteString -> Maybe PrivateKey
- parsePublicKey :: ByteString -> Maybe PublicKey
- serializePrivateKey :: PrivateKey -> ByteString
- serializePublicKey :: PublicKey -> ByteString
- newKeypair :: IO Keypair
- fromPrivateKey :: PrivateKey -> IO Keypair
- signBlock :: Keypair -> ByteString -> IO Signature
- aggregate :: Signature -> Signature -> IO Signature
- verifySignature :: NonEmpty (PublicKey, ByteString) -> Signature -> IO Bool
- hashBytes :: ByteString -> IO ByteString
Documentation
A keypair containing both a private key and a public key
Keypair | |
|
data PrivateKey Source #
A private key used to generate a biscuit
Instances
Eq PrivateKey Source # | |
Defined in Auth.Biscuit.Sel (==) :: PrivateKey -> PrivateKey -> Bool # (/=) :: PrivateKey -> PrivateKey -> Bool # | |
Ord PrivateKey Source # | |
Defined in Auth.Biscuit.Sel compare :: PrivateKey -> PrivateKey -> Ordering # (<) :: PrivateKey -> PrivateKey -> Bool # (<=) :: PrivateKey -> PrivateKey -> Bool # (>) :: PrivateKey -> PrivateKey -> Bool # (>=) :: PrivateKey -> PrivateKey -> Bool # max :: PrivateKey -> PrivateKey -> PrivateKey # min :: PrivateKey -> PrivateKey -> PrivateKey # | |
Show PrivateKey Source # | |
Defined in Auth.Biscuit.Sel showsPrec :: Int -> PrivateKey -> ShowS # show :: PrivateKey -> String # showList :: [PrivateKey] -> ShowS # |
A public key used to generate a biscuit
The signature of a series of blocks (raw bytestrings)
Signature | |
|
parsePrivateKey :: ByteString -> Maybe PrivateKey Source #
Parse a private key from raw bytes.
This returns Nothing
if the raw bytes don't have the expected length
parsePublicKey :: ByteString -> Maybe PublicKey Source #
Parse a public key from raw bytes.
This returns Nothing
if the raw bytes don't have the expected length
serializePrivateKey :: PrivateKey -> ByteString Source #
Serialize a private key to raw bytes
serializePublicKey :: PublicKey -> ByteString Source #
Serialize a public key to raw bytes
newKeypair :: IO Keypair Source #
Generate a random keypair
fromPrivateKey :: PrivateKey -> IO Keypair Source #
Construct a keypair from a private key
signBlock :: Keypair -> ByteString -> IO Signature Source #
Sign a single block with the given keypair
aggregate :: Signature -> Signature -> IO Signature Source #
Aggregate two signatures into a single one
verifySignature :: NonEmpty (PublicKey, ByteString) -> Signature -> IO Bool Source #
Verify a signature, given a list of messages and associated public keys
hashBytes :: ByteString -> IO ByteString Source #
Hash a bytestring with SHA256