11 Commits
0.1 ... 0.2

Author SHA1 Message Date
Jonathan Lamothe
412c8312b0 version 0.2 2019-01-01 23:03:09 -05:00
Jonathan Lamothe
012486c045 handle empty input string in mkPass 2019-01-01 22:50:16 -05:00
Jonathan Lamothe
cdff8c8917 refactored mkHash 2019-01-01 22:45:03 -05:00
Jonathan Lamothe
f305822ae1 whitespace fix 2019-01-01 22:25:25 -05:00
Jonathan Lamothe
7cf0b34078 warn when changing master password 2019-01-01 21:15:09 -05:00
Jonathan Lamothe
191be38fbe implemented manual saving 2019-01-01 21:02:52 -05:00
Jonathan Lamothe
f2ae7bca76 fixed changelog 2019-01-01 04:57:24 -05:00
Jonathan Lamothe
3d8b41c5b6 version 0.1.1 2019-01-01 04:51:52 -05:00
Jonathan Lamothe
60f40262f7 fixed pwGenerate hanging 2019-01-01 04:48:36 -05:00
Jonathan Lamothe
32c9241a2e updated copyright 2019-01-01 04:47:42 -05:00
Jonathan Lamothe
29ca8a64bf typo 2019-01-01 04:30:12 -05:00
23 changed files with 53 additions and 39 deletions

View File

@@ -1,3 +1,12 @@
# Changelog for passman
## Unreleased changes
## 0.2
- implemented manual saving
- added a warning when changing master password
- some code cleanup as suggested by [Stephen Paul Weber](https://github.com/singpolyma)
## 0.1.1
- corrected a bug that was causing the pwGenerate function to hang occasionally.
- this may cause some passwords to be generated differently

View File

@@ -1,6 +1,6 @@
# passman
Copyright (C) 2018 Jonathan Lamothe
Copyright (C) 2018, 2019 Jonathan Lamothe
<jlamothe1980@gmail.com>
This program is free software: you can redistribute it and/or modify
@@ -38,7 +38,7 @@ This package uses [Haskell Stack](https://haskellstack.org). Please
refer to [their
website](https://docs.haskellstack.org/en/stable/README/#how-to-install)
for instructions on installing Haskell Stack. Once you have done
this, you can simply enterg the command `stack install passman` in the
this, you can simply enter the command `stack install passman` in the
terminal to install passman.
## GitHub

View File

@@ -1,7 +1,7 @@
{-
passman
Copyright (C) 2018 Jonathan Lamothe
Copyright (C) 2018, 2019 Jonathan Lamothe
<jlamothe1980@gmail.com>
This program is free software: you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
{-
passman
Copyright (C) 2018 Jonathan Lamothe
Copyright (C) 2018, 2019 Jonathan Lamothe
<jlamothe1980@gmail.com>
This program is free software: you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
{-
passman
Copyright (C) 2018 Jonathan Lamothe
Copyright (C) 2018, 2019 Jonathan Lamothe
<jlamothe1980@gmail.com>
This program is free software: you can redistribute it and/or modify
@@ -63,6 +63,7 @@ mainMenu =
[ ( "add a password", addPassword )
, ( "view/edit a password", viewEditMenu )
, ( "change master password", changeMasterPass )
, ( "save manually", save >> mainMenu )
, ( "lock session", lockSession )
, ( "quit", quit )
]
@@ -93,9 +94,13 @@ viewEditMenu = menu "View/Edit Password"
changeMasterPass :: S.StateT Status IO ()
changeMasterPass = do
oldP <- S.gets $ view masterPass
newP <- req $ reqDefault getMasterPass oldP
S.modify $ set masterPass newP
req (confirm $
"\nWARNING: Changing your master password will change all of your saved passwords.\n" ++
"Are you sure you would like to proceed?") >>= flip when
(do
oldP <- S.gets $ view masterPass
newP <- req $ reqDefault getMasterPass oldP
S.modify $ set masterPass newP)
mainMenu
lockSession :: S.StateT Status IO ()

View File

@@ -1,7 +1,7 @@
{-
passman
Copyright (C) 2018 Jonathan Lamothe
Copyright (C) 2018, 2019 Jonathan Lamothe
<jlamothe1980@gmail.com>
This program is free software: you can redistribute it and/or modify

View File

@@ -1,10 +1,10 @@
name: passman
version: 0.1
version: 0.2
github: "jlamothe/passman"
license: LGPL-3
author: "Jonathan Lamothe"
maintainer: "jlamothe1980@gmail.com"
copyright: "(C) 2018 Jonathan Lamothe"
copyright: "(C) 2018, 2019 Jonathan Lamothe"
extra-source-files:
- README.md
@@ -30,6 +30,7 @@ dependencies:
library:
source-dirs: src
dependencies:
- base16-bytestring
- base64-bytestring
- SHA
- text

View File

@@ -2,7 +2,7 @@
Module: Password
Description: a simple password manager
Copyright: (C) 2018 Jonathan Lamothe
Copyright: (C) 2018, 2019 Jonathan Lamothe
License: LGPLv3 (or later)
Maintainer: jlamothe1980@gmail.com
@@ -23,7 +23,7 @@ License along with this program. If not, see
-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE OverloadedStrings #-}
module Password (
-- * Data Types
@@ -59,6 +59,7 @@ import Data.Aeson
, (.=)
)
import qualified Data.ByteString.Lazy as B
import qualified Data.ByteString.Base16.Lazy as B16
import qualified Data.ByteString.Base64.Lazy as B64
import Data.Char (isUpper, isLower, isDigit, isAlphaNum, toLower)
import Data.Digest.Pure.SHA
@@ -322,26 +323,24 @@ isSpecial :: Char -> Bool
isSpecial = not . isAlphaNum
mkPass :: String -> PWPolicy -> String
mkPass (x:xs) p = let p' = nextPolicy x p in
if p^.pwLength <= 0
mkPass [] _ = "" -- this should never happen
mkPass (x:xs) p = if p^.pwLength <= 0
then ""
else if validatePWPolicy p'
then x : mkPass xs p'
else mkPass xs p
else let p' = nextPolicy x p in
if validatePWPolicy p'
then x : mkPass xs p'
else mkPass xs p
mkPool :: B.ByteString -> String
mkPool = toB64 . raw where
raw x = let x' = mkHash x in
x' `B.append` raw x
x' `B.append` raw x'
mkSeed :: String -> PWData -> B.ByteString
mkSeed pw d = toUTF8 pw `B.append` (d^.pwSalt)
mkHash :: B.ByteString -> B.ByteString
mkHash = raw . show . sha256 where
raw (x:y:xs) = read ("0x" ++ [x] ++ [y]) `B.cons` raw xs
raw [_] = error "odd number of hex digits in hash"
raw "" = B.empty
mkHash = fst . B16.decode . encodeUtf8 . T.pack . show . sha256
nextPolicy :: Char -> PWPolicy -> PWPolicy
nextPolicy x p = over pwLength pred $

View File

@@ -1,7 +1,7 @@
{-
passman
Copyright (C) 2018 Jonathan Lamothe
Copyright (C) 2018, 2019 Jonathan Lamothe
<jlamothe1980@gmail.com>
This program is free software: you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
{-
passman
Copyright (C) 2018 Jonathan Lamothe
Copyright (C) 2018, 2019 Jonathan Lamothe
<jlamothe1980@gmail.com>
This program is free software: you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
{-
passman
Copyright (C) 2018 Jonathan Lamothe
Copyright (C) 2018, 2019 Jonathan Lamothe
<jlamothe1980@gmail.com>
This program is free software: you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
{-
passman
Copyright (C) 2018 Jonathan Lamothe
Copyright (C) 2018, 2019 Jonathan Lamothe
<jlamothe1980@gmail.com>
This program is free software: you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
{-
passman
Copyright (C) 2018 Jonathan Lamothe
Copyright (C) 2018, 2019 Jonathan Lamothe
<jlamothe1980@gmail.com>
This program is free software: you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
{-
passman
Copyright (C) 2018 Jonathan Lamothe
Copyright (C) 2018, 2019 Jonathan Lamothe
<jlamothe1980@gmail.com>
This program is free software: you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
{-
passman
Copyright (C) 2018 Jonathan Lamothe
Copyright (C) 2018, 2019 Jonathan Lamothe
<jlamothe1980@gmail.com>
This program is free software: you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
{-
passman
Copyright (C) 2018 Jonathan Lamothe
Copyright (C) 2018, 2019 Jonathan Lamothe
<jlamothe1980@gmail.com>
This program is free software: you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
{-
passman
Copyright (C) 2018 Jonathan Lamothe
Copyright (C) 2018, 2019 Jonathan Lamothe
<jlamothe1980@gmail.com>
This program is free software: you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
{-
passman
Copyright (C) 2018 Jonathan Lamothe
Copyright (C) 2018, 2019 Jonathan Lamothe
<jlamothe1980@gmail.com>
This program is free software: you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
{-
passman
Copyright (C) 2018 Jonathan Lamothe
Copyright (C) 2018, 2019 Jonathan Lamothe
<jlamothe1980@gmail.com>
This program is free software: you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
{-
passman
Copyright (C) 2018 Jonathan Lamothe
Copyright (C) 2018, 2019 Jonathan Lamothe
<jlamothe1980@gmail.com>
This program is free software: you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
{-
passman
Copyright (C) 2018 Jonathan Lamothe
Copyright (C) 2018, 2019 Jonathan Lamothe
<jlamothe1980@gmail.com>
This program is free software: you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
{-
passman
Copyright (C) 2018 Jonathan Lamothe
Copyright (C) 2018, 2019 Jonathan Lamothe
<jlamothe1980@gmail.com>
This program is free software: you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
{-
passman
Copyright (C) 2018 Jonathan Lamothe
Copyright (C) 2018, 2019 Jonathan Lamothe
<jlamothe1980@gmail.com>
This program is free software: you can redistribute it and/or modify