class FollowRemoteAccountService < BaseService
+ include OStatus2::MagicKey
+
# Find or create a local account for a remote user.
# When creating, look up the user's webfinger and fetch all
# important information from their feed
update_remote_profile_service.call(author, account)
end
- def magic_key_to_pem(magic_key)
- _, modulus, exponent = magic_key.split('.')
- modulus, exponent = [modulus, exponent].map { |n| Base64.urlsafe_decode64(n).bytes.inject(0) { |a, e| (a << 8) | e } }
-
- key = OpenSSL::PKey::RSA.new
- key.n = modulus
- key.e = exponent
-
- key.to_pem
- end
-
def update_remote_profile_service
@update_remote_profile_service ||= UpdateRemoteProfileService.new
end