masterpassword

package module
v0.0.0-...-5cccfb4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2014 License: MIT Imports: 7 Imported by: 0

README

masterpassword

This is a MasterPassword implementation in Go.

There is a library and a small command line tool; both in early development stages but usable.

Installation

Installing the library works the usual way:

go get github.com/deniswernert/masterpassword

Installing the commmand line tool is equally simple:

go install github.com/deniswernert/masterpassword/masterpassword

Documentation

Overview

Package masterpassword implements the MasterPassword algorithm (http://masterpasswordapp.com/algorithm.html).

Usage:

Create a session from the user name and the password using NewSession. Then, instantiate a site with NewSite or NewSiteWithCounter.

Finally, you can generate the password using the Password method on the Site. Password requires you to specify the type of password using a PasswordType.

*PasswordType implements the Value interface from the flags package, making it easy to use it as a command line parameter:

import "flag"
var pwdType = PasswordTypeBasic

func main() {
    flag.Var(&pwdType, "type", "password type")
}

Index

Constants

View Source
const (
	PasswordTypeMaximumSecurity = iota
	PasswordTypeLong
	PasswordTypeMedium
	PasswordTypeShort
	PasswordTypeBasic
	PasswordTypePIN
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PasswordType

type PasswordType int

PasswordType is the type of password to generate. The available types are PIN, Short, Basic, Medium, Long and Maximum Security.

func (*PasswordType) Set

func (t *PasswordType) Set(value string) (err error)

Set implements the Value interface for PasswordType and converts from a string value to an enum value. Shortcuts are supported, and the check is case insensitive. An error is returned when resolving fails.

func (*PasswordType) String

func (t *PasswordType) String() (s string)

String implements the Value interface for PasswordType and converts the enum value to a human readable string value

type Session

type Session struct {
	Key  []byte
	Name string
}

Session is an encryption session and holds the master key, as well as the user name. Note that the password is not stored.

func NewSession

func NewSession(name string, password string) *Session

NewSession creates a new session for given username and password. This involves deriving the master key, which can be a little time consuming.

func (*Session) NewSite

func (session *Session) NewSite(name string) *Site

NewSite initializes a new site in this session, with a counter value of 1

func (*Session) NewSiteWithCounter

func (session *Session) NewSiteWithCounter(name string, counter int) *Site

NewSiteWithCounter initializes a new site in this session, with a custom counter value.

type Site

type Site struct {
	Seed    []byte
	Session *Session
	Name    string
	Counter int
}

Site is a site seed with site information

func (*Site) Password

func (site *Site) Password(pwdType PasswordType) string

Password returns the password of type pwdType for this site

func (*Site) PasswordSheet

func (site *Site) PasswordSheet(pwdType PasswordType) (passwords []string)

PasswordSheet ignores the first seed byte and returns all password variations for this site

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL