opvault

package
v0.0.0-...-d41c5fe Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidFormat = xerrors.New("opvault: Invalid format")
	ErrInvalidData   = xerrors.New("opvault: Invalid data")
	ErrLocked        = xerrors.New("opvault: Locked")
)

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	OriginalFile string
	Version      int8
	Metadata     *AttachmentMetadata
	// contains filtered or unexported fields
}

func (*Attachment) Data

func (a *Attachment) Data() ([]byte, error)

type AttachmentMetadata

type AttachmentMetadata struct {
	UUID                 string `json:"UUID"`
	ItemUUID             string `json:"itemUUID"`
	ContentsSize         int    `json:"contentsSize"`
	External             bool   `json:"external"`
	TransactionTimestamp int64  `json:"txTimestamp"`
	OverviewRaw          string `json:"overview"`
	CreatedAtUnix        int64  `json:"createdAt"`
	UpdatedAtUnix        int64  `json:"updatedAt"`

	Overview  string    `json:"-"`
	CreatedAt time.Time `json:"-"`
	UpdatedAt time.Time `json:"-"`
}

type Category

type Category string
const (
	CategoryLogin           Category = "001"
	CategoryCreditCard      Category = "002"
	CategorySecureNote      Category = "003"
	CategoryIdentity        Category = "004"
	CategoryPassword        Category = "005"
	CategoryTombstone       Category = "099"
	CategorySoftwareLicense Category = "100"
	CategoryBankAccount     Category = "101"
	CategoryDatabase        Category = "102"
	CategoryDriverLicense   Category = "103"
	CategoryOutdoorLicense  Category = "104"
	CategoryMembership      Category = "105"
	CategoryPassport        Category = "106"
	CategoryRewards         Category = "107"
	CategorySSN             Category = "108"
	CategoryRouter          Category = "109"
	CategoryServer          Category = "110"
	CategoryEmail           Category = "111"
)

type Field

type Field struct {
	Name        string `json:"name"`
	Type        string `json:"type"`
	Value       string `json:"value"`
	Designation string `json:"designation"`
}

type Folder

type Folder struct {
	UUID                 string `json:"uuid"`
	OverviewRaw          string `json:"overview"`
	TransactionTimestamp int64  `json:"tx"`
	Smart                bool   `json:"smart"`
	UpdatedUnix          int64  `json:"updated"`
	CreatedUnix          int64  `json:"created"`

	Overview string    `json:"-"`
	Created  time.Time `json:"-"`
	Updated  time.Time `json:"-"`
}

func (*Folder) Decrypt

func (f *Folder) Decrypt(hmacKey, encryptionKey []byte) error

type HTMLForm

type HTMLForm struct {
	Method string `json:"htmlMethod"`
	Action string `json:"htmlAction"`
}

type Item

type Item struct {
	UUID                 string   `json:"uuid"`
	Category             Category `json:"category"`
	DetailRaw            string   `json:"d"`
	Favorite             int      `json:"fave"`
	Folder               string   `json:"folder"`
	HMAC                 string   `json:"hmac"`
	Key                  string   `json:"k"`
	OverviewRaw          string   `json:"o"`
	Trashed              bool     `json:"trashed"`
	TransactionTimestamp int64    `json:"tx"`
	CreatedUnix          int64    `json:"created"`
	UpdatedUnix          int64    `json:"updated"`

	Detail *ItemDetail `json:"-"`

	Overview *ItemOverview `json:"-"`

	HasAttachment bool          `json:"-"`
	Attachments   []*Attachment `json:"-"`
	Created       time.Time     `json:"-"`
	Updated       time.Time     `json:"-"`
	// contains filtered or unexported fields
}

func (*Item) Decrypt

func (i *Item) Decrypt(masterHMACKey, masterEncryptionKey, overviewHMACKey, overviewEncryptionKey []byte) error

type ItemDetail

type ItemDetail struct {
	Form   *HTMLForm `json:"htmlForm,omitempty"`
	Fields []*Field  `json:"fields,omitempty"`
}

type ItemOverview

type ItemOverview struct {
	Title string `json:"title"`
	URL   string `json:"url"`
}

type Profile

type Profile struct {
	UUID           string `json:"uuid"`
	LastUpdatedBy  string `json:"lastUpdatedBy"`
	ProfileName    string `json:"profileName"`
	SaltRaw        string `json:"salt"`
	PasswordHint   string `json:"passwordHint"`
	MasterKeyRaw   string `json:"masterKey"`
	Iterations     int    `json:"iterations"`
	OverviewKeyRaw string `json:"overviewKey"`
	CreatedAtUnix  int64  `json:"createdAt"`
	UpdatedAtUnix  int64  `json:"updatedAt"`

	Salt                  []byte    `json:"-"`
	CreatedAt             time.Time `json:"-"`
	UpdatedAt             time.Time `json:"-"`
	MasterEncryptionKey   []byte    `json:"-"`
	MasterHMACKey         []byte    `json:"-"`
	OverviewEncryptionKey []byte    `json:"-"`
	OverviewHMACKey       []byte    `json:"-"`
	// contains filtered or unexported fields
}

func (*Profile) Decrypt

func (p *Profile) Decrypt() error

func (*Profile) IsLocked

func (p *Profile) IsLocked() bool

func (*Profile) Lock

func (p *Profile) Lock()

func (*Profile) Unlock

func (p *Profile) Unlock(password string) error

type Reader

type Reader struct {
	Profile *Profile
	// contains filtered or unexported fields
}

func NewReader

func NewReader(dir string) *Reader

func (*Reader) Err

func (r *Reader) Err() error

func (*Reader) Folders

func (r *Reader) Folders() map[string]*Folder

func (*Reader) IsLocked

func (r *Reader) IsLocked() (bool, error)

func (*Reader) Items

func (r *Reader) Items() map[string]*Item

func (*Reader) Lock

func (r *Reader) Lock()

func (*Reader) NextItem

func (r *Reader) NextItem() bool

func (*Reader) Unlock

func (r *Reader) Unlock(password string) error

Jump to

Keyboard shortcuts

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