InstanceActor.php 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Factories\HasFactory;
  4. use Illuminate\Database\Eloquent\Model;
  5. class InstanceActor extends Model
  6. {
  7. use HasFactory;
  8. const PROFILE_BASE = '/i/actor';
  9. const KEY_ID = '/i/actor#main-key';
  10. const PROFILE_KEY = 'federation:_v3:instance:actor:profile';
  11. const PKI_PUBLIC = 'federation:_v1:instance:actor:profile:pki_public';
  12. const PKI_PRIVATE = 'federation:_v1:instance:actor:profile:pki_private';
  13. public function permalink($suffix = '')
  14. {
  15. return url(self::PROFILE_BASE . $suffix);
  16. }
  17. public function getActor()
  18. {
  19. return [
  20. "@context" => [
  21. "https://www.w3.org/ns/activitystreams",
  22. "https://w3id.org/security/v1",
  23. [
  24. "manuallyApprovesFollowers" => "as:manuallyApprovesFollowers",
  25. "toot" => "http://joinmastodon.org/ns#",
  26. "featured" => [
  27. "@id" => "toot:featured",
  28. "@type" => "@id"
  29. ],
  30. "featuredTags" => [
  31. "@id" => "toot:featuredTags",
  32. "@type" => "@id"
  33. ],
  34. "alsoKnownAs" => [
  35. "@id" => "as:alsoKnownAs",
  36. "@type" => "@id"
  37. ],
  38. "movedTo" => [
  39. "@id" => "as:movedTo",
  40. "@type" => "@id"
  41. ],
  42. "schema" => "http://schema.org#",
  43. "PropertyValue" => "schema:PropertyValue",
  44. "value" => "schema:value",
  45. "discoverable" => "toot:discoverable",
  46. "Device" => "toot:Device",
  47. "Ed25519Signature" => "toot:Ed25519Signature",
  48. "Ed25519Key" => "toot:Ed25519Key",
  49. "Curve25519Key" => "toot:Curve25519Key",
  50. "EncryptedMessage" => "toot:EncryptedMessage",
  51. "publicKeyBase64" => "toot:publicKeyBase64",
  52. "deviceId" => "toot:deviceId",
  53. "claim" => [
  54. "@type" => "@id",
  55. "@id" => "toot:claim"
  56. ],
  57. "fingerprintKey" => [
  58. "@type" => "@id",
  59. "@id" => "toot:fingerprintKey"
  60. ],
  61. "identityKey" => [
  62. "@type" => "@id",
  63. "@id" => "toot:identityKey"
  64. ],
  65. "devices" => [
  66. "@type" => "@id",
  67. "@id" => "toot:devices"
  68. ],
  69. "messageFranking" => "toot:messageFranking",
  70. "messageType" => "toot:messageType",
  71. "cipherText" => "toot:cipherText",
  72. "suspended" => "toot:suspended"
  73. ]
  74. ],
  75. 'id' => $this->permalink(),
  76. 'type' => 'Application',
  77. 'inbox' => $this->permalink('/inbox'),
  78. 'outbox' => $this->permalink('/outbox'),
  79. 'preferredUsername' => config('pixelfed.domain.app'),
  80. 'publicKey' => [
  81. 'id' => $this->permalink('#main-key'),
  82. 'owner' => $this->permalink(),
  83. 'publicKeyPem' => $this->public_key
  84. ],
  85. 'manuallyApprovesFollowers' => true,
  86. 'url' => url('/site/kb/instance-actor')
  87. ];
  88. }
  89. }