Documentation ¶
Index ¶
- Constants
- Variables
- func AddDBToContext(ctx context.Context, d *sql.DB) context.Context
- func GetDB(ctx context.Context) *sql.DB
- func IsDuplicateErr(err error) bool
- func NewUser(ctx context.Context, id, fullname, email, password string, keyPack []byte, ...) (*User, *Token, error)
- type Invite
- type Secret
- type Team
- func (t *Team) AddOrInviteUserByEmail(ctx context.Context, admin *User, newcomerEmail string) (i *Invite, err error)
- func (t *Team) CheckAdmin(ctx context.Context, u *User) (isAdmin bool, err error)
- func (t *Team) CreateVault(ctx context.Context, u *User, name string, signedVaultKeys VaultKeyPair) (v *Vault, err error)
- func (t *Team) DemoteUser(ctx context.Context, demoter *User, demotee *User) error
- func (t *Team) GetSecretsForUser(ctx context.Context, u *User) (s []*Secret, err error)
- func (t *Team) GetTeamFull(ctx context.Context, u *User) (tf *TeamFull, err error)
- func (t *Team) GetUsersAfiliationFull(ctx context.Context) (tuf []*TeamUserFull, err error)
- func (t *Team) GetVaultForUser(ctx context.Context, vid string, u *User) (*Vault, error)
- func (t *Team) GetVaultsForUser(ctx context.Context, u *User) (vs []*Vault, err error)
- func (t *Team) GetVaultsFullForUser(ctx context.Context, u *User) (vf []*VaultFull, err error)
- func (t *Team) PromoteUser(ctx context.Context, promoter *User, promotee *User, ...) error
- type TeamFull
- type TeamUserFull
- type Token
- type User
- func (u *User) ChangeEmail(ctx context.Context, email string) (t *Token, err error)
- func (u *User) ChangePassword(ctx context.Context, password string, keyPack []byte) error
- func (u *User) CheckPassword(pass string) error
- func (u *User) CreateTeam(ctx context.Context, name string, signedVaultKeys VaultKeyPair) (t *Team, err error)
- func (u *User) GetTeam(ctx context.Context, tid string) (t *Team, err error)
- func (u *User) GetTeamFull(ctx context.Context, tid string) (tf *TeamFull, err error)
- func (u *User) GetTeams(ctx context.Context) ([]*Team, error)
- func (u *User) GetUserFull(ctx context.Context) (*UserFull, error)
- func (u *User) GetVerificationToken(ctx context.Context) (t *Token, err error)
- type UserFull
- type Vault
- func (v *Vault) AddSecret(ctx context.Context, s *Secret) error
- func (v *Vault) AddSecretList(ctx context.Context, sl []*Secret) error
- func (v Vault) AddUsers(ctx context.Context, userKeys map[string][]byte) error
- func (v *Vault) DeleteSecret(ctx context.Context, sid string) error
- func (v Vault) GetSecret(ctx context.Context, sid string) (s *Secret, err error)
- func (v Vault) GetSecrets(ctx context.Context) ([]*Secret, error)
- func (v Vault) GetUserIds(ctx context.Context) (uids []string, err error)
- func (v *Vault) GetVaultFullForUser(ctx context.Context, u *User) (vf *VaultFull, err error)
- func (v Vault) RemoveUser(ctx context.Context, username string) error
- func (v *Vault) UpdateSecret(ctx context.Context, s *Secret) error
- type VaultFull
- type VaultKeyPair
Constants ¶
View Source
const DEFAULT_VAULT_NAME = "Personal"
View Source
const TOKEN_VERIFICATION = 0
Variables ¶
View Source
var ( ErrInvalidEmail = errors.New("Invalid email") ErrNotInTeam = errors.New("User does not belong to team") ErrAlreadyInTeam = errors.New("Already belongs to team") ErrAlreadyInvited = errors.New("Alredy invited") ErrAlreadyExists = errors.New("Already exists") ErrInvalidKeys = errors.New("Invalid keys for vault") ErrDoesntExist = errors.New("Does not exist") ErrInvalidSignature = errors.New("Invalid signature") ErrInvalidPublicKey = errors.New("Invalid public key length") ErrInvalidAttributes = errors.New("Invalid attributes") )
View Source
var (
HASH_PASSWD_COST = 14
)
Functions ¶
func IsDuplicateErr ¶
Types ¶
type Invite ¶
type Team ¶
type Team struct { Id string `scaneo:"pk" json:"id"` Name string `json:"name"` Owner string `json:"owner"` Primary bool `json:"primary"` Size int `json:"-"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
func (*Team) AddOrInviteUserByEmail ¶
func (*Team) CheckAdmin ¶
func (*Team) CreateVault ¶
func (*Team) DemoteUser ¶
func (*Team) GetSecretsForUser ¶
func (*Team) GetTeamFull ¶
func (*Team) GetUsersAfiliationFull ¶
func (t *Team) GetUsersAfiliationFull(ctx context.Context) (tuf []*TeamUserFull, err error)
func (*Team) GetVaultForUser ¶
func (*Team) GetVaultsForUser ¶
func (*Team) GetVaultsFullForUser ¶
func (*Team) PromoteUser ¶
type TeamFull ¶
type TeamFull struct { *Team Vaults []*VaultFull `json:"vaults"` Users []*TeamUserFull `json:"users"` Invites []*Invite `json:"invites"` }
type TeamUserFull ¶
type Token ¶
type User ¶
type User struct { Id string `scaneo:"pk" json:"id"` Email string `json:"email"` UnconfirmedEmail string `json:"-"` HashPass []byte `json:"-"` FullName string `json:"fullname"` ConfirmedAt pq.NullTime `json:"confirmed_at,omitempty"` LockedAt pq.NullTime `json:"locked_at,omitempty"` SignInCount int `json:"sign_in_count"` FailedAttempts int `json:"failed_attempts"` PublicKey []byte `json:"public_key"` Key []byte `json:"-"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
func (*User) ChangeEmail ¶
func (*User) ChangePassword ¶
func (*User) CheckPassword ¶
func (*User) CreateTeam ¶
func (*User) GetTeamFull ¶
type Vault ¶
type Vault struct { Id string `scaneo:"pk" json:"id"` Team string `scaneo:"pk" json:"-"` Version uint32 `json:"version"` PublicKey []byte `json:"public_key"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
func (*Vault) AddSecretList ¶ added in v0.0.2
func (*Vault) GetVaultFullForUser ¶
type VaultKeyPair ¶
Click to show internal directories.
Click to hide internal directories.