Skip to content

Commit b42d41c

Browse files
committed
feat: add reason of signature
Signed-off-by: Vitor Mattos <[email protected]>
1 parent 0f9f70c commit b42d41c

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

lib/Handler/SignEngine/Pkcs12Handler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ public function sign(): File {
418418
->setPassword($this->getPassword())
419419
->setSignatureParams($this->getSignatureParams())
420420
->setVisibleElements($this->getVisibleElements())
421+
->setReason($this->getReason())
421422
->getSignedContent();
422423
$this->getInputFile()->putContent($signedContent);
423424
return $this->getInputFile();

lib/Handler/SignEngine/SignEngineHandler.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ abstract class SignEngineHandler implements ISignEngineHandler {
1616
private File $inputFile;
1717
protected string $certificate;
1818
private string $password = '';
19+
private string $reason = '';
1920
/** @var VisibleElementAssoc[] */
2021
private array $visibleElements = [];
2122
private array $signatureParams = [];
@@ -59,6 +60,15 @@ public function getPassword(): string {
5960
return $this->password;
6061
}
6162

63+
public function setReason(string $reason): self {
64+
$this->reason = $reason;
65+
return $this;
66+
}
67+
68+
public function getReason(): string {
69+
return $this->reason;
70+
}
71+
6272
/**
6373
* @param VisibleElementAssoc[] $visibleElements
6474
*

lib/Service/SignFileService.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,9 @@ public function sign(): File {
300300
->setVisibleElements($this->elements)
301301
->setPassword($this->password)
302302
->setSignatureParams($signatureParams)
303+
->setReason($this->l10n->t('Signed by %s with LibreSign.coop', [
304+
$this->signRequest->getDisplayName() . ' <' . $this->userUniqueIdentifier . '>'
305+
]))
303306
->sign();
304307
break;
305308
default:

0 commit comments

Comments
 (0)