feat: add subject (Common Name) to API response

Signed-off-by: Vitor Mattos <vitor@php.rio>
This commit is contained in:
Vitor Mattos 2025-01-06 11:05:58 -03:00
parent 9d40c211c9
commit 42f8153cd2
No known key found for this signature in database
GPG key ID: B7AB4B76A7CA7318
7 changed files with 11 additions and 0 deletions

View file

@ -150,6 +150,7 @@ namespace OCA\Libresign;
* @psalm-type LibresignSigner = array{
* description: ?string,
* displayName: string,
* subject?: string,
* request_sign_date: string,
* valid_from?: non-negative-int,
* valid_to?: non-negative-int,

View file

@ -415,6 +415,7 @@ class FileService {
private function loadFileSigners(): void {
foreach ($this->certData as $index => $signer) {
$this->fileData->signers[$index] = [
'subject' => $signer['chain'][0]['name'],
'displayName' => $signer['chain'][0]['subject']['CN'],
'valid_from' => $signer['chain'][0]['validFrom_time_t'],
'valid_to' => $signer['chain'][0]['validTo_time_t'],

View file

@ -719,6 +719,9 @@
"displayName": {
"type": "string"
},
"subject": {
"type": "string"
},
"request_sign_date": {
"type": "string"
},

View file

@ -623,6 +623,9 @@
"displayName": {
"type": "string"
},
"subject": {
"type": "string"
},
"request_sign_date": {
"type": "string"
},

View file

@ -1242,6 +1242,7 @@ export type components = {
Signer: {
description: string | null;
displayName: string;
subject?: string;
request_sign_date: string;
/** Format: int64 */
valid_from?: number;

View file

@ -1096,6 +1096,7 @@ export type components = {
Signer: {
description: string | null;
displayName: string;
subject?: string;
request_sign_date: string;
/** Format: int64 */
valid_from?: number;

View file

@ -251,6 +251,7 @@ final class FileServiceTest extends \OCA\Libresign\Tests\Unit\TestCase {
'signers' => [
[
'displayName' => 'admin',
'subject' => '/C=BR/ST=State of Company/L=City Name/O=Organization/OU=Organization Unit/UID=account:admin/CN=admin',
'valid_from' => 1736024940,
'valid_to' => 1767560940,
'sign_date' => '2025-01-04 21:09:02',