Class EventSubVerifier
java.lang.Object
com.github.twitch4j.eventsub.util.EventSubVerifier
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringJava algorithm name that corresponds toSIGNATURE_HASH_PREFIX -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanverifyMessageId(String messageId) static booleanverifySignature(byte[] secret, String messageId, String messageTimestamp, byte[] requestBody, String expectedSignature) static booleanverifySignature(String secret, String messageId, String messageTimestamp, byte[] requestBody, String expectedSignature) static booleanverifySignature(SecretKeySpec secret, String messageId, String messageTimestamp, byte[] requestBody, String expectedSignature) static booleanverifyTimestamp(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
-