From 9feb9387bda8e4227a3f7d5d7b2c6c8cf4a15d92 Mon Sep 17 00:00:00 2001 From: mo khan Date: Fri, 9 May 2025 12:25:02 -0600 Subject: feat: read HMAC_SESSION_SECRET env variable --- pkg/web/cookie.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'pkg') diff --git a/pkg/web/cookie.go b/pkg/web/cookie.go index 0c39735..7a2426f 100644 --- a/pkg/web/cookie.go +++ b/pkg/web/cookie.go @@ -9,11 +9,13 @@ import ( "github.com/xlgmokha/x/pkg/cookie" "github.com/xlgmokha/x/pkg/crypt" + "github.com/xlgmokha/x/pkg/env" "github.com/xlgmokha/x/pkg/pls" "github.com/xlgmokha/x/pkg/x" ) -var key []byte = x.Must(pls.GenerateRandomBytes(32)) // TODO:: https://gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/-/issues/2 +// TODO:: https://gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/-/issues/2 +var key []byte = []byte(env.Fetch("HMAC_SESSION_SECRET", string(x.Must(pls.GenerateRandomBytes(32))))) var Signer *crypt.HMACSigner = x.New[*crypt.HMACSigner](crypt.WithKey(key), crypt.WithAlgorithm(sha256.New)) var delimiter string = "--" -- cgit v1.2.3