core/zero: add pseudonymization key (#5290)

This commit is contained in:
Caleb Doxsey 2024-09-19 14:43:01 -06:00 committed by GitHub
parent 9d6b656fbe
commit bfc782ff06
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 44 additions and 20 deletions

View file

@ -8,8 +8,8 @@ import (
)
// Pseudonymize pseudonymizes data by computing the HMAC-SHA256 of the data.
func Pseudonymize(organizationID string, data string) string {
h := hmac.New(sha256.New, []byte(organizationID))
func Pseudonymize(key []byte, data string) string {
h := hmac.New(sha256.New, key)
_, _ = io.WriteString(h, data)
bs := h.Sum(nil)
return base64.StdEncoding.EncodeToString(bs)