store

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(key string, text []byte) ([]byte, error)

func Encrypt

func Encrypt(key string, text []byte) ([]byte, error)

Types

type Passwd

type Passwd struct {
	Id            int
	Name          string `gorm:"index:idx_name,unique"` // Name is unique,供用户查找密码
	Url           string // 用户该密码对应的的网址
	UserName      string // 用户在该网站上的用户名
	CryptedPasswd []byte // 用户密码,加密后的
	Note          string // 备注
	CreateTime    time.Time
	UpdateTime    time.Time
}

type SqliteStore

type SqliteStore struct {
	// contains filtered or unexported fields
}

func NewSqliteStore

func NewSqliteStore(ctx context.Context) *SqliteStore

func (*SqliteStore) Delete

func (s *SqliteStore) Delete(ctx context.Context, name string) error

Delete 删除一个记录

func (*SqliteStore) Get

func (s *SqliteStore) Get(ctx context.Context, name string) (*Passwd, error)

Get 获取密码密文

func (*SqliteStore) Save

func (s *SqliteStore) Save(ctx context.Context, passwd *Passwd) error

Save 在使用cryptFunc对密码密文进行存储

func (*SqliteStore) SearchName

func (s *SqliteStore) SearchName(ctx context.Context, name string) ([]string, error)

SearchName 根据名称进行搜索并给出名称列表

type Store

type Store interface {
	// Save 在使用cryptFunc对密码密文进行存储
	Save(ctx context.Context, passwd *Passwd) error

	// Get 获取密码
	Get(ctx context.Context, name string) (*Passwd, error)

	// SearchName 根据名称进行搜索并给出名称列表
	SearchName(ctx context.Context, name string) ([]string, error)

	// Delete 删除一个记录
	Delete(ctx context.Context, name string) error
}

Jump to

Keyboard shortcuts

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