From 715990df563c993127499b571c0b43a9de723f0a Mon Sep 17 00:00:00 2001 From: juanjoseruiz Date: Tue, 28 Mar 2023 14:40:09 +0200 Subject: [PATCH] chore: SHA256 as default cypher --- samples/retry-test.php | 2 +- src/OneflowSDK.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/samples/retry-test.php b/samples/retry-test.php index 7f6c693..f989a13 100644 --- a/samples/retry-test.php +++ b/samples/retry-test.php @@ -16,7 +16,7 @@ //SETUP THE SDK $client = new OneflowSDK( - 'http://localhost:3000/api', + 'https://localhost:3000/api', 'API_TOKEN_HERE', 'API_SECRET_HERE', (object)['retries' => 2, 'retryDelay' => $retryDelay, 'retryCondition' => $retryCondition] diff --git a/src/OneflowSDK.php b/src/OneflowSDK.php index 1434264..bda475c 100644 --- a/src/OneflowSDK.php +++ b/src/OneflowSDK.php @@ -264,6 +264,7 @@ public function request($method, $path, $jsonData=null, $optional_headers = null } $params['http']['header'][] = "x-oneflow-date: $timestamp"; + $params['http']['header'][] = "x-oneflow-algorithm: SHA256"; $params['http']['header'][] = $this->authHeader.": ".$this->token($method, $fullPath, $timestamp); foreach ($optional_headers as $name => $value) { @@ -431,7 +432,7 @@ protected function post_file_s3($uploadUrl, $localPath) { */ private function token($method, $path, $timestamp){ $stringToSign = strtoupper($method) . ' ' . $path . ' ' . $timestamp; - return $this->key . ':' . hash_hmac('sha1', $stringToSign, $this->secret); + return $this->key . ':' . hash_hmac('sha256', $stringToSign, $this->secret); } /**