Module: TinyAuth
- Defined in:
- lib/tiny_auth.rb,
lib/tiny_auth/model.rb,
lib/tiny_auth/version.rb,
lib/tiny_auth/controller.rb
Defined Under Namespace
Modules: Model Classes: Controller
Constant Summary collapse
- VERSION =
"2.0.0"
Class Method Summary collapse
-
.hexdigest(value) ⇒ String
Create a hash from a value using the secret.
-
.secret ⇒ String
A secret that is used for hashing tokens.
-
.secret=(secret) ⇒ Object
Configure the secret that is used for hashing tokens.
Class Method Details
.hexdigest(value) ⇒ String
Create a hash from a value using the secret
28 29 30 |
# File 'lib/tiny_auth.rb', line 28 def hexdigest(value) OpenSSL::HMAC.hexdigest("SHA256", secret, value) end |
.secret ⇒ String
A secret that is used for hashing tokens.
If Rails is defined, it will attempt to use Rails.application.secret_key_base.
15 16 17 |
# File 'lib/tiny_auth.rb', line 15 def secret @secret || secret_key_base || missing_secret! end |
.secret=(secret) ⇒ Object
Configure the secret that is used for hashing tokens.
21 22 23 |
# File 'lib/tiny_auth.rb', line 21 def secret=(secret) @secret = secret end |