Sha256: aa93123ad7aaed1cda4f231bc6ef248a4856eb8671466791d38c43ba4022e872

Contents?: true

Size: 770 Bytes

Versions: 16

Compression:

Stored size: 770 Bytes

Contents

#!/usr/bin/env ruby

require 'openssl'
require 'base64'
require 'json'
require 'date'

PRIVATE_KEY_LOCATION = File.join(Dir.home, '.ssh', 'karafka-pro', 'id_rsa')

# Name of the entity that acquires the license
ENTITY = ARGV[0]
# Date till which license is valid
EXPIRES_ON = Date.parse(ARGV[1])

raise ArgumentError, 'Entity missing' if ENTITY.nil? || ENTITY.empty?
raise ArgumentError, 'Expires on needs to be in the future' if EXPIRES_ON <= Date.today

pro_token_data = {
  entity: ENTITY,
  expires_on: EXPIRES_ON
}

# This code uses my private key to generate a new token for Karafka Pro capabilities
private_key = OpenSSL::PKey::RSA.new(File.read(PRIVATE_KEY_LOCATION))

bin_key = private_key.private_encrypt(pro_token_data.to_json)

puts Base64.encode64(bin_key)

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
karafka-2.0.0.rc5 bin/create_token
karafka-2.0.0.rc4 bin/create_token
karafka-2.0.0.rc3 bin/create_token
karafka-2.0.0.rc2 bin/create_token
karafka-2.0.0.rc1 bin/create_token
karafka-2.0.0.beta5 bin/create_token
karafka-2.0.0.beta4 bin/create_token
karafka-2.0.0.beta3 bin/create_token
karafka-2.0.0.beta2 bin/create_token
karafka-2.0.0.beta1 bin/create_token
karafka-2.0.0.alpha6 bin/create_token
karafka-2.0.0.alpha5 bin/create_token
karafka-2.0.0.alpha4 bin/create_token
karafka-2.0.0.alpha3 bin/create_token
karafka-2.0.0.alpha2 bin/create_token
karafka-2.0.0.alpha1 bin/create_token