Sha256: 8369daf8e8237d67ad641df05a10f6a2a012d37c965ea45018edf7c656b137fa

Contents?: true

Size: 444 Bytes

Versions: 1

Compression:

Stored size: 444 Bytes

Contents

# frozen_string_literal: true
require_relative 'simplecov_helper'
require 'bundler/setup'
require 'logger'
require 'decode_this'

DecodeThis.env = :test

def encode(payload, config_path = nil)
  config = YAML.load(File.open(config_path))[DecodeThis.env] || DecodeThis.config
  private_key = OpenSSL::PKey::RSA.new(File.read(config['key_path']))
  "#{config['authorization_scheme']} " + JWT.encode(payload, private_key, config['algorithm'])
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
decode_this-0.1.7 spec/spec_helper.rb