DiscordPHP Documentation

Signature
in package

FinalYes

Checks the Ed25519 signature Discord puts on every request it sends to an application.

Uses PHP's bundled sodium extension, falling back to simplito/elliptic-php, which is pure PHP but much slower.

Tags
link
https://docs.discord.com/developers/interactions/overview#setting-up-an-endpoint-validating-security-request-headers
since
10.59.0

Table of Contents

Methods

assertAvailable()  : void
verify()  : bool
Whether a request was signed by Discord for this application.

Methods

assertAvailable()

public static assertAvailable() : void
Tags
throws
RuntimeException

Neither sodium nor simplito/elliptic-php is available.

verify()

Whether a request was signed by Discord for this application.

public static verify(string $publicKey, string $signature, string $timestamp, string $body) : bool
Parameters
$publicKey : string

The application's hex-encoded verify_key.

$signature : string

The X-Signature-Ed25519 header.

$timestamp : string

The X-Signature-Timestamp header.

$body : string

The raw request body.

Tags
throws
RuntimeException

Neither sodium nor simplito/elliptic-php is available.

Return values
bool
On this page

Search results