about summary refs log tree commit diff
path: root/app/serializers/activitypub/public_key_serializer.rb
blob: 8621517e7cd1f788ab3e590f20b0267abab7ce63 (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.key_uri_for(object)
  end

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

  def public_key_pem
    object.public_key
  end
end