theseus/app/lib/external_token.rb
2025-05-31 23:25:41 -04:00

11 lines
No EOL
301 B
Ruby

class ExternalToken < SimpleStructuredSecrets
def initialize(type)
@org = "th"
@type = type
end
def generate
random = base62_encode(SecureRandom.rand(10 ** 60)).to_s[0...30]
"#{@org}_#{@type}_#{Rails.env.production? ? "live" : "dev"}_#{random}#{calc_checksum(random)}"
end
end