Commit 6346a3e4 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FEAT] QR Code generator

parent 08096a49
......@@ -4,7 +4,7 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
-- hash: 90040862e681d50b9cbc9f20134bd721bfae96f7bb944a458e70f910a2e0a988
-- hash: 5bb5ed278614ba01df850033ab3475484d4df276a3278039a7aebf1d86dea06b
name: gargantext-prelude
version: 0.1.0.0
......@@ -31,9 +31,11 @@ library
Gargantext.Prelude.Clock
Gargantext.Prelude.Config
Gargantext.Prelude.Crypto.Auth
Gargantext.Prelude.Crypto.Encode
Gargantext.Prelude.Crypto.Hash
Gargantext.Prelude.Crypto.Pass.Machine
Gargantext.Prelude.Crypto.Pass.User
Gargantext.Prelude.Crypto.QRCode
Gargantext.Prelude.Crypto.Share
Gargantext.Prelude.Fibonacci
Gargantext.Prelude.Mail
......@@ -62,10 +64,12 @@ library
, base >=4.7 && <5
, binary
, bytestring
, cipher-aes
, clock
, containers
, cprng-aes
, crypto-random
, cryptonite
, directory
, extra
, filepath
......@@ -73,11 +77,14 @@ library
, ini
, lens
, located-base
, memory
, mime-mail
, mtl
, network
, password
, protolude
, qrcode-core
, qrcode-juicypixels
, random
, random-shuffle
, safe
......@@ -115,10 +122,12 @@ executable gargantext-prelude-exe
, base >=4.7 && <5
, binary
, bytestring
, cipher-aes
, clock
, containers
, cprng-aes
, crypto-random
, cryptonite
, directory
, extra
, filepath
......@@ -127,11 +136,14 @@ executable gargantext-prelude-exe
, ini
, lens
, located-base
, memory
, mime-mail
, mtl
, network
, password
, protolude
, qrcode-core
, qrcode-juicypixels
, random
, random-shuffle
, safe
......@@ -170,10 +182,12 @@ test-suite gargantext-prelude-test
, base >=4.7 && <5
, binary
, bytestring
, cipher-aes
, clock
, containers
, cprng-aes
, crypto-random
, cryptonite
, directory
, extra
, filepath
......@@ -182,11 +196,14 @@ test-suite gargantext-prelude-test
, ini
, lens
, located-base
, memory
, mime-mail
, mtl
, network
, password
, protolude
, qrcode-core
, qrcode-juicypixels
, random
, random-shuffle
, safe
......
......@@ -20,14 +20,18 @@ extra-source-files:
description: Please see the README on GitHub at <https://github.com/githubuser/gargantext-prelude#readme>
dependencies:
- MonadRandom
- SHA
- aeson
- base >= 4.7 && < 5
- binary
- bytestring
- cipher-aes
- clock
- containers
- cprng-aes
- crypto-random
- cryptonite
- directory
- extra
- filepath
......@@ -35,11 +39,14 @@ dependencies:
- ini
- lens
- located-base
- memory
- mime-mail
- mtl
- network
- password
- protolude
- qrcode-core
- qrcode-juicypixels
- random
- random-shuffle
- safe
......@@ -49,8 +56,7 @@ dependencies:
- transformers
- transformers-base
- vector
- SHA
- MonadRandom
default-extensions:
- DataKinds
......
......@@ -14,6 +14,8 @@ https://zuttobenkyou.wordpress.com/2011/12/23/simple-password-generation-with-ha
-}
{-# LANGUAGE PackageImports #-}
module Gargantext.Prelude.Crypto.Pass.Machine
where
......@@ -22,7 +24,7 @@ import Data.List (nub)
-- import System.Environment (getArgs)
-- import System.IO (hSetEcho)
import Control.Monad.State
import Crypto.Random (cprgGenerate)
import "crypto-random" Crypto.Random (cprgGenerate)
import Crypto.Random.AESCtr
import Data.Binary (decode)
import Prelude
......
{-|
Module : Gargantext.Prelude.Crypto.Auth
Description :
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
-}
module Gargantext.Prelude.Crypto.QRCode where
import Data.Maybe
import Protolude ((<$>), Int)
import Codec.QRCode (encode, ToText)
import Data.Text.Internal.Lazy (Text)
import Codec.QRCode.Data.ErrorLevel (ErrorLevel(H))
import Codec.QRCode.Data.QRCodeOptions (defaultQRCodeOptions)
import Codec.QRCode.JuicyPixels
import Codec.QRCode (QRCodeOptions, TextEncoding(Utf8WithECI))
qrCode :: ToText a => Int -> a -> Maybe Text
qrCode size a = toPngDataUrlT size size
<$> encode (defaultQRCodeOptions H) Utf8WithECI a
# This file was autogenerated by Stack.
# You should not edit this file by hand.
# For more information, please see the documentation at:
# https://docs.haskellstack.org/en/stable/lock_files
packages:
- completed:
hackage: located-base-0.1.1.1@sha256:7c6395f2b6fbf2d5f76c3514f774423838c0ea94e1c6a5530dd3c94b30c9d1c8,1904
pantry-tree:
size: 534
sha256: 9d7b96ce785b464253dcf0ac2d8eb0be4cae6b96ed3960d66b81c373b540ed3f
original:
hackage: located-base-0.1.1.1@sha256:7c6395f2b6fbf2d5f76c3514f774423838c0ea94e1c6a5530dd3c94b30c9d1c8,1904
snapshots:
- completed:
size: 585392
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/1.yaml
sha256: 4e4c5e435a2f1c6f3c650f282db0f387f806406ed4fe6ef1aa4e6add9035d065
original:
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/1.yaml
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment