NAME
Discord::Client::Interaction::Verifier - Discord Ed25519 request verification
SYNOPSIS
use Discord::Client::Interaction::Verifier;
# Verify the timestamp and exact raw body before parsing JSON.
my $verifier = Discord::Client::Interaction::Verifier->new(public_key => $key);
my $valid = $verifier->verify($signature_hex, $timestamp, $raw_body);
DESCRIPTION
Checks Discord request signatures using Ed25519. Discord::Client::HTTPInteractions applies it before dispatch.
METHODS
new
new(public_key => $key, max_age => 300) returns a verifier. The public key must be 64 hexadecimal characters. Invalid configuration throws. max_age is the allowed difference from the local wall clock in seconds; zero disables this SDK freshness policy. wall_clock can supply a callback returning Unix seconds for testing.
verify
verify(signature_hex, timestamp, raw_body) returns a boolean synchronously. The signature must be 128 hexadecimal characters and the timestamp a decimal string. raw_body must contain exact octets, before decoding or reserializing. Verification covers the timestamp followed by those bytes. Invalid arguments, failed signatures and stale timestamps return false.
LICENSE
Apache License 2.0.