New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

devise_encryptable_aes

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

devise_encryptable_aes

  • 0.0.6
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Devise Encryptable AES

Add AES encryption support for Devise

Table of Contents

  • Getting started
  • Configuration
  • Usage

Getting started

Add the following line to your Gemfile:

gem 'devise', '~> 4.9'
gem 'devise_encryptable_aes', '~> 0.0.6'

Then run bundle install

Configuration

Add the encryptable module to your model:

class User < ActiveRecord::Base
  devise :database_authenticatable, :encryptable
end

And add the password_salt field to the database through a migration:

class DeviseCreateUsers < ActiveRecord::Migration
  def change
    add_column :users, :password_salt, :string
  end
end

Enable the AES encryptor in config/initializers/devise.rb

# Uncomment the generated pepper
config.pepper = "long random string"
# Enable the AES encryptor
config.encryptor = :aes256

Usage

Compare password

::Devise::Encryptable::Encryptors::Aes256.compare(encrypted_password, password, Devise.pepper)

Decrypt password

::Devise::Encryptable::Encryptors::Aes256.decrypt(encrypted_password, Devise.pepper)

If you get an error when using valid_password?, you can customize the valid_password? function to

  def valid_password?(password)
    ::Devise::Encryptable::Encryptors::Aes256.compare(encrypted_password, password, Devise.pepper)
  end

FAQs

Package last updated on 01 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc