Skip to content

Commit e246c2d

Browse files
committed
fix a silly error, #8 works (at least with Firefox)
1 parent 2e88cd5 commit e246c2d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/WebPush.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ class WebPush
5050
*/
5151
public function __construct(array $auth = array(), $defaultOptions = array(), $timeout = 30, AbstractClient $client = null)
5252
{
53-
$this->auth = $auth;
54-
5553
if (array_key_exists('VAPID', $auth)) {
5654
$auth['VAPID'] = VAPID::validate($auth['VAPID']);
5755
}
5856

57+
$this->auth = $auth;
58+
5959
$this->setDefaultOptions($defaultOptions);
6060

6161
$client = isset($client) ? $client : new MultiCurl();
@@ -189,8 +189,8 @@ private function prepareAndSend(array $notifications)
189189
'Content-Length' => Utils::safe_strlen($encrypted['cipherText']),
190190
'Content-Type' => 'application/octet-stream',
191191
'Content-Encoding' => 'aesgcm',
192-
'Encryption' => 'keyid="p256dh";salt="'.$encrypted['salt'].'"',
193-
'Crypto-Key' => 'keyid="p256dh";dh="'.$encrypted['localPublicKey'].'"',
192+
'Encryption' => 'keyid=p256dh;salt='.$encrypted['salt'],
193+
'Crypto-Key' => 'keyid=p256dh;dh='.$encrypted['localPublicKey'],
194194
);
195195

196196
$content = $encrypted['cipherText'];
@@ -235,7 +235,7 @@ private function prepareAndSend(array $notifications)
235235

236236
$vapidHeaders = VAPID::getVapidHeaders($audience, $vapid['subject'], $vapid['publicKey'], $vapid['privateKey']);
237237

238-
$headers['Authorization'] = 'key='.$vapidHeaders['Authorization'];
238+
$headers['Authorization'] = $vapidHeaders['Authorization'];
239239

240240
if (array_key_exists('Crypto-Key', $headers)) {
241241
// FUTURE replace ';' with ','

0 commit comments

Comments
 (0)