Encrypt TOTP secret before saving to database

This commit is contained in:
2024-10-31 16:24:32 +07:00
parent f705d9538f
commit 197383c414
21 changed files with 271 additions and 172 deletions

View File

@ -2,6 +2,8 @@ package main
import (
"fmt"
"github.com/fossyy/filekeeper/encryption"
"github.com/fossyy/filekeeper/logger"
"github.com/fossyy/filekeeper/storage"
"strconv"
@ -9,7 +11,6 @@ import (
"github.com/fossyy/filekeeper/cache"
"github.com/fossyy/filekeeper/db"
"github.com/fossyy/filekeeper/email"
"github.com/fossyy/filekeeper/logger"
"github.com/fossyy/filekeeper/middleware"
"github.com/fossyy/filekeeper/routes/admin"
"github.com/fossyy/filekeeper/routes/client"
@ -42,7 +43,7 @@ func main() {
secretKey := utils.Getenv("S3_SECRET_KEY")
S3 := storage.NewS3(bucket, region, endpoint, accessKey, secretKey)
app.Server = app.NewClientServer(clientAddr, middleware.Handler(client.SetupRoutes()), *logger.Logger(), database, cacheServer, S3, mailServer)
app.Server = app.NewClientServer(clientAddr, middleware.Handler(client.SetupRoutes()), *logger.Logger(), database, cacheServer, encryption.NewAesEncryption(), S3, mailServer)
app.Admin = app.NewAdminServer(adminAddr, middleware.Handler(admin.SetupRoutes()), database)
go func() {