Class GHWebhookSignature


  • public class GHWebhookSignature
    extends Object
    Utility class for dealing with signatures of incoming requests.
    Since:
    1.21.0
    See Also:
    API documentation
    • Method Detail

      • webhookSignature

        public static GHWebhookSignature webhookSignature​(String payload,
                                                          Secret secret)
        Parameters:
        payload - Clear-text to create signature of.
        secret - Key to sign with.
      • sha1

        public String sha1()
        Computes a RFC 2104-compliant HMAC digest using SHA1 of a payloadFrom with a given key (secret).
        Returns:
        HMAC digest of payloadFrom using secret as key. Will return COMPUTED_INVALID_SIGNATURE on any exception during computation.
      • matches

        public boolean matches​(String digest)
        Parameters:
        digest - computed signature from external place (GitHub)
        Returns:
        true if computed and provided signatures identical