File tree Expand file tree Collapse file tree 5 files changed +13
-5
lines changed
Expand file tree Collapse file tree 5 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 5252 uses : shivammathur/setup-php@2.15.0
5353 with :
5454 php-version : ' 8.1'
55+ extensions : gmp
5556 id : php
5657
5758 - name : Build Release Artifacts
Original file line number Diff line number Diff line change @@ -2,7 +2,9 @@ ARG version=latest
22FROM php:$version
33
44RUN apt-get update \
5- && apt-get install -y zip
5+ && apt-get install -y zip \
6+ && apt-get install -y libgmp-dev \
7+ && docker-php-ext-install gmp
68
79RUN curl -s https://getcomposer.org/installer | php \
810 && mv composer.phar /usr/local/bin/composer
Original file line number Diff line number Diff line change 1515 "require" : {
1616 "php" : " >=7.3" ,
1717 "sendgrid/php-http-client" : " ~4.1" ,
18- "starkbank/ecdsa" : " 0.* " ,
18+ "starkbank/ecdsa" : " ^2.1.0 " ,
1919 "ext-curl" : " *" ,
2020 "ext-json" : " *" ,
2121 "ext-mbstring" : " *" ,
22- "ext-openssl" : " *"
22+ "ext-openssl" : " *" ,
23+ "ext-gmp" : " *"
2324 },
2425 "require-dev" : {
2526 "phpunit/phpunit" : " ^9" ,
Original file line number Diff line number Diff line change 55use EllipticCurve \Ecdsa ;
66use EllipticCurve \PublicKey ;
77use EllipticCurve \Signature ;
8+ use EllipticCurve \Utils \Binary ;
89
910/**
1011 * This class allows you to use the Event Webhook feature. Read the docs for
@@ -22,7 +23,7 @@ class EventWebhook
2223 */
2324 public function convertPublicKeyToECDSA ($ publicKey )
2425 {
25- return PublicKey::fromString ( $ publicKey );
26+ return PublicKey::fromDer (Binary:: byteStringFromBase64 ( $ publicKey) );
2627 }
2728
2829 /**
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ class EventWebhookTest extends TestCase
1414{
1515 private static $ PUBLIC_KEY ;
1616 private static $ SIGNATURE ;
17+ private static $ BAD_SIGNATURE ;
1718 private static $ TIMESTAMP ;
1819 private static $ PAYLOAD ;
1920
@@ -23,6 +24,8 @@ public static function setUpBeforeClass(): void
2324 IW4mdBgQ/7dAfSmpqIM8kF9mN1flpVKS3GRqe62gw+2fNNRaINXvVpiglSI8eNEc6wEA3F+g== ' ;
2425 self ::$ SIGNATURE = 'MEUCIGHQVtGj+Y3LkG9fLcxf3qfI10QysgDWmMOVmxG0u6ZUAiE
2526 AyBiXDWzM+uOe5W0JuG+luQAbPIqHh89M15TluLtEZtM= ' ;
27+ self ::$ BAD_SIGNATURE = 'BADSIGNATURE+Y3LkG9fLcxf3qfI10QysgDWmMOVmxG0u6ZUAiE
28+ AyBiXDWzM+uOe5W0JuG+luQAbPIqHh89M15TluLtEZtM= ' ;
2629 self ::$ TIMESTAMP = '1600112502 ' ;
2730 self ::$ PAYLOAD = \json_encode (
2831 [
@@ -81,7 +84,7 @@ public function testBadSignature()
8184 $ isValidSignature = $ this ->verify (
8285 self ::$ PUBLIC_KEY ,
8386 self ::$ PAYLOAD ,
84- ' signature ' ,
87+ self :: $ BAD_SIGNATURE ,
8588 self ::$ TIMESTAMP
8689 );
8790
You can’t perform that action at this time.
0 commit comments