src/main/java/com/messageyes/facebook/messenger/FacebookMessengerClient.java
public boolean isValidRequest(@NonNull String appSecretKey, @NonNull String signature, @NonNull String requestBody) {
        checkArgument(StringUtils.isNotBlank(appSecretKey), "appSecretKey cannot be blank");
        checkArgument(StringUtils.isNotBlank(signature), "signature cannot be blank");

        try {
            byte[] sha1 = HmacUtils.hmacSha1(appSecretKey.getBytes(StandardCharsets.UTF_8), requestBody.getBytes(StandardCharsets.UTF_8));
            return StringUtils.equals("sha1=" + Hex.encodeHexString(sha1), signature);
        } catch (Exception e) {
            log.error("Failed to generate hex encoded HmacSHA1 for requestBody {}", requestBody, e);
            return false;
        }
    }
/**
     * Validates the provided signature by comparing it to a HmacSHA1 encoded string generated using the
     * provided request body and app secret key.
     *
     * https://developers.facebook.com/docs/messenger-platform/webhook-reference#security
     */
Validates the provided signature by comparing it to a HmacSHA1 encoded string generated using the
provided request body and app secret key.


Validates the provided signature by comparing it to a HmacSHA1 encoded string generated using the provided request body and app secret key .
public boolean isValidRequest(@NonNull String appSecretKey, @NonNull String signature, @NonNull String requestBody) {
        checkArgument(StringUtils.isNotBlank(appSecretKey), "appSecretKey cannot be blank");
        checkArgument(StringUtils.isNotBlank(signature), "signature cannot be blank");
        try {
            byte[] sha1 = HmacUtils.hmacSha1(appSecretKey.getBytes(StandardCharsets.UTF_8), requestBody.getBytes(StandardCharsets.UTF_8));
            return StringUtils.equals("sha1=" + Hex.encodeHexString(sha1), signature);
        } catch (Exception e) {
            log.error("Failed to generate hex encoded HmacSHA1 for requestBody {}", requestBody, e);
            return false;
        }
    }
public boolean isValidRequest ( @ NonNull String appSecretKey , @ NonNull String signature , @ NonNull String requestBody ) { checkArgument ( StringUtils . isNotBlank ( appSecretKey ) , "appSecretKey cannot be blank" ) ; checkArgument ( StringUtils . isNotBlank ( signature ) , "signature cannot be blank" ) ; try { byte [ ] sha1 = HmacUtils . hmacSha1 ( appSecretKey . getBytes ( StandardCharsets . UTF_8 ) , requestBody . getBytes ( StandardCharsets . UTF_8 ) ) ; return StringUtils . equals ( "sha1=" + Hex . encodeHexString ( sha1 ) , signature ) ; } catch ( Exception e ) { log . error ( "Failed to generate hex encoded HmacSHA1 for requestBody {}" , requestBody , e ) ; return false ; } }
Validates the provided signature by comparing it to a HmacSHA1 encoded string generated using the
 provided request body and app secret key.
Validates the provided signature by comparing it to a HmacSHA1 encoded string generated using the provided request body and app secret key .