fix: segregate env setup

This commit is contained in:
Lakhan Samani
2022-02-26 09:44:55 +05:30
parent 332269ecf9
commit 4e19f73845
9 changed files with 478 additions and 84 deletions

19
server/crypto/hmac.go Normal file
View File

@@ -0,0 +1,19 @@
package crypto
import "github.com/google/uuid"
// NewHMAC key returns new key that can be used to ecnrypt data using HMAC algo
func NewHMACKey() string {
key := uuid.New().String()
return key
}
// IsHMACValid checks if given string is valid HMCA algo
func IsHMACA(algo string) bool {
switch algo {
case "HS256", "HS384", "HS512":
return true
default:
return false
}
}