Skip to content
This repository was archived by the owner on Feb 8, 2026. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ func (s *Server) StartServer() error {
grp.GET("/exist/:pluginId/:publicKeyECDSA", s.ExistVault) // Check if Vault exists
grp.POST("/sign", s.SignMessages) // Sign messages
grp.GET("/sign/response/:taskId", s.GetKeysignResult) // Get keysign result
grp.DELETE("/:pluginId/:publicKeyECDSA", s.DeleteVault) // Delete Vault

pluginGroup := e.Group("/plugin")

Expand Down Expand Up @@ -296,6 +297,25 @@ func (s *Server) GetKeysignResult(c echo.Context) error {

return c.JSON(http.StatusOK, result)
}
func (s *Server) DeleteVault(c echo.Context) error {
publicKeyECDSA := c.Param("publicKeyECDSA")
if publicKeyECDSA == "" {
return c.JSON(http.StatusBadRequest, NewErrorResponse("public key is required"))
}
if !s.isValidHash(publicKeyECDSA) {
return c.NoContent(http.StatusBadRequest)
}
pluginId := c.Param("pluginId")
if pluginId == "" {
return c.JSON(http.StatusBadRequest, NewErrorResponse("pluginId is required"))
}

fileName := vcommon.GetVaultBackupFilename(publicKeyECDSA, pluginId)
if err := s.vaultStorage.DeleteFile(fileName); err != nil {
Comment thread
Ehsan-saradar marked this conversation as resolved.
return c.JSON(http.StatusInternalServerError, NewErrorResponse(err.Error()))
}
return c.NoContent(http.StatusOK)
}

func (s *Server) isValidHash(hash string) bool {
if len(hash) != 66 {
Expand Down