Skip to content

Latest commit

 

History

History
31 lines (20 loc) · 520 Bytes

File metadata and controls

31 lines (20 loc) · 520 Bytes

BCrypt

We provide helper for storing encrypted password. See example below:

class User
  include Clear::Model
  primary_key :id, type: :uuid
  
  column encrypted_password : Crypto::Bcrypt::Password
  
  def password=(x)
    self.encrypted_password = Crypto::Bcrypt::Password.create(x)
  end  
end


# Create a new user with the password
User.create!({password: "helloworld"})

#...

# Get the created user
user = User.query.first

if user.encrypted_password.verify("thisisfalse") # < false
  #...
end