Skip to content
This repository was archived by the owner on Jun 12, 2024. It is now read-only.

Commit a2f8eb8

Browse files
authored
Switch Seal to use Base64.URLEncoding instead (#24)
That makes it simpler to embed the value into go templates.
1 parent c0ecf92 commit a2f8eb8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/crypto/encrypt.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ func SealToString(plainText, key []byte) (string, error) {
118118
if err != nil {
119119
return "", err
120120
}
121-
return base64.StdEncoding.EncodeToString(bytes), nil
121+
return base64.URLEncoding.EncodeToString(bytes), nil
122122
}
123123

124124
// Unseal decrypts and authenticates the data encrypted by Seal
@@ -149,7 +149,7 @@ func Unseal(cipherText, key []byte) (plainText []byte, err error) {
149149

150150
// UnsealFromString decodes from Base64 and applies `Unseal`.
151151
func UnsealFromString(cipherTextStr string, key []byte) ([]byte, error) {
152-
cipherText, err := base64.StdEncoding.DecodeString(cipherTextStr)
152+
cipherText, err := base64.URLEncoding.DecodeString(cipherTextStr)
153153
if err != nil {
154154
return nil, err
155155
}

0 commit comments

Comments
 (0)