-
-
Notifications
You must be signed in to change notification settings - Fork 527
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: encrypt login and install request #852 * fix: user curd panic after install * chore: update error definations
- Loading branch information
Showing
33 changed files
with
1,108 additions
and
768 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package crypto | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/0xJacky/Nginx-UI/api" | ||
"github.com/0xJacky/Nginx-UI/internal/crypto" | ||
"github.com/gin-gonic/gin" | ||
) | ||
|
||
// GetPublicKey generates a new ED25519 key pair and registers it in the cache | ||
func GetPublicKey(c *gin.Context) { | ||
sign, err := crypto.GetCryptoParams() | ||
if err != nil { | ||
api.ErrHandler(c, err) | ||
return | ||
} | ||
|
||
c.JSON(http.StatusOK, gin.H{ | ||
"public_key": sign.PublicKey, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package crypto | ||
|
||
import "github.com/gin-gonic/gin" | ||
|
||
func InitPublicRouter(r *gin.RouterGroup) { | ||
g := r.Group("/crypto") | ||
{ | ||
g.GET("public_key", GetPublicKey) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export default { | ||
50001: () => $gettext('Plain text is empty'), | ||
50002: () => $gettext('Cipher text is too short'), | ||
40401: () => $gettext('Request timeout'), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export default { | ||
40000: () => $gettext('Invalid request format'), | ||
40001: () => $gettext('Decryption failed'), | ||
} |
Oops, something went wrong.