1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/factories/rsa_keys.rb

12 lines
367 B
Ruby
Raw Normal View History

2019-09-10 08:08:23 -04:00
# frozen_string_literal: true
FactoryBot.define do
2019-09-13 13:14:28 -04:00
factory :rsa_key do
public_key_pem { OpenSSL::PKey::RSA.new(bits).public_key.to_pem }
2019-09-13 08:52:03 -04:00
public_key_der { OpenSSL::PKey::RSA.new(bits).public_key.to_der }
2019-09-10 08:08:23 -04:00
bits { [2048, 4096].sample }
2019-09-12 01:00:50 -04:00
sha1 { Digest::SHA1.hexdigest SecureRandom.hex }
sha256 { Digest::SHA256.hexdigest SecureRandom.hex }
2019-09-10 08:08:23 -04:00
end
end