From f16b31f0773c2fd1122ff0ad98cb392e762f0d0b Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 26 Feb 2016 15:28:08 +0100 Subject: Adding a bunch of tests --- app/models/account.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/models/account.rb') diff --git a/app/models/account.rb b/app/models/account.rb index 2cbec488b..1b4f4ebdf 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -59,4 +59,12 @@ class Account < ActiveRecord::Base def subscription(webhook_url) @subscription ||= OStatus2::Subscription.new(self.remote_url, secret: self.secret, token: self.verify_token, webhook: webhook_url, hub: self.hub_url) end + + before_create do + if local? + keypair = OpenSSL::PKey::RSA.new(Rails.env.test? ? 48 : 2048) + self.private_key = keypair.to_pem + self.public_key = keypair.public_key.to_pem + end + end end -- cgit