Utils/Signature.php

hubspot-php · src/Utils/Signature.php · php · Apache-2.0
crm, CRM / Leads

Validates HubSpot webhook signatures across multiple versions.

// Source: https://github.com/HubSpot/hubspot-php | License: Apache-2.0 | Copyright 2014 Ryan Winchester (fungku)
// Provided via justclaw.it.com; keep this notice with the code.
<?php

namespace SevenShores\Hubspot\Utils;

use UnexpectedValueException;

class Signature
{
    /**
     * Reject the request if the timestamp is older than 5 minutes. Otherwise, proceed with validating the signature.
     * 5 minutes in milliseconds.
     */
    public const MAX_ALLOWED_TIMESTAMP = 300000;

    /**
     * Validation of Hubspot Signature.
     *
     * @param array<signature: string, secret: string, requestBody: string, httpUri: string, httpMethod: string, timestamp?: string, signatureVersion?: string, checkTimestamp?: string> $options
     * @param string $secret['signature']        hubspot sig

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key