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