Sha256: 7864f406024375d6eacd7d21f31a7da4ee8ccbd3075a12092a2a03401766daa0
Contents?: true
Size: 831 Bytes
Versions: 1
Compression:
Stored size: 831 Bytes
Contents
require 'syruppay_jose' module BjondJwt def jwt_encode_payload(json, bjond_registration) payload = { :json => json.to_json, :iss => 'Bjönd, Inc.', :aud => ENV['BJOND_ADAPTER_AUDIENCE'], :exp => Time.now.to_i + 10*3600, :nbf => Time.now.to_i - 2*3600, :sub => ENV['BJOND_ADAPTER_SUBJECT'] }.to_json header = {:alg => 'A128KW', :enc => 'A128CBC-HS256'} return SyrupPay::JsonEncryptionCompactSerialization.serialization(Base64.decode64(bjond_registration.encryption_key), header, payload) end def jwt_decode_payload_and_return_json(token, bjond_registration) claims_json = SyrupPay::CompactDeserialization.deserialization(Base64.decode64(bjond_registration.encryption_key), token) claims = JSON.parse(claims_json) return JSON.parse(claims['json'][0]) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bjond-api-0.1.4 | lib/bjond-jwt.rb |