biscuit-haskell-0.1.1.0: Library support for the Biscuit security token
Copyright© Clément Delafargue 2021
LicenseMIT
Maintainerclement@delafargue.name
Safe HaskellNone
LanguageHaskell2010

Auth.Biscuit.Sel

Description

Cryptographic primitives necessary to sign and verify biscuit tokens

Synopsis

Documentation

data Keypair Source #

A keypair containing both a private key and a public key

Constructors

Keypair 

Fields

Instances

Instances details
Eq Keypair Source # 
Instance details

Defined in Auth.Biscuit.Sel

Methods

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

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

Ord Keypair Source # 
Instance details

Defined in Auth.Biscuit.Sel

Show Keypair Source # 
Instance details

Defined in Auth.Biscuit.Sel

data PrivateKey Source #

A private key used to generate a biscuit

data PublicKey Source #

A public key used to generate a biscuit

Instances

Instances details
Eq PublicKey Source # 
Instance details

Defined in Auth.Biscuit.Sel

Ord PublicKey Source # 
Instance details

Defined in Auth.Biscuit.Sel

Show PublicKey Source # 
Instance details

Defined in Auth.Biscuit.Sel

data Signature Source #

The signature of a series of blocks (raw bytestrings)

Constructors

Signature 

Fields

Instances

Instances details
Eq Signature Source # 
Instance details

Defined in Auth.Biscuit.Sel

Show Signature Source # 
Instance details

Defined in Auth.Biscuit.Sel

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