File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,24 @@ registered first using gob.Register(). For basic types this is not needed;
7777it works out of the box. An optional JSON encoder that uses ` encoding/json ` is
7878available for types compatible with JSON.
7979
80+ ### Compact Encoding
81+
82+ Original encoding adds a lot of unnecessary overhead for encoded value.
83+ Therefore new encoding is added to reduce length of cookie. To simplify
84+ migration, same SecureCookie instance may decode both original and compact
85+ encodings, but generates those you choose to. By default original encoding
86+ is used therefore you may safely update this library without code change.
87+
88+ ``` go
89+ var s = securecookie.New (hashKey, blockKey)
90+ s.Compact (true ) // enable generation of compact encoding.
91+ s.Compact (false ) // disable generation of compact encoding. It is default.
92+ ```
93+
94+ Not that algorithms are fixed with compact encoding: ChaCha20 is used for
95+ stream cipher and Blake2s is used as a MAC and key expansion (to meet ChaCha20
96+ requirements for key length).
97+
8098### Key Rotation
8199Rotating keys is an important part of any security strategy. The ` EncodeMulti ` and
82100` DecodeMulti ` functions allow for multiple keys to be rotated in and out.
You can’t perform that action at this time.
0 commit comments