浏览代码

Add ActivityPub Move validator

Daniel Supernault 10 月之前
父节点
当前提交
909a6c725b
共有 1 个文件被更改,包括 23 次插入0 次删除
  1. 23 0
      app/Util/ActivityPub/Validator/MoveValidator.php

+ 23 - 0
app/Util/ActivityPub/Validator/MoveValidator.php

@@ -0,0 +1,23 @@
+<?php
+
+namespace App\Util\ActivityPub\Validator;
+
+use Illuminate\Validation\Rule;
+use Validator;
+
+class MoveValidator
+{
+    public static function validate($payload)
+    {
+        return Validator::make($payload, [
+            '@context' => 'required',
+            'type' => [
+                'required',
+                Rule::in(['Move']),
+            ],
+            'actor' => 'required|url',
+            'object' => 'required|url',
+            'target' => 'required|url',
+        ])->passes();
+    }
+}