diff options
Diffstat (limited to 'app/models/account.rb')
-rw-r--r-- | app/models/account.rb | 8 |
1 files changed, 8 insertions, 0 deletions
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 |