devise-passkeys 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Devise
4
- module Passkeys
5
- module Controllers
6
- module Concerns
7
- module PasskeyReauthentication
8
- extend ActiveSupport::Concern
9
-
10
- def store_reauthentication_token_in_session
11
- session[passkey_reauthentication_token_key] = Devise.friendly_token(50)
12
- end
13
-
14
- def stored_reauthentication_token
15
- session[passkey_reauthentication_token_key]
16
- end
17
-
18
- def clear_reauthentication_token!
19
- session.delete(passkey_reauthentication_token_key)
20
- end
21
-
22
- def consume_reauthentication_token!
23
- value = stored_reauthentication_token
24
- clear_reauthentication_token!
25
- value
26
- end
27
-
28
- def valid_reauthentication_token?(given_reauthentication_token:)
29
- Devise.secure_compare(consume_reauthentication_token!, given_reauthentication_token)
30
- end
31
-
32
- def passkey_reauthentication_token_key
33
- "#{resource_name}_current_reauthentication_token"
34
- end
35
- end
36
- end
37
- end
38
- end
39
- end