48 lines
1.2 KiB
PHP
48 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* Interface for HTTP Signature.
|
|
*
|
|
* This interface defines the methods required for verifying HTTP signatures
|
|
* according to various standards, such as Draft Cavage and HTTP Message Signature.
|
|
*
|
|
* @package Activitypub\Signature
|
|
*/
|
|
|
|
namespace Activitypub\Signature;
|
|
|
|
/**
|
|
* Interface Http_Signature.
|
|
*/
|
|
interface Http_Signature {
|
|
|
|
/**
|
|
* Generate Signature headers for an outgoing HTTP request.
|
|
*
|
|
* @param array $args The request arguments.
|
|
* @param string $url The request URL.
|
|
*
|
|
* @return array Request arguments with signature headers.
|
|
*/
|
|
public function sign( $args, $url );
|
|
|
|
/**
|
|
* Verify the HTTP Signature against a request.
|
|
*
|
|
* @since 9.0.0 Returns the verified keyId on success instead of `true`.
|
|
*
|
|
* @param array $headers The HTTP headers.
|
|
* @param string|null $body The request body, if applicable.
|
|
* @return string|\WP_Error The verified keyId on success, WP_Error on failure.
|
|
*/
|
|
public function verify( array $headers, $body = null );
|
|
|
|
/**
|
|
* Generate a digest for the request body.
|
|
*
|
|
* @param string $body The request body.
|
|
*
|
|
* @return string The digest.
|
|
*/
|
|
public function generate_digest( $body );
|
|
}
|