Documentation ¶
Overview ¶
Package model provides the data structures for the vsafe app
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Wrong password provided for user. ErrWrongPassword = errors.New("vsafe: Wrong Password.") // Invalid key provided to decrypt an entry. ErrKeyMismatch = errors.New("vsafe: Key Mismatch.") )
Functions ¶
This section is empty.
Types ¶
type Category ¶
type Category struct { // Category id Id int64 // The owner which corresponds to the master user ID. Owner int64 // Category name Name string }
Category represents a group of entries
type Entry ¶
type Entry struct { // The ID of the entry Id int64 // The owner of the entry which corresponds to the master user ID. Owner int64 // The URL of the website. May be nil. Url *url.URL // The title Title string // The description Desc string // The user name UName string // The password Password string // Special instructions Special string // Categories to which this entry belongs Categories idset.IdSet // Etag Etag uint64 }
Entry represents an entry stored in the vsafe database. UName Password and Special fields are encrypted in persistent storage.
type EntryUpdater ¶
EntryUpdater updates an entry in place and returns true on success.
type Key ¶
Key instances are used to encrypt / decrypt user name, password, and special fields in an entry. These instances must be treated as immutable.
type User ¶
type User struct { // User ID Id int64 // Master user lD. 0 means this user is also the master user. Users having // the same master are able to see the same entries in the database as the // ID of the key used to decrypt those entries corresponds to the master // user ID. Owner int64 // The Name of this user. Name string // This user's encryption key encrypted by the user's own password. Key string // The checksum of the user's key. Used to verify that the password for // a user is correct. Checksum string }
User instances represent a user of the vsafe app.
func (*User) ChangePassword ¶
ChangePassword changes the password of this user.
func (*User) GetOwner ¶
GetOwner returns the ID of the master user of this user. In the case that this user is a master user, GetOwner only works correctly after this user has been saved in persistent storage and has an ID.
func (*User) Init ¶
Init initializes this user instance with a user name and password so that this user is a master user and has its own random key.
func (*User) InitWithKey ¶
InitWithKey initializes this user instance with a user name and password so that the user uses key as its key.
Directories ¶
Path | Synopsis |
---|---|
Package aes provides encryption for the vsafe app.
|
Package aes provides encryption for the vsafe app. |
apps
|
|
vsafe/common
Package common provides routines common to all handlers in the vsafe webapp.
|
Package common provides routines common to all handlers in the vsafe webapp. |
vsafe/static
Package static provides static content for the vsafe app.
|
Package static provides static content for the vsafe app. |
Package vsafedb handles storing instances in the vsafe app to persistent storage.
|
Package vsafedb handles storing instances in the vsafe app to persistent storage. |
fixture
Package fixture provides test suites to test implementations of the datastore interfaces in the vsafedb package.
|
Package fixture provides test suites to test implementations of the datastore interfaces in the vsafedb package. |
for_sqlite
Package for_sqlite provides a sqlite implementation of interfaces in vsafedb package.
|
Package for_sqlite provides a sqlite implementation of interfaces in vsafedb package. |
sqlite_setup
Package sqlite_setup sets up a sqlite database for vsafe app
|
Package sqlite_setup sets up a sqlite database for vsafe app |