-
Notifications
You must be signed in to change notification settings - Fork 268
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from monfresh/fix/51-encrypt-otp-secret
Add support for OTP secret key encryption
- Loading branch information
Showing
24 changed files
with
718 additions
and
275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,10 @@ | ||
class TwoFactorAuthenticationAddTo<%= table_name.camelize %> < ActiveRecord::Migration | ||
def up | ||
change_table :<%= table_name %> do |t| | ||
t.string :otp_secret_key | ||
t.integer :second_factor_attempts_count, :default => 0 | ||
end | ||
def change | ||
add_column :<%= table_name %>, :second_factor_attempts_count, :integer, default: 0 | ||
add_column :<%= table_name %>, :encrypted_otp_secret_key, :string | ||
add_column :<%= table_name %>, :encrypted_otp_secret_key_iv, :string | ||
add_column :<%= table_name %>, :encrypted_otp_secret_key_salt, :string | ||
|
||
add_index :<%= table_name %>, :otp_secret_key, :unique => true | ||
end | ||
|
||
def down | ||
remove_column :<%= table_name %>, :otp_secret_key | ||
remove_column :<%= table_name %>, :second_factor_attempts_count | ||
add_index :<%= table_name %>, :encrypted_otp_secret_key, unique: true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.