Skip to content

Commit

Permalink
fix encryptable move for CRYPTOPUS 5.0 (#738)
Browse files Browse the repository at this point in the history
* fix encryptable move

* remove users_private_key method
  • Loading branch information
njaeggi authored Jul 7, 2023
1 parent 0c51567 commit 0d1ca83
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/controllers/api/encryptables_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def query_param
end

def encryptable_move_handler
EncryptableMoveHandler.new(entry, users_private_key, current_user)
EncryptableMoveHandler.new(entry, session[:private_key], current_user)
end

def ivar_name
Expand Down
5 changes: 1 addition & 4 deletions app/controllers/api_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def user_not_authorized(_exception)
def decrypted_team_password(team)
return plaintext_team_password(team) if active_session?

users_private_key = current_user.decrypt_private_key(password_header)
team_password = team.decrypt_team_password(current_user, users_private_key)
raise 'Failed to decrypt the team password' if team_password.blank?

Expand Down Expand Up @@ -105,8 +106,4 @@ def user_authenticator
@user_authenticator ||=
Authentication::UserAuthenticator.init(username: username, password: password_header)
end

def users_private_key
current_user.decrypt_private_key(password_header)
end
end

0 comments on commit 0d1ca83

Please sign in to comment.