Class: Contracts::Algorithm

Inherits:
Object
  • Object
show all
Defined in:
lib/custom_contracts.rb

Class Method Summary collapse

Class Method Details

.to_sObject



56
57
58
# File 'lib/custom_contracts.rb', line 56

def self.to_s
  'A valid JWT token signature algorithm, or none'
end

.valid?(val) ⇒ Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/custom_contracts.rb', line 52

def self.valid?(val)
  C::Enum['none', 'HS256', 'HS384', 'HS512', 'RS256', 'RS384', 'RS512', 'ES256', 'ES384', 'ES512'].valid?(val)
end