Module: Toktok
- Defined in:
- lib/toktok.rb,
lib/toktok/token.rb,
lib/toktok/version.rb,
lib/toktok/configuration.rb
Defined Under Namespace
Classes: Configuration, Token
Constant Summary collapse
- InvalidIdentity =
Class.new(StandardError)
- InvalidSignature =
Class.new(StandardError)
- VERSION =
'0.2.0'
Class Method Summary collapse
-
.algorithm=(value) ⇒ String
Set the algorithm used to encode and decode JWT tokens (default: HS256).
-
.config ⇒ Toktok::Configuration
Gets a Toktok::Configuration instance using the module values.
-
.lifetime=(value) ⇒ Integer?
Set the lifetime in seconds before a token expires (default: nil).
-
.secret_key=(value) ⇒ String
Set the secret key that will be used to encode and decode JWT tokens.
Class Method Details
.algorithm=(value) ⇒ String
Set the algorithm used to encode and decode JWT tokens (default: HS256)
Acceptable values are:
-
none
-
HS256, HS384, HS512
-
RS256, RS384, RS512
-
ES256, ES384, ES512
16 17 18 |
# File 'lib/toktok.rb', line 16 def self.algorithm=(value) @algorithm = value end |
.config ⇒ Toktok::Configuration
Gets a Toktok::Configuration instance using the module values.
38 39 40 41 42 43 44 |
# File 'lib/toktok.rb', line 38 def self.config ::Toktok::Configuration.new( algorithm: @algorithm, lifetime: @lifetime, secret_key: @secret_key ) end |
.lifetime=(value) ⇒ Integer?
Set the lifetime in seconds before a token expires (default: nil)
24 25 26 |
# File 'lib/toktok.rb', line 24 def self.lifetime=(value) @lifetime = value end |
.secret_key=(value) ⇒ String
Set the secret key that will be used to encode and decode JWT tokens
31 32 33 |
# File 'lib/toktok.rb', line 31 def self.secret_key=(value) @secret_key = value end |