updates
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-01-12 13:24:46 +11:00
parent 083fb0ebe1
commit 1a297464fe
3 changed files with 12 additions and 7 deletions

View File

@@ -275,7 +275,7 @@ Deleting a group will also impact all permissions based on that group. For that
### Secrets Operations
#### Store
**POST** `/api/secret/store`
**POST** `/api/secret/add`
Store secret if user only has access to a single safe
@@ -308,7 +308,7 @@ If a secret exists with a matching deviceName and deviceCategory in a safe that
If the current user has access to multiple safes, then the destination safeId will also need to be specified.
#### Retrieve
POST `/api/secret/retrieve`
POST `/api/secret/get`
Data
```

View File

@@ -118,7 +118,9 @@ func StoreSecret(c *gin.Context) {
// TODO replace GetSecrets with SecretsGetFromMultipleSafes
if err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
errString := fmt.Sprintf("error checking for existing secret : %s", err)
log.Printf("StoreSecret %s\n", errString)
c.JSON(http.StatusBadRequest, gin.H{"error": errString})
return
}
if len(checkExists) > 0 {
@@ -239,8 +241,8 @@ func UpdateSecret(c *gin.Context) {
log.Printf("UpdateSecret received JSON input '%v'\n", input)
if len(input.SecretValue) == 0 {
errString := "UpdateSecret no updated secret specified\n"
log.Print(errString)
errString := "no updated secret specified\n"
log.Printf("UpdateSecret %s\n", errString)
c.JSON(http.StatusBadRequest, gin.H{"error": errString})
return
}

View File

@@ -273,10 +273,13 @@ func main() {
// Get secrets
secretRoutes := router.Group("/api/secret")
secretRoutes.Use(middlewares.JwtAuthMiddleware())
secretRoutes.POST("/retrieve", controllers.RetrieveSecret)
secretRoutes.POST("/retrieve", controllers.RetrieveSecret) // TODO deprecate, replace retrieve with get
secretRoutes.POST("/get", controllers.RetrieveSecret)
secretRoutes.GET("/list", controllers.ListSecrets)
secretRoutes.POST("/retrieveMultiple", controllers.RetrieveMultpleSecrets) // TODO is this still required?
secretRoutes.POST("/store", controllers.StoreSecret)
secretRoutes.POST("/store", controllers.StoreSecret) // TODO deprecate, replace store with add
secretRoutes.POST("/add", controllers.StoreSecret)
secretRoutes.POST("/update", controllers.UpdateSecret)
// TODO
secretRoutes.POST("/delete", controllers.DeleteSecret)