rails

package
v1.14.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeSignedCookie

func DecodeSignedCookie(secretKeyBase string, decodedCookie string, cookieName string) (map[string]any, error)

DecodeSignedCookie decrypts a Rails 7.1+ encrypted cookie using the provided secretKeyBase and validates that its purpose matches the given cookieName. It returns the decoded session payload (the JSON contained in _rails.message).

The Rails encrypted cookie format is: base64(data)--base64(iv)--base64(authTag) Key derivation: PBKDF2-HMAC-SHA256(secret_key_base, "authenticated encrypted cookie", 1000, 32) Cipher: AES-256-GCM, AAD: empty

func UserIDFromSession

func UserIDFromSession(session map[string]any) (any, bool)

UserIDFromSession tries to extract the warden user id from a Rails session. It returns the id and true if found, otherwise (nil, false).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL