Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
412c8312b0 | ||
|
|
012486c045 | ||
|
|
cdff8c8917 | ||
|
|
f305822ae1 | ||
|
|
7cf0b34078 | ||
|
|
191be38fbe | ||
|
|
f2ae7bca76 | ||
|
|
3d8b41c5b6 | ||
|
|
60f40262f7 | ||
|
|
32c9241a2e | ||
|
|
29ca8a64bf |
11
ChangeLog.md
11
ChangeLog.md
@@ -1,3 +1,12 @@
|
|||||||
# Changelog for passman
|
# 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
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# passman
|
# passman
|
||||||
|
|
||||||
Copyright (C) 2018 Jonathan Lamothe
|
Copyright (C) 2018, 2019 Jonathan Lamothe
|
||||||
<jlamothe1980@gmail.com>
|
<jlamothe1980@gmail.com>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
refer to [their
|
||||||
website](https://docs.haskellstack.org/en/stable/README/#how-to-install)
|
website](https://docs.haskellstack.org/en/stable/README/#how-to-install)
|
||||||
for instructions on installing Haskell Stack. Once you have done
|
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.
|
terminal to install passman.
|
||||||
|
|
||||||
## GitHub
|
## GitHub
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{-
|
{-
|
||||||
|
|
||||||
passman
|
passman
|
||||||
Copyright (C) 2018 Jonathan Lamothe
|
Copyright (C) 2018, 2019 Jonathan Lamothe
|
||||||
<jlamothe1980@gmail.com>
|
<jlamothe1980@gmail.com>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{-
|
{-
|
||||||
|
|
||||||
passman
|
passman
|
||||||
Copyright (C) 2018 Jonathan Lamothe
|
Copyright (C) 2018, 2019 Jonathan Lamothe
|
||||||
<jlamothe1980@gmail.com>
|
<jlamothe1980@gmail.com>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
|||||||
13
app/UI.hs
13
app/UI.hs
@@ -1,7 +1,7 @@
|
|||||||
{-
|
{-
|
||||||
|
|
||||||
passman
|
passman
|
||||||
Copyright (C) 2018 Jonathan Lamothe
|
Copyright (C) 2018, 2019 Jonathan Lamothe
|
||||||
<jlamothe1980@gmail.com>
|
<jlamothe1980@gmail.com>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
@@ -63,6 +63,7 @@ mainMenu =
|
|||||||
[ ( "add a password", addPassword )
|
[ ( "add a password", addPassword )
|
||||||
, ( "view/edit a password", viewEditMenu )
|
, ( "view/edit a password", viewEditMenu )
|
||||||
, ( "change master password", changeMasterPass )
|
, ( "change master password", changeMasterPass )
|
||||||
|
, ( "save manually", save >> mainMenu )
|
||||||
, ( "lock session", lockSession )
|
, ( "lock session", lockSession )
|
||||||
, ( "quit", quit )
|
, ( "quit", quit )
|
||||||
]
|
]
|
||||||
@@ -93,9 +94,13 @@ viewEditMenu = menu "View/Edit Password"
|
|||||||
|
|
||||||
changeMasterPass :: S.StateT Status IO ()
|
changeMasterPass :: S.StateT Status IO ()
|
||||||
changeMasterPass = do
|
changeMasterPass = do
|
||||||
oldP <- S.gets $ view masterPass
|
req (confirm $
|
||||||
newP <- req $ reqDefault getMasterPass oldP
|
"\nWARNING: Changing your master password will change all of your saved passwords.\n" ++
|
||||||
S.modify $ set masterPass newP
|
"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
|
mainMenu
|
||||||
|
|
||||||
lockSession :: S.StateT Status IO ()
|
lockSession :: S.StateT Status IO ()
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{-
|
{-
|
||||||
|
|
||||||
passman
|
passman
|
||||||
Copyright (C) 2018 Jonathan Lamothe
|
Copyright (C) 2018, 2019 Jonathan Lamothe
|
||||||
<jlamothe1980@gmail.com>
|
<jlamothe1980@gmail.com>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
name: passman
|
name: passman
|
||||||
version: 0.1
|
version: 0.2
|
||||||
github: "jlamothe/passman"
|
github: "jlamothe/passman"
|
||||||
license: LGPL-3
|
license: LGPL-3
|
||||||
author: "Jonathan Lamothe"
|
author: "Jonathan Lamothe"
|
||||||
maintainer: "jlamothe1980@gmail.com"
|
maintainer: "jlamothe1980@gmail.com"
|
||||||
copyright: "(C) 2018 Jonathan Lamothe"
|
copyright: "(C) 2018, 2019 Jonathan Lamothe"
|
||||||
|
|
||||||
extra-source-files:
|
extra-source-files:
|
||||||
- README.md
|
- README.md
|
||||||
@@ -30,6 +30,7 @@ dependencies:
|
|||||||
library:
|
library:
|
||||||
source-dirs: src
|
source-dirs: src
|
||||||
dependencies:
|
dependencies:
|
||||||
|
- base16-bytestring
|
||||||
- base64-bytestring
|
- base64-bytestring
|
||||||
- SHA
|
- SHA
|
||||||
- text
|
- text
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Module: Password
|
Module: Password
|
||||||
Description: a simple password manager
|
Description: a simple password manager
|
||||||
Copyright: (C) 2018 Jonathan Lamothe
|
Copyright: (C) 2018, 2019 Jonathan Lamothe
|
||||||
License: LGPLv3 (or later)
|
License: LGPLv3 (or later)
|
||||||
Maintainer: jlamothe1980@gmail.com
|
Maintainer: jlamothe1980@gmail.com
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ License along with this program. If not, see
|
|||||||
-}
|
-}
|
||||||
|
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
|
||||||
module Password (
|
module Password (
|
||||||
-- * Data Types
|
-- * Data Types
|
||||||
@@ -59,6 +59,7 @@ import Data.Aeson
|
|||||||
, (.=)
|
, (.=)
|
||||||
)
|
)
|
||||||
import qualified Data.ByteString.Lazy as B
|
import qualified Data.ByteString.Lazy as B
|
||||||
|
import qualified Data.ByteString.Base16.Lazy as B16
|
||||||
import qualified Data.ByteString.Base64.Lazy as B64
|
import qualified Data.ByteString.Base64.Lazy as B64
|
||||||
import Data.Char (isUpper, isLower, isDigit, isAlphaNum, toLower)
|
import Data.Char (isUpper, isLower, isDigit, isAlphaNum, toLower)
|
||||||
import Data.Digest.Pure.SHA
|
import Data.Digest.Pure.SHA
|
||||||
@@ -322,26 +323,24 @@ isSpecial :: Char -> Bool
|
|||||||
isSpecial = not . isAlphaNum
|
isSpecial = not . isAlphaNum
|
||||||
|
|
||||||
mkPass :: String -> PWPolicy -> String
|
mkPass :: String -> PWPolicy -> String
|
||||||
mkPass (x:xs) p = let p' = nextPolicy x p in
|
mkPass [] _ = "" -- this should never happen
|
||||||
if p^.pwLength <= 0
|
mkPass (x:xs) p = if p^.pwLength <= 0
|
||||||
then ""
|
then ""
|
||||||
else if validatePWPolicy p'
|
else let p' = nextPolicy x p in
|
||||||
then x : mkPass xs p'
|
if validatePWPolicy p'
|
||||||
else mkPass xs p
|
then x : mkPass xs p'
|
||||||
|
else mkPass xs p
|
||||||
|
|
||||||
mkPool :: B.ByteString -> String
|
mkPool :: B.ByteString -> String
|
||||||
mkPool = toB64 . raw where
|
mkPool = toB64 . raw where
|
||||||
raw x = let x' = mkHash x in
|
raw x = let x' = mkHash x in
|
||||||
x' `B.append` raw x
|
x' `B.append` raw x'
|
||||||
|
|
||||||
mkSeed :: String -> PWData -> B.ByteString
|
mkSeed :: String -> PWData -> B.ByteString
|
||||||
mkSeed pw d = toUTF8 pw `B.append` (d^.pwSalt)
|
mkSeed pw d = toUTF8 pw `B.append` (d^.pwSalt)
|
||||||
|
|
||||||
mkHash :: B.ByteString -> B.ByteString
|
mkHash :: B.ByteString -> B.ByteString
|
||||||
mkHash = raw . show . sha256 where
|
mkHash = fst . B16.decode . encodeUtf8 . T.pack . show . sha256
|
||||||
raw (x:y:xs) = read ("0x" ++ [x] ++ [y]) `B.cons` raw xs
|
|
||||||
raw [_] = error "odd number of hex digits in hash"
|
|
||||||
raw "" = B.empty
|
|
||||||
|
|
||||||
nextPolicy :: Char -> PWPolicy -> PWPolicy
|
nextPolicy :: Char -> PWPolicy -> PWPolicy
|
||||||
nextPolicy x p = over pwLength pred $
|
nextPolicy x p = over pwLength pred $
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{-
|
{-
|
||||||
|
|
||||||
passman
|
passman
|
||||||
Copyright (C) 2018 Jonathan Lamothe
|
Copyright (C) 2018, 2019 Jonathan Lamothe
|
||||||
<jlamothe1980@gmail.com>
|
<jlamothe1980@gmail.com>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{-
|
{-
|
||||||
|
|
||||||
passman
|
passman
|
||||||
Copyright (C) 2018 Jonathan Lamothe
|
Copyright (C) 2018, 2019 Jonathan Lamothe
|
||||||
<jlamothe1980@gmail.com>
|
<jlamothe1980@gmail.com>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{-
|
{-
|
||||||
|
|
||||||
passman
|
passman
|
||||||
Copyright (C) 2018 Jonathan Lamothe
|
Copyright (C) 2018, 2019 Jonathan Lamothe
|
||||||
<jlamothe1980@gmail.com>
|
<jlamothe1980@gmail.com>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{-
|
{-
|
||||||
|
|
||||||
passman
|
passman
|
||||||
Copyright (C) 2018 Jonathan Lamothe
|
Copyright (C) 2018, 2019 Jonathan Lamothe
|
||||||
<jlamothe1980@gmail.com>
|
<jlamothe1980@gmail.com>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{-
|
{-
|
||||||
|
|
||||||
passman
|
passman
|
||||||
Copyright (C) 2018 Jonathan Lamothe
|
Copyright (C) 2018, 2019 Jonathan Lamothe
|
||||||
<jlamothe1980@gmail.com>
|
<jlamothe1980@gmail.com>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{-
|
{-
|
||||||
|
|
||||||
passman
|
passman
|
||||||
Copyright (C) 2018 Jonathan Lamothe
|
Copyright (C) 2018, 2019 Jonathan Lamothe
|
||||||
<jlamothe1980@gmail.com>
|
<jlamothe1980@gmail.com>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{-
|
{-
|
||||||
|
|
||||||
passman
|
passman
|
||||||
Copyright (C) 2018 Jonathan Lamothe
|
Copyright (C) 2018, 2019 Jonathan Lamothe
|
||||||
<jlamothe1980@gmail.com>
|
<jlamothe1980@gmail.com>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{-
|
{-
|
||||||
|
|
||||||
passman
|
passman
|
||||||
Copyright (C) 2018 Jonathan Lamothe
|
Copyright (C) 2018, 2019 Jonathan Lamothe
|
||||||
<jlamothe1980@gmail.com>
|
<jlamothe1980@gmail.com>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{-
|
{-
|
||||||
|
|
||||||
passman
|
passman
|
||||||
Copyright (C) 2018 Jonathan Lamothe
|
Copyright (C) 2018, 2019 Jonathan Lamothe
|
||||||
<jlamothe1980@gmail.com>
|
<jlamothe1980@gmail.com>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{-
|
{-
|
||||||
|
|
||||||
passman
|
passman
|
||||||
Copyright (C) 2018 Jonathan Lamothe
|
Copyright (C) 2018, 2019 Jonathan Lamothe
|
||||||
<jlamothe1980@gmail.com>
|
<jlamothe1980@gmail.com>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{-
|
{-
|
||||||
|
|
||||||
passman
|
passman
|
||||||
Copyright (C) 2018 Jonathan Lamothe
|
Copyright (C) 2018, 2019 Jonathan Lamothe
|
||||||
<jlamothe1980@gmail.com>
|
<jlamothe1980@gmail.com>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{-
|
{-
|
||||||
|
|
||||||
passman
|
passman
|
||||||
Copyright (C) 2018 Jonathan Lamothe
|
Copyright (C) 2018, 2019 Jonathan Lamothe
|
||||||
<jlamothe1980@gmail.com>
|
<jlamothe1980@gmail.com>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{-
|
{-
|
||||||
|
|
||||||
passman
|
passman
|
||||||
Copyright (C) 2018 Jonathan Lamothe
|
Copyright (C) 2018, 2019 Jonathan Lamothe
|
||||||
<jlamothe1980@gmail.com>
|
<jlamothe1980@gmail.com>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{-
|
{-
|
||||||
|
|
||||||
passman
|
passman
|
||||||
Copyright (C) 2018 Jonathan Lamothe
|
Copyright (C) 2018, 2019 Jonathan Lamothe
|
||||||
<jlamothe1980@gmail.com>
|
<jlamothe1980@gmail.com>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{-
|
{-
|
||||||
|
|
||||||
passman
|
passman
|
||||||
Copyright (C) 2018 Jonathan Lamothe
|
Copyright (C) 2018, 2019 Jonathan Lamothe
|
||||||
<jlamothe1980@gmail.com>
|
<jlamothe1980@gmail.com>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
|||||||
Reference in New Issue
Block a user