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

class ActivityPub::PublicKeySerializer < ActivityPub::Serializer
  context :security

  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