qr-imager-0.2.2.0: Library to generate QR codes from bytestrings and objects

Safe HaskellNone
LanguageHaskell2010

Data.QRCodes

Contents

Description

Module providing several functions for creating QR codes and their signed counterparts

Synopsis

Functions on objects

createQRCode :: ToJSON a => a -> FilePath -> IO () Source #

Creates a QR code from an object that is part of the ToJSON class

createQRCode userRecord "user-231.png"

createSecureQRCode :: ToJSON a => a -> FilePath -> FilePath -> IO () Source #

Creates a signed QR code from an object that is part of the ToJSON class

createSecureQRCode' :: ToJSON a => a -> (PublicKey, PrivateKey) -> FilePath -> IO () Source #

Creates a signed QR code from an object that is part of the ToJSON class

Functions for ByteStrings

byteStringToQR :: ByteString -> FilePath -> IO () Source #

Creates a QR code from a strict bytestring

byteStringToQRSec :: ByteString -> FilePath -> FilePath -> IO () Source #

Creates a signed QR code from a strict bytestring and path to keyfile/path. If the keyfile does not already exist it will be generated, otherwise it will be read.

Note that QR codes may only contain a small number of characters, so encrypting can sometimes make an object too big to encode.

byteStringToQRSec (BS.pack "hello") ".key.hk" "qrcode.png"

byteStringToQRSec' :: ByteString -> (PublicKey, PrivateKey) -> FilePath -> IO () Source #

Create a signed QR code from a strict ByteString and a key

byteStringToQRSec' (BS.pack "Vanessa") (generate 256 0x10001)

functions to read QR codes

readQRString :: FilePath -> IO String Source #

given a filepath, read the QR code as a string in all lowercase

readQRString "picture.jpg"

readQRStrSec :: FilePath -> FilePath -> IO String Source #

given a filepath pointing to a QR code, get the contents & verify signature with the keyfile

readQRStrSec "output.png" ".key.hk"

readQRStrSec' :: FilePath -> (PublicKey, PrivateKey) -> IO String Source #

Read an image containing a QR code, decode and verify the signature using the given key.