Sha256: e24379191948f38f62ef4aaff9061cb5abfc8a4a48a74b63d186440ee6e51eda
Contents?: true
Size: 525 Bytes
Versions: 2
Compression:
Stored size: 525 Bytes
Contents
module MaticJWT class Generator def initialize(expiration: EXPIRATION, scheme: SCHEME) @expiration = expiration @scheme = scheme end def token_for(client_name, secret, payload = {}) jwt_payload = payload.merge(client_name: client_name, exp: @expiration.since.to_i) JWT.encode(jwt_payload, secret, ALGORITHM) end def authentication_header_for(client_name, secret, payload = {}) token = token_for(client_name, secret, payload) "#{@scheme} #{token}" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
matic-jwt-1.2.1 | lib/matic-jwt/generator.rb |
matic-jwt-1.2.0 | lib/matic-jwt/generator.rb |