diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 284ce93..f7e971e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.60.0" + ".": "0.61.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index d3efbb5..e4ce02b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 234 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-dd0c83cac837fbe98857fa997663b0d0469344a7564bd4fe506e6c71d1d6af73.yml openapi_spec_hash: 2352f37602105b164533038199b21804 -config_hash: 890ca5fa6b8209d4eaac90550c7dc62c +config_hash: b7ec7f54fa76c1f8bde7a548710a1d38 diff --git a/CHANGELOG.md b/CHANGELOG.md index 62ee74d..48e0381 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.61.0 (2026-03-08) + +Full Changelog: [v0.60.0...v0.61.0](https://github.com/Increase/increase-php/compare/v0.60.0...v0.61.0) + +### Features + +* **api:** api update ([0fca601](https://github.com/Increase/increase-php/commit/0fca60181f7b0bc6cdb05923fc0fb818c43932c4)) + ## 0.60.0 (2026-03-06) Full Changelog: [v0.59.0...v0.60.0](https://github.com/Increase/increase-php/compare/v0.59.0...v0.60.0) diff --git a/README.md b/README.md index a26e79e..4f321d7 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ The REST API documentation can be found on [increase.com](https://increase.com/d ``` -composer require "increase/increase 0.60.0" +composer require "increase/increase 0.61.0" ``` diff --git a/src/Services/EventsService.php b/src/Services/EventsService.php index 4eedd64..593afeb 100644 --- a/src/Services/EventsService.php +++ b/src/Services/EventsService.php @@ -121,7 +121,7 @@ public function unwrap( try { $flatHeaders = array_map(fn (string|array $v): string => is_array($v) ? $v[0] : $v, $headers); - $webhook = new Webhook($secret); + $webhook = new Webhook('whsec_'.base64_encode($secret)); $webhook->verify($body, $flatHeaders); } catch (WebhookVerificationException $e) { throw new WebhookException('Could not verify webhook event signature', previous: $e); diff --git a/src/Version.php b/src/Version.php index 534ca6d..a5f14ae 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace Increase; // x-release-please-start-version -const VERSION = '0.60.0'; +const VERSION = '0.61.0'; // x-release-please-end diff --git a/tests/Services/EventsTest.php b/tests/Services/EventsTest.php index 8510cad..eeb8849 100644 --- a/tests/Services/EventsTest.php +++ b/tests/Services/EventsTest.php @@ -78,6 +78,7 @@ public function testUnwrapWithVerification(): void { $payload = '{"id":"event_001dzz0r20rzr4zrhrr1364hy80","associated_object_id":"account_in71c4amph0vgo2qllky","associated_object_type":"account","category":"account.created","created_at":"2020-01-31T23:59:59Z","type":"event"}'; $secret = 'whsec_c2VjcmV0Cg=='; + $rawSecret = "secret\n"; $webhook = new Webhook($secret); $messageId = '1'; $timestamp = time(); @@ -89,7 +90,7 @@ public function testUnwrapWithVerification(): void 'webhook-id' => [$messageId], 'webhook-timestamp' => [(string) $timestamp], ]; - $this->client->events->unwrap($payload, $headers, $secret); + $this->client->events->unwrap($payload, $headers, $rawSecret); // unwrap successful if not error thrown, increment assertion count to avoid risky test warning $this->addToAssertionCount(1); } @@ -101,6 +102,7 @@ public function testUnwrapWrongKey(): void $payload = '{"id":"event_001dzz0r20rzr4zrhrr1364hy80","associated_object_id":"account_in71c4amph0vgo2qllky","associated_object_type":"account","category":"account.created","created_at":"2020-01-31T23:59:59Z","type":"event"}'; $secret = 'whsec_c2VjcmV0Cg=='; + $rawSecret = "secret\n"; $webhook = new Webhook($secret); $messageId = '1'; $timestamp = time(); @@ -123,6 +125,7 @@ public function testUnwrapBadSignature(): void $payload = '{"id":"event_001dzz0r20rzr4zrhrr1364hy80","associated_object_id":"account_in71c4amph0vgo2qllky","associated_object_type":"account","category":"account.created","created_at":"2020-01-31T23:59:59Z","type":"event"}'; $secret = 'whsec_c2VjcmV0Cg=='; + $rawSecret = "secret\n"; $webhook = new Webhook($secret); $messageId = '1'; $timestamp = time(); @@ -134,7 +137,7 @@ public function testUnwrapBadSignature(): void 'webhook-id' => [$messageId], 'webhook-timestamp' => [(string) $timestamp], ]; - $this->client->events->unwrap($payload, $headers, $secret); + $this->client->events->unwrap($payload, $headers, $rawSecret); } #[Test] @@ -144,6 +147,7 @@ public function testUnwrapOldTimestamp(): void $payload = '{"id":"event_001dzz0r20rzr4zrhrr1364hy80","associated_object_id":"account_in71c4amph0vgo2qllky","associated_object_type":"account","category":"account.created","created_at":"2020-01-31T23:59:59Z","type":"event"}'; $secret = 'whsec_c2VjcmV0Cg=='; + $rawSecret = "secret\n"; $webhook = new Webhook($secret); $messageId = '1'; $timestamp = time(); @@ -155,7 +159,7 @@ public function testUnwrapOldTimestamp(): void 'webhook-id' => [$messageId], 'webhook-timestamp' => ['5'], ]; - $this->client->events->unwrap($payload, $headers, $secret); + $this->client->events->unwrap($payload, $headers, $rawSecret); } #[Test] @@ -165,6 +169,7 @@ public function testUnwrapWrongMessageID(): void $payload = '{"id":"event_001dzz0r20rzr4zrhrr1364hy80","associated_object_id":"account_in71c4amph0vgo2qllky","associated_object_type":"account","category":"account.created","created_at":"2020-01-31T23:59:59Z","type":"event"}'; $secret = 'whsec_c2VjcmV0Cg=='; + $rawSecret = "secret\n"; $webhook = new Webhook($secret); $messageId = '1'; $timestamp = time(); @@ -176,6 +181,6 @@ public function testUnwrapWrongMessageID(): void 'webhook-id' => ['wrong'], 'webhook-timestamp' => [(string) $timestamp], ]; - $this->client->events->unwrap($payload, $headers, $secret); + $this->client->events->unwrap($payload, $headers, $rawSecret); } }