mirror of
https://github.com/writeas/writefreely
synced 2025-02-09 13:08:41 +01:00
Make Keychain struct public
This commit is contained in:
parent
d8937e89a8
commit
9e43b04f04
2
app.go
2
app.go
@ -68,7 +68,7 @@ type App struct {
|
||||
db *datastore
|
||||
cfg *config.Config
|
||||
cfgFile string
|
||||
keys *keychain
|
||||
keys *Keychain
|
||||
sessionStore *sessions.CookieStore
|
||||
formDecoder *schema.Decoder
|
||||
|
||||
|
@ -44,7 +44,7 @@ var (
|
||||
|
||||
type writestore interface {
|
||||
CreateUser(*User, string) error
|
||||
UpdateUserEmail(keys *keychain, userID int64, email string) error
|
||||
UpdateUserEmail(keys *Keychain, userID int64, email string) error
|
||||
UpdateEncryptedUserEmail(int64, []byte) error
|
||||
GetUserByID(int64) (*User, error)
|
||||
GetUserForAuth(string) (*User, error)
|
||||
@ -219,7 +219,7 @@ func (db *datastore) CreateUser(u *User, collectionTitle string) error {
|
||||
|
||||
// FIXME: We're returning errors inconsistently in this file. Do we use Errorf
|
||||
// for returned value, or impart?
|
||||
func (db *datastore) UpdateUserEmail(keys *keychain, userID int64, email string) error {
|
||||
func (db *datastore) UpdateUserEmail(keys *Keychain, userID int64, email string) error {
|
||||
encEmail, err := data.Encrypt(keys.emailKey, email)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Couldn't encrypt email %s: %s\n", email, err)
|
||||
|
4
keys.go
4
keys.go
@ -30,7 +30,7 @@ var (
|
||||
cookieKeyPath = filepath.Join(keysDir, "cookies_enc.aes256")
|
||||
)
|
||||
|
||||
type keychain struct {
|
||||
type Keychain struct {
|
||||
emailKey, cookieAuthKey, cookieKey []byte
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ func initKeyPaths(app *App) {
|
||||
|
||||
func initKeys(app *App) error {
|
||||
var err error
|
||||
app.keys = &keychain{}
|
||||
app.keys = &Keychain{}
|
||||
|
||||
if debugging {
|
||||
log.Info(" %s", emailKeyPath)
|
||||
|
Loading…
x
Reference in New Issue
Block a user