Sha256: a1328f475fa05c273580fc32e3bb46ea73b9bb7de3583b599afda84decb1eee3

Contents?: true

Size: 1.44 KB

Versions: 1

Compression:

Stored size: 1.44 KB

Contents

# Refcode

Currently a standalone gem for converting arbitrary Ruby objects into encrypted,
URL-safe strings. The strings can be simply decrypted later to be used by your
application.

Refcode was conceived as a way to attach referral data to tracking links. Encryption
makes it unlikely that the links can be tampered with.

## Implementation

- **Encryption** using the AES-256-CBC algorithm with https://github.com/attr-encrypted/encryptor which wraps the Ruby OpenSSL library.

- **Base64 encoding** is handled by https://github.com/nojima/base64url which implements a slight tweak to the standard Base64 algorithm to create URL-safe strings.

- **Serialization** with YAML.

## Installation

Add this line to your application's Gemfile:

    gem 'refcode'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install refcode

## Usage

    encoder = Refcode::Encoder.new do |e|
      e.secret = "a long crunchy secret"
      e.salt = "some salt"
    end

    something = OpenStruct.new(channel: 'facebook', action: 'message', user_id: 43765)
    encoded_param = encoder.encode something

    # in some future request...

    something = encoder.decode params[:encoded_param]
    puts something.channel # 'facebook'

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
refcode-0.0.1 README.md