Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Devise password encryption

Hey so I was using Rails for my app but now I'm migrating to ReactJs + Node.

I cannot discover how Devise encrypted the password so I can send the request from my frontend to my backend.

I'm using Postgres for my db.

like image 904
Gonzalo4488 Avatar asked Mar 30 '18 15:03

Gonzalo4488


People also ask

Is rails devise secure?

If you're using Rails to build your application, you can use Devise, a gem which is designed to make authentication easy. Fortunately, Devise has been used in production applications for years. It's known to be secure.

Is BCrypt secure?

The result of bcrypt achieves core properties of a secure password function as defined by its designers: It's preimage resistant. The salt space is large enough to mitigate precomputation attacks, such as rainbow tables. It has an adaptable cost.


1 Answers

Devise is using bcrypt gem for encryption (https://github.com/codahale/bcrypt-ruby), you can also look at how Devise is doing it here: https://github.com/plataformatec/devise/blob/f39c6fd92774cb66f96f546d8d5e8281542b4e78/lib/devise/encryptor.rb

For more details on the algorithm, you can look here: https://github.com/codahale/bcrypt-ruby/blob/master/lib/bcrypt/password.rb

Hope that helps

like image 70
The Lazy Log Avatar answered Oct 28 '22 06:10

The Lazy Log