gaato/discord/verify does not have a README file

InteractionVerifierError

pub(all) suberror InteractionVerifierError {
InvalidPublicKeyLength(got~ : Int)
InvalidPublicKeyHex
InvalidPublicKeyEncoding
} derive(Eq,
Debug
)

Errors raised while constructing a reusable Discord interaction verifier.

InteractionVerifier

pub struct InteractionVerifier {
// private fields
}

A validated and expanded Discord interaction public key.

Construct one verifier per application public key and reuse it across requests. The expanded Ed25519 key is immutable and safe to share.

InteractionVerifier::new

Validate a Discord application's 64-character hexadecimal public key.

InteractionVerifier::verify

fn InteractionVerifier::verify(self : InteractionVerifier, signature~ : String, timestamp~ : String, body~ : BytesView) -> Bool

Verify a Discord HTTP interaction request signature.

signature is the request's 64-byte X-Signature-Ed25519 value as 128 hexadecimal characters. The signed message is the UTF-8 encoding of timestamp followed by the exact raw request body bytes.

Malformed signatures and verification failures return false.

verify_signature

fn verify_signature(public_key~ : String, signature~ : String, timestamp~ : String, body~ : BytesView) -> Bool

Verify a Discord HTTP interaction signature without retaining the key.

This convenience function validates and expands public_key on every call. Long-lived adapters should construct and reuse an InteractionVerifier instead. Malformed keys and signatures return false.

Source Files