Class EventSubVerifier
java.lang.Object
com.github.twitch4j.eventsub.util.EventSubVerifier
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Java algorithm name that corresponds toSIGNATURE_HASH_PREFIX
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
verifyMessageId
(String messageId) static boolean
verifySignature
(byte[] secret, String messageId, String messageTimestamp, byte[] requestBody, String expectedSignature) static boolean
verifySignature
(String secret, String messageId, String messageTimestamp, byte[] requestBody, String expectedSignature) static boolean
verifySignature
(SecretKeySpec secret, String messageId, String messageTimestamp, byte[] requestBody, String expectedSignature) static boolean
verifyTimestamp
(String messageTimestamp)
-
Field Details
-
JAVA_HMAC_ALGORITHM
Java algorithm name that corresponds toSIGNATURE_HASH_PREFIX
- See Also:
-
-
Method Details
-
verifyMessageId
- Parameters:
messageId
- Twitch-Eventsub-Message-Id- Returns:
- whether the message id has not been observed recently
-
verifyTimestamp
- 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-IdmessageTimestamp
- Twitch-Eventsub-Message-TimestamprequestBody
- The raw bytes of the request body.expectedSignature
- Twitch-Eventsub-Message-Signature- Returns:
- whether the signature indicates an authentic event
-
verifySignature
-
verifySignature
-