diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-12-06 07:04:49 +0100 |
---|---|---|
committer | Yamagishi Kazutoshi <ykzts@desire.sh> | 2017-12-06 15:04:49 +0900 |
commit | 42bcbd36b72c7ddc5ae1ecced09614863ca382bd (patch) | |
tree | 851a64a7930cccdcda924bc12f0493e3fb22ecf1 /app/models | |
parent | 0393a64a90c2dee17e7a9d0c1481fd4155825b85 (diff) |
Remove rabl dependency (#5894)
* Remove rabl dependency * Replicate old Oj configuration
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/account.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/models/account.rb b/app/models/account.rb index 77b78ffef..e8a8c6560 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -184,6 +184,21 @@ class Account < ApplicationRecord @keypair ||= OpenSSL::PKey::RSA.new(private_key || public_key) end + def magic_key + modulus, exponent = [keypair.public_key.n, keypair.public_key.e].map do |component| + result = [] + + until component.zero? + result << [component % 256].pack('C') + component >>= 8 + end + + result.reverse.join + end + + (['RSA'] + [modulus, exponent].map { |n| Base64.urlsafe_encode64(n) }).join('.') + end + def subscription(webhook_url) @subscription ||= OStatus2::Subscription.new(remote_url, secret: secret, webhook: webhook_url, hub: hub_url) end |