|
4 | 4 | use WP_Error;
|
5 | 5 | use DateTime;
|
6 | 6 | use DateTimeZone;
|
| 7 | +use WP_REST_Request; |
7 | 8 | use Activitypub\Collection\Users;
|
8 | 9 |
|
9 | 10 | /**
|
@@ -226,7 +227,7 @@ public static function generate_signature( $user_id, $http_method, $url, $date,
|
226 | 227 | /**
|
227 | 228 | * Verifies the http signatures
|
228 | 229 | *
|
229 |
| - * @param WP_REQUEST|array $request The request object or $_SERVER array. |
| 230 | + * @param WP_REST_Request|array $request The request object or $_SERVER array. |
230 | 231 | *
|
231 | 232 | * @return mixed A boolean or WP_Error.
|
232 | 233 | */
|
@@ -323,17 +324,25 @@ public static function verify_http_signature( $request ) {
|
323 | 324 | *
|
324 | 325 | * @param string $key_id The URL to the public key.
|
325 | 326 | *
|
326 |
| - * @return WP_Error|string The public key. |
| 327 | + * @return WP_Error|string The public key or WP_Error. |
327 | 328 | */
|
328 | 329 | public static function get_remote_key( $key_id ) { // phpcs:ignore
|
329 | 330 | $actor = get_remote_metadata_by_actor( strip_fragment_from_url( $key_id ) ); // phpcs:ignore
|
330 | 331 | if ( \is_wp_error( $actor ) ) {
|
331 |
| - return new WP_Error( 'activitypub_no_remote_profile_found', __( 'No Profile found or Profile not accessible', 'activitypub' ), array( 'status' => 401 ) ); |
| 332 | + return new WP_Error( |
| 333 | + 'activitypub_no_remote_profile_found', |
| 334 | + __( 'No Profile found or Profile not accessible', 'activitypub' ), |
| 335 | + array( 'status' => 401 ) |
| 336 | + ); |
332 | 337 | }
|
333 | 338 | if ( isset( $actor['publicKey']['publicKeyPem'] ) ) {
|
334 | 339 | return \rtrim( $actor['publicKey']['publicKeyPem'] ); // phpcs:ignore
|
335 | 340 | }
|
336 |
| - return new WP_Error( 'activitypub_no_remote_key_found', __( 'No Public-Key found', 'activitypub' ), array( 'status' => 401 ) ); |
| 341 | + return new WP_Error( |
| 342 | + 'activitypub_no_remote_key_found', |
| 343 | + __( 'No Public-Key found', 'activitypub' ), |
| 344 | + array( 'status' => 401 ) |
| 345 | + ); |
337 | 346 | }
|
338 | 347 |
|
339 | 348 | /**
|
|
0 commit comments