Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Handle batch public key requests

AmanRajSinghMourya4f44da4db221
diff --git a/server/pkg/api/user.go b/server/pkg/api/user.go
index 8ba8cac22a..19475bcc38 100644
--- a/server/pkg/api/user.go
+++ b/server/pkg/api/user.go
@@ -154,6 +154,25 @@ func (h *UserHandler) GetPublicKey(c *gin.Context) {
})
}
+func (h *UserHandler) GetPublicKeys(c *gin.Context) {
+ var request struct {
+ Emails []string `json:"emails" binding:"required"`
+ }
+ if err := handler.BindJSON(c, &request); err != nil {
+ handler.Error(c, stacktrace.Propagate(err, ""))
+ return
+ }
+ publicKeys, err := h.UserController.GetPublicKeys(
+ auth.GetUserID(c.Request.Header),
+ request.Emails,
+ )
+ if err != nil {
+ handler.Error(c, stacktrace.Propagate(err, ""))
+ return
+ }
+ c.JSON(http.StatusOK, gin.H{"publicKeys": publicKeys})
+}
+
func (h *UserHandler) GetSessionValidityV2(c *gin.Context) {
userID := auth.GetUserID(c.Request.Header)
keyAttributes, err := h.UserController.GetAttributes(userID)