TestNew | Basic middleware creation with default options | GET requests skip validation (default behavior) |
TestValidSignature | Valid HMAC-SHA256 signature verification | Request accepted with 200 OK |
TestInvalidSignature | Invalid signature provided | Request rejected with 401 Unauthorized |
TestMissingSignature | No signature header present | Request rejected with 401 Unauthorized |
TestSignaturePrefix | Signature with prefix (e.g., “sha256=“) | Prefix validated and stripped correctly |
TestBase64Encoding | Base64-encoded signature verification | Signature decoded and verified |
TestSHA1Algorithm | SHA-1 algorithm (legacy support) | Signature verified with SHA-1 HMAC |
TestSHA512Algorithm | SHA-512 algorithm verification | Signature verified with SHA-512 HMAC |
TestSkipPaths | Configured paths excluded from validation | Skipped paths accept requests without signatures |
TestCustomHeaderName | Custom signature header name | Signature read from custom header |
TestCustomErrorHandler | Custom error response handler | Custom error format returned on failure |
TestOnValid | Callback function on successful validation | OnValid callback executed |
TestGetInfo | Retrieve signature info from context | Info object contains validation details |
TestIsValid | Check if signature is valid | Returns true for valid signatures |
TestGitHub | GitHub webhook signature format | X-Hub-Signature-256 with sha256= prefix verified |
TestSign | Signature generation for various algorithms | Consistent signatures generated for same input |
TestSigner | Client-side request signing | Signature header added to outgoing requests |
TestSignerWithPrefix | Signer with prefix configuration | Signature includes configured prefix |
TestSignerNilBody | Signing request with nil body | Handles nil body gracefully |
TestStripe | Stripe webhook signature verification | Stripe-Signature header verified |
TestSlack | Slack signature with timestamp format | v0=HMAC(v0:timestamp:body) format verified |
TestTwilio | Twilio signature with form parameters | SHA-1 Base64 signature of URL + sorted params |
TestAWS | AWS Signature Version 4 (simplified) | Authorization header signature verified |
TestGetInfo_NoContext | GetInfo without signature middleware | Returns nil when middleware not used |
TestIsValid_NoContext | IsValid without signature middleware | Returns false when middleware not used |
TestSignaturePrefix_Missing | Required prefix not present | Request rejected with 401 Unauthorized |
TestCustomPayloadGetter | Custom payload extraction function | Uses custom payload for verification |
TestCustomPayloadGetter_Error | PayloadGetter returns error | Request rejected with 401 Unauthorized |
TestSignUnknownAlgorithm | Unknown algorithm specified | Defaults to SHA-256 |
TestSkipMethods_Custom | Custom skip methods configuration | Configured methods skip validation |
TestSignerSign_Direct | Direct Sign method on Signer | Signature added with all custom options |