I have a very small ruby script that I need to run in scala either by straightway running the sript which according to resources online is possible through org.jruby but the dependency doesn't work for me in build.sbt or by writing the same logic in scala but I am not able to get the logic correct for Ruby's ActiveSupport encryptor.
The intention is to create a scala web api which folks can utilize to retrive the passwords based on inputs. Thanks in advance.
Following is the script that I need to run:
# Usage: ./gen_password.rb SECRET ID URL
# Example: ./gen_password.rb 73191239133f 1234567 myshop.com
# Note: 73191239133f is a fake secret. It will not work.
require "active_support/all"
SECRET = ARGV[0]
ID = ARGV[1]
URL = ARGV[2]
encryptor = ActiveSupport::MessageEncryptor.new(SECRET)
puts("#{ID}+#{URL}+#{Time.now.utc.to_i}")
puts encryptor.encrypt_and_sign("#{ID}+#{URL}+#{Time.now.utc.to_i}")