Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- newtype VAPIDKeys = VAPIDKeys {
- unVAPIDKeys :: KeyPair
- vapidPublicKey :: VAPIDKeys -> PublicKey
- data VAPIDKeysError
- readVapidKeys :: FilePath -> FilePath -> IO (Either VAPIDKeysError VAPIDKeys)
- toKeyPair :: PublicKey -> PrivateKey -> KeyPair
- data PrivateKeyError
- = PrivateKeyPEMParseError PEMError
- | PrivateKeyUnknownCurveName
- | PrivateKeyWrongCurve CurveName
- | PrivateKeyInvalidPEM
- readWebPushPrivateKey :: FilePath -> IO (Either PrivateKeyError PrivateKey)
- data PublicKeyError
- readWebPushPublicKey :: FilePath -> IO (Either PublicKeyError PublicKey)
- writeVAPIDKeys :: FilePath -> FilePath -> VAPIDKeys -> IO ()
- generateVAPIDKeys :: MonadRandom m => m (Either String VAPIDKeys)
- vapidPublicKeyBytes :: PublicKey -> Either String [Word8]
Documentation
VAPIDKeys are the public and private keys used to sign the JWT authentication token sent for the push sendPushNotification
The key is an ECDSA key pair with the p256 curve
VAPIDKeys | |
|
vapidPublicKey :: VAPIDKeys -> PublicKey Source #
Get the public key from the VAPID keys
data VAPIDKeysError Source #
Errors from reading the VAPID keys from files
VAPIDKeysPublicKeyError PublicKeyError | Error reading the public key |
VAPIDKeysPrivateKeyError PrivateKeyError | Error reading the private key |
VAPIDKeysCurveMismatch | The public and private keys are not on the same curve |
Instances
Show VAPIDKeysError Source # | |
Defined in Web.WebPush.Keys |
:: FilePath | Path to the public key file |
-> FilePath | Path to the private key file |
-> IO (Either VAPIDKeysError VAPIDKeys) |
Read the public and private keys from files
toKeyPair :: PublicKey -> PrivateKey -> KeyPair Source #
Convert public and private keys to a key pair
data PrivateKeyError Source #
Errors from reading the VAPID private key from files
PrivateKeyPEMParseError PEMError | Error parsing the PEM file |
PrivateKeyUnknownCurveName | The curve name is not known |
PrivateKeyWrongCurve CurveName | The curve is not p256 |
PrivateKeyInvalidPEM | The PEM file is not a single private key |
Instances
Show PrivateKeyError Source # | |
Defined in Web.WebPush.Keys |
readWebPushPrivateKey :: FilePath -> IO (Either PrivateKeyError PrivateKey) Source #
Read the private key from a PEM file
The private key is an ECDSA private number on the p256 curve
data PublicKeyError Source #
Errors from reading the VAPID public key from files
PublicKeyPEMParseError PEMError | PEM encoding error |
PublicKeyASN1Error ASN1Error | ASN1 decoding error |
PublicKeyFromASN1Error String | Error converting ASN1 to ECDSA public key |
PublicKeyUnsupportedKeyType | The key type is not supported |
PublicKeyUnknownCurve | The curve is not known |
PublicKeyUnserialiseError | Error unserialising the EC point |
PublicKeyInvalidPEM | The PEM file is not a single public key |
Instances
Show PublicKeyError Source # | |
Defined in Web.WebPush.Keys |
readWebPushPublicKey :: FilePath -> IO (Either PublicKeyError PublicKey) Source #
Read the public key from a PEM file
The public key is an ECDSA public point on the p256 curve
writeVAPIDKeys :: FilePath -> FilePath -> VAPIDKeys -> IO () Source #
Write the public and private keys to files NOTE: This will overwrite any existing files and it does not store keys in the exact same format as they were read in from if they were created with OpenSSL