Documentation
¶
Overview ¶
Package cookiesignature signs and verifies cookie values using HMAC-SHA256, mirroring the behavior of the npm cookie-signature library.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Sign ¶
Sign returns value with an HMAC-SHA256 signature appended, in the form "value.signature". The signature is the base64url-encoded HMAC of value keyed by secret, with trailing '=' padding removed, matching the npm cookie-signature library.
func Unsign ¶
Unsign verifies a signed value produced by Sign against secret. It returns the original value and true when the signature is valid, or "" and false when the signature does not match or the input is malformed (for example, when it contains no '.' separator). The comparison is performed in constant time.
Types ¶
This section is empty.