passman-core-0.3.1: Deterministic password generator

CopyrightMatthew Harm Bekkema 2016
LicenseGPL-2
Maintainermbekkema97@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe
LanguageHaskell2010

Passman.Core.PassList

Contents

Description

This module handles the Haskell representation of a passlist. A passlist file should have the following format:

Each entry separated by a newline. Each field of an entry separated by a tab. The fields in order are: passListEntryInfo, passListEntryLength and passListEntryMode. If any field is missing or unparsable, default values will be used.

This example passlist file:

google.com
projecteuler.net	32
wiki.haskell.org	Max	nl

Would be parsed as the following PassList:

[
  PassListEntry {passListEntryInfo = "google.com", passListEntryLength = Nothing, passListEntryMode = ncl}
, PassListEntry {passListEntryInfo = "projecteuler.net", passListEntryLength = Just 32, passListEntryMode = ncl}
, PassListEntry {passListEntryInfo = "wiki.haskell.org", passListEntryLength = Nothing, passListEntryMode = nl}
]

Synopsis

Data structures

type PassList = [PassListEntry] Source

Represents the password list.

data PassListEntry Source

Represents an entry in the password list.

Constructors

PassListEntry 

Fields

passListEntryInfo :: String

The info string to generate the password for.

passListEntryLength :: Maybe Int

Maximum length of the generated password. Nothing if no maximum length.

passListEntryMode :: Mode

The mode to use when generating the password.

Parsing

stringToEntry :: String -> PassListEntry Source

Parses a string into a PassListEntry. Should be used on each line of the passlist file.

fileToEntries :: FilePath -> IO (Either IOException PassList) Source

Loads the specified file and parses it into a PassList. Catches and returns the IOException on failure.

Saving

entryToString :: PassListEntry -> String Source

Turns a PassListEntry back into a string parsable by stringToEntry.

entriesToFile :: FilePath -> PassList -> IO (Maybe IOException) Source

Saves the PassList to file. Catches and returns the IOException on failure.