gpm

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package gpm ...

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var DatabaseFile string = GetHomeDir() + "/.config/gpassmanager/gpassmanager.bin"

DatabaseFile is the db file

Functions

func ConfirmPrompt added in v0.4.0

func ConfirmPrompt(message string) bool

ConfirmPrompt will prompt to user for yes or no

func Copy added in v0.7.0

func Copy(src, dst string) error

Copy clone a file

func CreateDatabase

func CreateDatabase() error

CreateDatabase create folder and the file to save data

func Decrypt

func Decrypt(key, data []byte) ([]byte, error)

Decrypt returns decrypted data and errors

func Encrypt

func Encrypt(key, data []byte) ([]byte, error)

Encrypt returns encrypted data and errors

func GeneratePassword added in v0.4.0

func GeneratePassword(length int) string

GeneratePassword will return Password

func GetFileName added in v0.5.0

func GetFileName(filename, extension string) string

GetFileName simplify filenames for use (Note: only 3 char ext)

func GetHomeDir

func GetHomeDir() string

GetHomeDir returns homedir

func GetLicense added in v0.7.1

func GetLicense() string

GetLicense returns license

func GetVersion

func GetVersion() string

GetVersion returns version name, and code

func LineBreak

func LineBreak() string

LineBreak prints lots of '-'

func PagerErrorLogger added in v1.0.0

func PagerErrorLogger(err error)

PagerErrorLogger logs error to stdout

func RemoveDuplicate added in v0.4.1

func RemoveDuplicate(slice []int) []int

RemoveDuplicate removes duplicate from slice

func SavePasswords

func SavePasswords(key []byte, accounts []Account) error

SavePasswords save all password

func SortSlice added in v0.4.1

func SortSlice(slice []int) []int

SortSlice sort arrays

func ToPager added in v1.0.0

func ToPager(data string) error

ToPager pipe output to a pager

func VerifyKey

func VerifyKey(key, data []byte) bool

VerifyKey verify the password

Types

type Account

type Account struct {
	AccountName string `json:"account_name"`
	UserName    string `json:"username"`
	Email       string `json:"email"`
	Phone       string `json:"phone"`
	Password    string `json:"password"`
	Notes       string `json:"notes"`
}

Account contains all details for a account

func ConvertToAccount added in v0.5.0

func ConvertToAccount(csvpasswords []CSVPassword) []Account

ConvertToAccount converts CSVPassword into Account

func ReadPasswords

func ReadPasswords(key []byte) ([]Account, error)

ReadPasswords decrypt all password

func RemoveAccount added in v0.2.0

func RemoveAccount(slice []Account, s int) []Account

RemoveAccount removes an acccount

type CSVPassword added in v0.5.0

type CSVPassword struct {
	Name     string `csv:"name"`
	URL      string `csv:"url"`
	Username string `csv:"username"`
	Password string `csv:"password"`
}

CSVPassword contains csv parsed passwords

func ReadCSV added in v0.5.0

func ReadCSV(filename string) ([]CSVPassword, error)

ReadCSV returns parsed Passwords (*Google Password csv file)

Jump to

Keyboard shortcuts

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