Module: SyrupPay::JwsSupportAlgorithm

Included in:
JwsSerializer
Defined in:
lib/jose/jws/jws.rb

Constant Summary collapse

ALG =
[:HS256]

Instance Method Summary collapse

Instance Method Details

#alg?(alg) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/jose/jws/jws.rb', line 8

def alg?(alg)
  ALG.include? alg
end

#json_to_hash(json) ⇒ Object



19
20
21
# File 'lib/jose/jws/jws.rb', line 19

def json_to_hash(json)
  ActiveSupport::JSON.decode(json).with_indifferent_access
end

#signature_algorithm?(alg) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
15
16
17
# File 'lib/jose/jws/jws.rb', line 12

def signature_algorithm?(alg)
  case alg
    when :HS256 then SyrupPay::Jwa::HmacSha256Signature.new
    else nil
  end
end