Skip to content

Commit

Permalink
Fix syntax around cloning objects
Browse files Browse the repository at this point in the history
  • Loading branch information
paragonie-security committed Jun 26, 2021
1 parent 6795754 commit 8da9e77
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/Sapient.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function authenticateRequestWithSharedKey(
SharedAuthenticationKey $key
): RequestInterface {
$mac = \ParagonIE_Sodium_Compat::crypto_auth(
(string) clone $request->getBody(),
(string) (clone $request)->getBody(),
$key->getString(true)
);
return $request->withAddedHeader(
Expand All @@ -105,7 +105,7 @@ public function authenticateResponseWithSharedKey(
SharedAuthenticationKey $key
): ResponseInterface {
$mac = \ParagonIE_Sodium_Compat::crypto_auth(
(string) clone $response->getBody(),
(string) (clone $response)->getBody(),
$key->getString(true)
);
return $response->withAddedHeader(
Expand Down Expand Up @@ -254,7 +254,7 @@ public function signRequest(
SigningSecretKey $secretKey
): RequestInterface {
$signature = \ParagonIE_Sodium_Compat::crypto_sign_detached(
(string) clone $request->getBody(),
(string) (clone $request)->getBody(),
$secretKey->getString(true)
);
return $request->withAddedHeader(
Expand All @@ -275,7 +275,7 @@ public function signResponse(
SigningSecretKey $secretKey
): ResponseInterface {
$signature = \ParagonIE_Sodium_Compat::crypto_sign_detached(
(string) clone $response->getBody(),
(string) (clone $response)->getBody(),
$secretKey->getString(true)
);
return $response->withAddedHeader(
Expand Down Expand Up @@ -338,6 +338,7 @@ public function unsealResponse(
* @return RequestInterface
* @throws HeaderMissingException
* @throws InvalidMessageException
* @throws SodiumException
*/
public function verifySignedRequest(
RequestInterface $request,
Expand All @@ -351,7 +352,7 @@ public function verifySignedRequest(
);
}

$body = (string) clone $request->getBody();
$body = (string) (clone $request)->getBody();
foreach ($headers as $head) {
$result = \ParagonIE_Sodium_Compat::crypto_sign_verify_detached(
Base64UrlSafe::decode($head),
Expand Down Expand Up @@ -390,7 +391,7 @@ public function verifySignedResponse(
);
}

$body = (string) clone $response->getBody();
$body = (string) (clone $response)->getBody();
foreach ($headers as $head) {
$result = \ParagonIE_Sodium_Compat::crypto_sign_verify_detached(
Base64UrlSafe::decode($head),
Expand Down Expand Up @@ -429,7 +430,7 @@ public function verifySymmetricAuthenticatedRequest(
);
}

$body = (string) clone $request->getBody();
$body = (string) (clone $request)->getBody();
foreach ($headers as $head) {
$result = \ParagonIE_Sodium_Compat::crypto_auth_verify(
Base64UrlSafe::decode($head),
Expand Down Expand Up @@ -467,7 +468,7 @@ public function verifySymmetricAuthenticatedResponse(
);
}

$body = (string) clone $response->getBody();
$body = (string) (clone $response)->getBody();
foreach ($headers as $head) {
$result = \ParagonIE_Sodium_Compat::crypto_auth_verify(
Base64UrlSafe::decode($head),
Expand Down

0 comments on commit 8da9e77

Please sign in to comment.