https://github.com/openware/rails5session-go
Go decrypter of Rails 5 sessions.
https://github.com/openware/rails5session-go
Last synced: 8 months ago
JSON representation
Go decrypter of Rails 5 sessions.
- Host: GitHub
- URL: https://github.com/openware/rails5session-go
- Owner: openware
- Created: 2018-10-02T13:00:06.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-02T13:05:01.000Z (over 7 years ago)
- Last Synced: 2025-07-18T14:53:53.137Z (8 months ago)
- Language: Go
- Homepage:
- Size: 3.91 KB
- Stars: 3
- Watchers: 2
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# rails5session-go
[](https://godoc.org/github.com/openware/rails5session-go)
Go decrypter of Rails 5 sessions.
## Installation
```
go get github.com/openware/rails5session-go
```
## Usage
Create Encryption instance with your rails session secret key base (specified
in config/secrets.yml)
```go
encryption := rails5session.NewEncryption(
secretKeyBase,
cookieSalt,
signedCookieSalt,
)
```
* You can obtain your cookieSalt by running following ruby code:
```ruby
Rails.application.encryption.action_dispatch.encrypted_cookie_salt
```
* You can obtain your signedCookieSalt by running following ruby code:
```ruby
Rails.application.encryption.action_dispatch.encrypted_signed_cookie_salt
```
Then verify and decrypt user's cookie, it will return decrypted slice of bytes
and error if any.
```go
data, err := rails5session.VerifyAndDecryptCookieSession(encryption, cookie)
if err != nil {
panic(err)
}
```
Also, take a look at [tests](decrypt_test.go).