@@ -247,7 +247,7 @@ public static function verify_http_signature( $request ) {
247247 }
248248
249249 if ( ! isset ( $ headers ['signature ' ] ) ) {
250- return new WP_Error ( 'activitypub_signature ' , 'Request not signed ' , array ( 'status ' => 403 ) );
250+ return new WP_Error ( 'activitypub_signature ' , __ ( 'Request not signed ' , ' activitypub ' ) , array ( 'status ' => 403 ) );
251251 }
252252
253253 if ( array_key_exists ( 'signature ' , $ headers ) ) {
@@ -257,7 +257,7 @@ public static function verify_http_signature( $request ) {
257257 }
258258
259259 if ( ! isset ( $ signature_block ) || ! $ signature_block ) {
260- return new WP_Error ( 'activitypub_signature ' , 'Incompatible request signature. keyId and signature are required ' , array ( 'status ' => 403 ) );
260+ return new WP_Error ( 'activitypub_signature ' , __ ( 'Incompatible request signature. keyId and signature are required ' , ' activitypub ' ) , array ( 'status ' => 403 ) );
261261 }
262262
263263 $ signed_headers = $ signature_block ['headers ' ];
@@ -267,12 +267,12 @@ public static function verify_http_signature( $request ) {
267267
268268 $ signed_data = self ::get_signed_data ( $ signed_headers , $ signature_block , $ headers );
269269 if ( ! $ signed_data ) {
270- return new WP_Error ( 'activitypub_signature ' , 'Signed request date outside acceptable time window ' , array ( 'status ' => 403 ) );
270+ return new WP_Error ( 'activitypub_signature ' , __ ( 'Signed request date outside acceptable time window ' , ' activitypub ' ) , array ( 'status ' => 403 ) );
271271 }
272272
273273 $ algorithm = self ::get_signature_algorithm ( $ signature_block );
274274 if ( ! $ algorithm ) {
275- return new WP_Error ( 'activitypub_signature ' , 'Unsupported signature algorithm (only rsa-sha256 and hs2019 are supported) ' , array ( 'status ' => 403 ) );
275+ return new WP_Error ( 'activitypub_signature ' , __ ( 'Unsupported signature algorithm (only rsa-sha256 and hs2019 are supported) ' , ' activitypub ' ) , array ( 'status ' => 403 ) );
276276 }
277277
278278 if ( \in_array ( 'digest ' , $ signed_headers , true ) && isset ( $ body ) ) {
@@ -288,7 +288,7 @@ public static function verify_http_signature( $request ) {
288288 }
289289
290290 if ( \base64_encode ( \hash ( $ hashalg , $ body , true ) ) !== $ digest [1 ] ) { // phpcs:ignore
291- return new WP_Error ( 'activitypub_signature ' , 'Invalid Digest header ' , array ( 'status ' => 403 ) );
291+ return new WP_Error ( 'activitypub_signature ' , __ ( 'Invalid Digest header ' , ' activitypub ' ) , array ( 'status ' => 403 ) );
292292 }
293293 }
294294
@@ -301,7 +301,7 @@ public static function verify_http_signature( $request ) {
301301 $ verified = \openssl_verify ( $ signed_data , $ signature_block ['signature ' ], $ public_key , $ algorithm ) > 0 ;
302302
303303 if ( ! $ verified ) {
304- return new WP_Error ( 'activitypub_signature ' , 'Invalid signature ' , array ( 'status ' => 403 ) );
304+ return new WP_Error ( 'activitypub_signature ' , __ ( 'Invalid signature ' , ' activitypub ' ) , array ( 'status ' => 403 ) );
305305 }
306306 return $ verified ;
307307 }
@@ -321,7 +321,7 @@ public static function get_remote_key( $key_id ) { // phpcs:ignore
321321 if ( isset ( $ actor ['publicKey ' ]['publicKeyPem ' ] ) ) {
322322 return \rtrim ( $ actor ['publicKey ' ]['publicKeyPem ' ] ); // phpcs:ignore
323323 }
324- return new WP_Error ( 'activitypub_no_remote_key_found ' , 'No Public-Key found ' );
324+ return new WP_Error ( 'activitypub_no_remote_key_found ' , __ ( 'No Public-Key found ' , ' activitypub ' ), array ( ' status ' => 403 ) );
325325 }
326326
327327 /**
0 commit comments