Skip to content

Commit

Permalink
Rename salt option to hammer home that you should not use it normally (
Browse files Browse the repository at this point in the history
…#52)

I do feel we can never win this one. React has a variable __SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED and I've inherited code that uses it in production. Your name works though.
  • Loading branch information
joshbuker committed May 21, 2021
1 parent c79362a commit 0ef1e33
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/argon2.rb
Expand Up @@ -20,7 +20,7 @@ def initialize(options = {})
@p_cost = options[:p_cost] || 1
raise ArgonHashFail, "Invalid p_cost" if @p_cost < 1 || @p_cost > 8

@salt_do_not_supply = options[:salt_do_not_supply]
@insecure_salt = options[:salt_for_testing_purposes_only]
@secret = options[:secret]
end

Expand All @@ -29,7 +29,7 @@ def create(pass)
pass.is_a?(String)

# Ensure salt is freshly generated unless it was intentionally supplied.
salt = @salt_do_not_supply || Engine.saltgen
salt = @insecure_salt || Engine.saltgen

Argon2::Engine.hash_argon2id_encode(
pass, salt, @t_cost, @m_cost, @p_cost, @secret)
Expand Down

0 comments on commit 0ef1e33

Please sign in to comment.