Skip to content

Commit

Permalink
feat: add more log to key
Browse files Browse the repository at this point in the history
  • Loading branch information
mehditeymorian committed Sep 1, 2022
1 parent 3d5635f commit 23fac9d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/config/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ func (c *Config) DecodeKey(algorithm string) any {

switch {
case matchAlgorithm("(R|P)S.*", algorithm):
pterm.Info.Println("Using RSA key for decoding")

temp := c.Rsa.PublicKey
if temp == "" {
pterm.Warning.Println("RSA key is not available, generating random rsa key")
Expand All @@ -24,6 +26,8 @@ func (c *Config) DecodeKey(algorithm string) any {

key, err = jwt.ParseRSAPublicKeyFromPEM([]byte(temp))
case matchAlgorithm("HS.*", algorithm):
pterm.Info.Println("Using HMAC key for decoding")

temp := c.Hmac.Key
if temp == "" {
pterm.Warning.Println("Hmac key is not available, generating random hmac key")
Expand All @@ -37,6 +41,8 @@ func (c *Config) DecodeKey(algorithm string) any {
key = []byte(temp)
}
case matchAlgorithm("ES.*", algorithm):
pterm.Info.Println("Using ECDSA key for decoding")

temp := c.Ecdsa.PublicKey
if temp == "" {
pterm.Warning.Println("Ecdsa key is not available, generating random Ecdsa key")
Expand Down

0 comments on commit 23fac9d

Please sign in to comment.