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

15 lines
461 B
Ruby

# frozen_string_literal: true
FactoryBot.define do
factory :rsa_key do
association :account, factory: :usual_account
public_key_pem { OpenSSL::PKey::RSA.new(bits).public_key.to_pem }
public_key_der { OpenSSL::PKey::RSA.new(bits).public_key.to_der }
has_password { [false, true].sample }
bits { [2048, 4096].sample }
sha1 { Digest::SHA1.hexdigest SecureRandom.hex }
sha256 { Digest::SHA256.hexdigest SecureRandom.hex }
end
end