about summary refs log tree commit diff
path: root/app/serializers/activitypub/public_key_serializer.rb
blob: 38e9e93baaac97dc6d9b42676df9b875ea0c9116 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

class ActivityPub::PublicKeySerializer < ActiveModel::Serializer
  attributes :id, :owner, :public_key_pem

  def id
    [ActivityPub::TagManager.instance.uri_for(object), '#main-key'].join
  end

  def owner
    ActivityPub::TagManager.instance.uri_for(object)
  end

  def public_key_pem
    object.public_key
  end
end