mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-10-13 02:13:01 +00:00
[twitter] Update abraham/twitteroauth dependency
This commit is contained in:
parent
30445b3c85
commit
569e3f4831
167 changed files with 11848 additions and 2157 deletions
|
@ -1,8 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The MIT License
|
||||
* Copyright (c) 2007 Andy Smith
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Abraham\TwitterOAuth;
|
||||
|
||||
/**
|
||||
|
@ -30,7 +34,11 @@ abstract class SignatureMethod
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public function buildSignature(Request $request, Consumer $consumer, Token $token = null);
|
||||
abstract public function buildSignature(
|
||||
Request $request,
|
||||
Consumer $consumer,
|
||||
Token $token = null
|
||||
);
|
||||
|
||||
/**
|
||||
* Verifies that a given signature is correct
|
||||
|
@ -42,8 +50,12 @@ abstract class SignatureMethod
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function checkSignature(Request $request, Consumer $consumer, Token $token, $signature)
|
||||
{
|
||||
public function checkSignature(
|
||||
Request $request,
|
||||
Consumer $consumer,
|
||||
Token $token,
|
||||
string $signature
|
||||
): bool {
|
||||
$built = $this->buildSignature($request, $consumer, $token);
|
||||
|
||||
// Check for zero length, although unlikely here
|
||||
|
@ -58,7 +70,7 @@ abstract class SignatureMethod
|
|||
// Avoid a timing leak with a (hopefully) time insensitive compare
|
||||
$result = 0;
|
||||
for ($i = 0; $i < strlen($signature); $i++) {
|
||||
$result |= ord($built{$i}) ^ ord($signature{$i});
|
||||
$result |= ord($built[$i]) ^ ord($signature[$i]);
|
||||
}
|
||||
|
||||
return $result == 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue