Class EventSubVerifier

java.lang.Object
com.github.twitch4j.eventsub.util.EventSubVerifier

public final class EventSubVerifier extends Object
  • Field Details

    • JAVA_HMAC_ALGORITHM

      public static final String JAVA_HMAC_ALGORITHM
      Java algorithm name that corresponds to SIGNATURE_HASH_PREFIX
      See Also:
  • Method Details

    • verifyMessageId

      public static boolean verifyMessageId(String messageId)
      Parameters:
      messageId - Twitch-Eventsub-Message-Id
      Returns:
      whether the message id has not been observed recently
    • verifyTimestamp

      public static boolean verifyTimestamp(String messageTimestamp)
      Parameters:
      messageTimestamp - Twitch-Eventsub-Message-Timestamp
      Returns:
      whether the event occurred recently
    • verifySignature

      public static boolean verifySignature(SecretKeySpec secret, String messageId, String messageTimestamp, byte[] requestBody, String expectedSignature)
      Parameters:
      secret - The subscription secret.
      messageId - Twitch-Eventsub-Message-Id
      messageTimestamp - Twitch-Eventsub-Message-Timestamp
      requestBody - The raw bytes of the request body.
      expectedSignature - Twitch-Eventsub-Message-Signature
      Returns:
      whether the signature indicates an authentic event
    • verifySignature

      public static boolean verifySignature(byte[] secret, String messageId, String messageTimestamp, byte[] requestBody, String expectedSignature)
      See Also:
    • verifySignature

      public static boolean verifySignature(String secret, String messageId, String messageTimestamp, byte[] requestBody, String expectedSignature)
      See Also: