π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[server] Remove unused endpoint (#4772)
Neeraj7e320693a160
diff --git a/server/cmd/museum/main.go b/server/cmd/museum/main.goindex bb99f90c73..e1a3622011 100644--- a/server/cmd/museum/main.go+++ b/server/cmd/museum/main.go@@ -496,7 +496,6 @@ func main() {privateAPI.POST("/users/two-factor/disable", userHandler.DisableTwoFactor)privateAPI.PUT("/users/attributes", userHandler.SetAttributes)privateAPI.PUT("/users/email-mfa", userHandler.UpdateEmailMFA)- privateAPI.PUT("/users/keys", userHandler.UpdateKeys)privateAPI.POST("/users/srp/setup", userHandler.SetupSRP)privateAPI.POST("/users/srp/complete", userHandler.CompleteSRPSetup)privateAPI.POST("/users/srp/update", userHandler.UpdateSrpAndKeyAttributes)diff --git a/server/pkg/api/user.go b/server/pkg/api/user.goindex 5cdbd0ec9a..bfdd36ab7b 100644--- a/server/pkg/api/user.go+++ b/server/pkg/api/user.go@@ -105,23 +105,6 @@ func (h *UserHandler) UpdateEmailMFA(c *gin.Context) {c.Status(http.StatusOK)}-// UpdateKeys updates the user key attributes on password change-func (h *UserHandler) UpdateKeys(c *gin.Context) {- userID := auth.GetUserID(c.Request.Header)- var request ente.UpdateKeysRequest- if err := c.ShouldBindJSON(&request); err != nil {- handler.Error(c, stacktrace.Propagate(err, ""))- return- }- token := auth.GetToken(c)- err := h.UserController.UpdateKeys(c, userID, request, token)- if err != nil {- handler.Error(c, stacktrace.Propagate(err, ""))- return- }- c.Status(http.StatusOK)-}-// SetRecoveryKey sets the recovery key attributes for a user.func (h *UserHandler) SetRecoveryKey(c *gin.Context) {userID := auth.GetUserID(c.Request.Header)diff --git a/server/pkg/controller/user/user.go b/server/pkg/controller/user/user.goindex 3c1b0419f0..7f5d5d0374 100644--- a/server/pkg/controller/user/user.go+++ b/server/pkg/controller/user/user.go@@ -184,31 +184,6 @@ func (c *UserController) UpdateEmailMFA(context *gin.Context, userID int64, isEnreturn c.UserAuthRepo.UpdateEmailMFA(context, userID, isEnabled)}-// UpdateKeys updates the user keys on password change-func (c *UserController) UpdateKeys(context *gin.Context, userID int64,- request ente.UpdateKeysRequest, token string) error {- /*- todo: send email to the user on password change and may be keep history of old keys for X days.- History will allow easy recovery of the account when password is changed by a bad actor- */- isSRPSetupDone, err := c.UserAuthRepo.IsSRPSetupDone(context, userID)- if err != nil {- return err- }- if isSRPSetupDone {- return stacktrace.Propagate(ente.NewBadRequestWithMessage("Need to upgrade client"), "can not use old API to change password after SRP is setup")- }- err = c.UserRepo.UpdateKeys(userID, request)- if err != nil {- return stacktrace.Propagate(err, "")- }- err = c.UserAuthRepo.RemoveAllOtherTokens(userID, token)- if err != nil {- return stacktrace.Propagate(err, "")- }- return nil-}-// SetRecoveryKey sets the recovery key attributes for a user, if not already setfunc (c *UserController) SetRecoveryKey(userID int64, request ente.SetRecoveryKeyRequest) error {keyAttr, keyErr := c.UserRepo.GetKeyAttributes(userID)diff --git a/server/pkg/repo/user.go b/server/pkg/repo/user.goindex b482a16a87..aa7d6145d5 100644--- a/server/pkg/repo/user.go+++ b/server/pkg/repo/user.go@@ -265,13 +265,6 @@ func (repo *UserRepository) SetKeyAttributes(userID int64, keyAttributes ente.Kereturn stacktrace.Propagate(err, "")}-// UpdateKeys sets the keys of a user-func (repo *UserRepository) UpdateKeys(userID int64, keys ente.UpdateKeysRequest) error {- _, err := repo.DB.Exec(`UPDATE key_attributes SET kek_salt = $1, encrypted_key = $2, key_decryption_nonce = $3, mem_limit = $4, ops_limit = $5 WHERE user_id = $6`,- keys.KEKSalt, keys.EncryptedKey, keys.KeyDecryptionNonce, keys.MemLimit, keys.OpsLimit, userID)- return stacktrace.Propagate(err, "")-}-// SetRecoveryKeyAttributes sets the recovery key and related attributes for a userfunc (repo *UserRepository) SetRecoveryKeyAttributes(userID int64, keys ente.SetRecoveryKeyRequest) error {_, err := repo.DB.Exec(`UPDATE key_attributes SET master_key_encrypted_with_recovery_key = $1, master_key_decryption_nonce = $2, recovery_key_encrypted_with_master_key = $3, recovery_key_decryption_nonce = $4 WHERE user_id = $5`,