Skip to content

Commit

Permalink
fix: allows encryption with specified key
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike committed Oct 22, 2024
1 parent 9e27ab0 commit 12de54e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/security/encrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ import (

// Encrypt encrypts a string.
func (c Crypto) Encrypt(plainText string) (string, error) {
block, err := aes.NewCipher([]byte(c.EncryptionKey))
return c.EncryptWithKey(plainText, c.EncryptionKey)
}

// Encrypt encrypts a string with provided key.
func (c Crypto) EncryptWithKey(plainText, key string) (string, error) {
block, err := aes.NewCipher([]byte(key))
if err != nil {
return "", err
}
Expand Down

0 comments on commit 12de54e

Please sign in to comment.