Skip to content

Commit b9a18b2

Browse files
committed
rm useless code
1 parent ccc2d78 commit b9a18b2

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

src/Encryption.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,7 @@ public static function encrypt($payload, $userPublicKey, $userAuthToken, $native
6161

6262
// get shared secret from user public key and local private key
6363
$localPrivateSecret = $localPrivateKeyObject->getSecret();
64-
65-
$userPublicX = $userPublicKeyObject->getPoint()
66-
->mul($localPrivateSecret)->getX();
67-
// On HHVM this value is on type GMP and throws if cast to a string.
68-
$userPublicX = gmp_strval($userPublicX);
69-
$sharedSecret = hex2bin($math->decHex($userPublicX));
64+
$sharedSecret = hex2bin($math->decHex(gmp_strval($userPublicKeyObject->getPoint()->mul($localPrivateSecret)->getX())));
7065

7166
// generate salt
7267
$salt = openssl_random_pseudo_bytes(16);

src/WebPush.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ private function prepareAndSend(array $notifications)
181181
'Content-Length' => Utils::safeStrlen($encrypted['cipherText']),
182182
'Content-Type' => 'application/octet-stream',
183183
'Content-Encoding' => 'aesgcm',
184-
'Encryption' => 'keyid="p256dh";salt="'.$encrypted['salt'].'"',
185-
'Crypto-Key' => 'keyid="p256dh";dh="'.$encrypted['localPublicKey'].'"',
184+
'Encryption' => 'salt="'.$encrypted['salt'].'"',
185+
'Crypto-Key' => 'dh="'.$encrypted['localPublicKey'].'"',
186186
);
187187

188188
$content = $encrypted['cipherText'];

0 commit comments

Comments
 (0)