Skip to content

Commit

Permalink
Added prefix to all requestIds to workaround a bug in the swisscom api
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximilianKresse committed Apr 10, 2024
1 parent cd5dbb0 commit 592e02a
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/AsyncModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function initSignature(\SetaPDF_Signer_TmpDocument $tmpDocument, string $
}

$digest = \base64_encode($this->generateHash($tmpPath));
$requestId = \uniqid();
$requestId = \uniqid('Seta', true);
$requestData = $this->buildSignRequestData(
$requestId,
[['algorithm' => $this->getDigestMethod(), 'digest' => $digest]]
Expand Down
2 changes: 1 addition & 1 deletion src/BatchAsyncModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function initSignature(array $documents, bool $updateDss = true, array $s
$no++;
}

$requestId = \uniqid();
$requestId = \uniqid('Seta', true);
$requestData = $this->buildSignRequestData(
$requestId,
$files
Expand Down
2 changes: 1 addition & 1 deletion src/BatchTimestampModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function timestamp(array $documents, bool $updateDss = true): bool
$no++;
}

$requestId = \uniqid();
$requestId = \uniqid('Seta', true);
$requestData = $this->buildSignRequestData($requestId, $files);

$responseData = $this->callUrl('https://ais.swisscom.com/AIS-Server/rs/v1.0/sign', $requestData);
Expand Down
2 changes: 1 addition & 1 deletion src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Module extends AbstractModule implements \SetaPDF_Signer_Signature_Module_
public function createSignature(\SetaPDF_Core_Reader_FilePath $tmpPath): string
{
$digest = \base64_encode($this->generateHash($tmpPath));
$requestId = \uniqid();
$requestId = \uniqid('Seta', true);
$requestData = $this->buildSignRequestData(
$requestId,
[['algorithm' => $this->getDigestMethod(), 'digest' => $digest]]
Expand Down
2 changes: 1 addition & 1 deletion src/TimestampModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected function buildSignRequestData(string $requestId, array $documents): ar
public function createTimestamp($data): string
{
$digest = \base64_encode($this->generateHash($data));
$requestId = \uniqid();
$requestId = \uniqid('Seta', true);
$requestData = $this->buildSignRequestData(
$requestId,
[['algorithm' => $this->getDigestMethod(), 'digest' => $digest]]
Expand Down

0 comments on commit 592e02a

Please sign in to comment.