purr/src/Core/SQLite.hs

29 lines
652 B
Haskell

module Core.SQLite where
import Core.Configuration
import Core.Types
import Data.ByteString as B
import Database.SQLite.Simple
import Database.SQLite.Simple.FromRow
import qualified Data.Text as T
main :: IO ()
main = do
db <- dbPath
conn <- open db
execute_ conn
"CREATE TABLE IF NOT EXISTS pws\
\ (link TEXT PRIMARY KEY,\
\ secret TEXT,\
\ nonce TEXT,\
\ date DATETIME DEFAULT CURRENT_TIMESTAMP,\
\ life INT,\
\ views INT,\
\ maxViews INT)"
close conn
encKey :: IO ByteString
encKey = B.readFile "./data/encryptionKey"