vault

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteVault

func DeleteVault(id, email string) error

func HasAccessToVault

func HasAccessToVault(vaultID, userEmail string) bool

func IsVaultOwner

func IsVaultOwner(vaultID, userEmail string) bool

func NewUser

func NewUser(email, password, name string) error

func SetVaultVersion

func SetVaultVersion(id string, ver int) error

func ShareVaultInvite

func ShareVaultInvite(email, name, vaultID string) error

func ShareVaultRevoke

func ShareVaultRevoke(shareUID, vaultID, userEmail string) error

Types

type Share

type Share struct {
	UID      string `json:"uid,omitempty" gorm:"primaryKey"`
	Email    string `json:"email,omitempty"`
	Name     string `json:"name,omitempty"`
	VaultID  string `json:"vault_id,omitempty"`
	Accepted bool   `json:"accepted,omitempty" gorm:"default:true"`
}

func GetVaultShares

func GetVaultShares(vaultID string) ([]*Share, error)

type User

type User struct {
	Name     string `json:"name"`
	Email    string `json:"email" gorm:"primaryKey"`
	Password string `json:"password"`
	License  string `json:"license"`
}

func Login

func Login(email, password string) (*User, error)

func UserInfo

func UserInfo(email string) (*User, error)

type Vault

type Vault struct {
	ID        string `json:"id,omitempty" gorm:"primaryKey"`
	UserEmail string `json:"user_email,omitempty"`
	Created   int64  `json:"created,omitempty"`
	Host      string `json:"host,omitempty"`
	Name      string `json:"name,omitempty"`
	Password  string `json:"password,omitempty"`
	Salt      string `json:"salt,omitempty"`
	Size      int64  `json:"size,omitempty"`
	// Not part of JSON
	Version int    `json:"-,omitempty" gorm:"default:0"`
	KeyHash string `json:"keyhash,omitempty"`
}

func GetSharedVaults

func GetSharedVaults(userEmail string) ([]*Vault, error)

func GetVault

func GetVault(id, keyHash string) (*Vault, error)

func GetVaults

func GetVaults(userEmail string) ([]*Vault, error)

Size is not included in the response. It should be fetched separately.

func NewVault

func NewVault(name, userEmail, password, salt, keyhash string) (*Vault, error)

Jump to

Keyboard shortcuts

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