store

package
v0.0.0-...-db6c267 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2015 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package store contains the main data structure for passman. Store consists of a header and a map of entries. The store is used for (de)serialization as part of the encryption/decryption process.

File format --------------------------------------------------------- Offset Length Description --------------------------------------------------------- 0 7 signature / magic number 7 1 file format version 8 1 scrypt param: log2(N) 9 4 scrypt param: r 13 4 scrypt param: n 17 32 salt 49 32 HMAC-SHA256(0 .. 32) --------------------------------------------------------- 81 n encrypted entry data 81+n 32 HMAC-SHA256(0 .. 81 + (n - 1))

Index

Constants

View Source
const (
	Version = 0x0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Name     string    `json:"name"`
	Password []byte    `json:"password"`
	Ctime    time.Time `json:"ctime"`    // Creation time
	Mtime    time.Time `json:"mtime"`    // Modification time
	Metadata Metadata  `json:"metadata"` // Map for custom fields
}

func NewEntry

func NewEntry() *Entry

func (*Entry) Age

func (e *Entry) Age() time.Duration

func (Entry) String

func (e Entry) String() string

func (*Entry) Touch

func (e *Entry) Touch()

type EntryMap

type EntryMap map[string]*Entry
type Header struct {
	Signature [7]byte      `json:"-"`
	Version   byte         `json:"version"`
	Params    ScryptParams `json:"params"`
	Salt      [32]byte     `json:"-"`
}

func NewHeader

func NewHeader() *Header

func (*Header) Marshal

func (h *Header) Marshal(w io.Writer) error

func (*Header) Unmarshal

func (h *Header) Unmarshal(r io.Reader) error

type Metadata

type Metadata map[string]string

func (Metadata) String

func (m Metadata) String() string

type ScryptParams

type ScryptParams struct {
	LogN byte   `json:"log_n"` // Work factor (iteration count)
	R    uint32 `json:"r"`     // Block size underlying hash
	P    uint32 `json:"p"`     // Parallelization factor
}

type Store

type Store struct {
	Header  `json:"header"`
	Entries EntryMap `json:"entries"`
}

func NewStore

func NewStore() *Store

func (*Store) List

func (s *Store) List(out io.Writer, pattern *regexp.Regexp)

TODO: move to list.go?

func (*Store) String

func (s *Store) String() string

Jump to

Keyboard shortcuts

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