Module Kwpass

module Kwpass: sig .. end

Password Handling

This module provides a number of ways of passing passwords to applications. A password source descriptor is used to describe the source of the password. The syntax is:


Author(s): Keith Waclena

type passwordsrc = 
| Pass of string
| Env of string
| File of string
| FD of int
| Stdin
The type of password sources.

NYI: FD

type rawness = 
| Raw
| Cooked
The type of rawness: a Raw password is extracted unchanged from its source, while a Cooked password is trimmed of whitespace on both ends.
type t = passwordsrc * rawness 
A Kwpass.t is a combination of passwordsrc and rawness.
exception Badpass of passwordsrc
Exception raised when we fail to extract a password from a passwordsrc.
val of_string : string -> t
of_string str: convert a string which is a password source descriptor to a t.

N.B.: there are no string representations for certain combinations of passwordsrc and rawness.

val to_string : ?showpass:bool -> t -> string
to_string ?showpass t: convert a t to a password source descriptor

The actual text of the password will not be shown unless ~showpass:true.

val getpass : t -> string
getpass t: get a password from the t, trimming it of whitespace from beginning and end if not Raw.
val helpdata : (string * string) list
List of pairs representing text suitable for a help message describing the forms of t's.

The fst of each pair shows the syntax of a t, while the snd describes it.

val helptext : ?indent:string -> ?sep1:string -> ?sep2:string -> string -> string
helptext ?indent ?sep1 ?sep2 title: format up a paragraph of help text from helpdata.
indent : string used to indent each line (prefix of each line) (default: " ")
sep1 : string that separates each fst from each snd (default: " ")
sep2 : string, that separates each pair from one another, and separates the title from the help text (default: sep2 ^ indent)