Skip to content

Commit

Permalink
Merge pull request #4189 from LibreSign/backport/4185/stable29
Browse files Browse the repository at this point in the history
[stable29] fix: fetch signature methods
  • Loading branch information
vitormattos authored Dec 24, 2024
2 parents 879bc19 + 1225ab7 commit 4b256ab
Show file tree
Hide file tree
Showing 6 changed files with 164 additions and 24 deletions.
19 changes: 16 additions & 3 deletions lib/ResponseDefinitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,23 @@
* label: string,
* name: string,
* }
* @psalm-type LibresignSignatureMethodEmailToken = array{
* label: string,
* identifyMethod: "email"|"account",
* needCode: bool,
* hasConfirmCode: bool,
* blurredEmail: string,
* hashOfEmail: string,
* }
* @psalm-type LibresignSignatureMethodPassword = array{
* label: string,
* name: string,
* hasSignatureFile: bool,
* }
* @psalm-type LibresignSignatureMethods = array{
* clickToSign?: LibresignSignatureMethod,
* emailToken?: LibresignSignatureMethod,
* password?: LibresignSignatureMethod,
* emailToken?: LibresignSignatureMethodEmailToken,
* password?: LibresignSignatureMethodPassword,
* }
* @psalm-type LibresignSigner = array{
* description: ?string,
Expand All @@ -143,7 +156,7 @@
* signRequestId: non-negative-int,
* identifyMethods?: LibresignIdentifyMethod[],
* visibleElements?: LibresignVisibleElement[],
* signatureMethods?: LibresignSignatureMethods[],
* signatureMethods?: LibresignSignatureMethods,
* }
* @psalm-type LibresignValidateFile = array{
* uuid: string,
Expand Down
3 changes: 0 additions & 3 deletions lib/Service/IdentifyMethodService.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,6 @@ public function getSignMethodsOfIdentifiedFactors(int $signRequestId): array {
$return = [];
foreach ($matrix as $identifyMethods) {
foreach ($identifyMethods as $identifyMethod) {
if (empty($identifyMethod->getEntity()->getIdentifiedAtDate())) {
continue;
}
$signatureMethods = $identifyMethod->getSignatureMethods();
foreach ($signatureMethods as $signatureMethod) {
if (!$signatureMethod->isEnabled()) {
Expand Down
63 changes: 57 additions & 6 deletions openapi-full.json
Original file line number Diff line number Diff line change
Expand Up @@ -612,17 +612,71 @@
}
}
},
"SignatureMethodEmailToken": {
"type": "object",
"required": [
"label",
"identifyMethod",
"needCode",
"hasConfirmCode",
"blurredEmail",
"hashOfEmail"
],
"properties": {
"label": {
"type": "string"
},
"identifyMethod": {
"type": "string",
"enum": [
"email",
"account"
]
},
"needCode": {
"type": "boolean"
},
"hasConfirmCode": {
"type": "boolean"
},
"blurredEmail": {
"type": "string"
},
"hashOfEmail": {
"type": "string"
}
}
},
"SignatureMethodPassword": {
"type": "object",
"required": [
"label",
"name",
"hasSignatureFile"
],
"properties": {
"label": {
"type": "string"
},
"name": {
"type": "string"
},
"hasSignatureFile": {
"type": "boolean"
}
}
},
"SignatureMethods": {
"type": "object",
"properties": {
"clickToSign": {
"$ref": "#/components/schemas/SignatureMethod"
},
"emailToken": {
"$ref": "#/components/schemas/SignatureMethod"
"$ref": "#/components/schemas/SignatureMethodEmailToken"
},
"password": {
"$ref": "#/components/schemas/SignatureMethod"
"$ref": "#/components/schemas/SignatureMethodPassword"
}
}
},
Expand Down Expand Up @@ -685,10 +739,7 @@
}
},
"signatureMethods": {
"type": "array",
"items": {
"$ref": "#/components/schemas/SignatureMethods"
}
"$ref": "#/components/schemas/SignatureMethods"
}
}
},
Expand Down
63 changes: 57 additions & 6 deletions openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -516,17 +516,71 @@
}
}
},
"SignatureMethodEmailToken": {
"type": "object",
"required": [
"label",
"identifyMethod",
"needCode",
"hasConfirmCode",
"blurredEmail",
"hashOfEmail"
],
"properties": {
"label": {
"type": "string"
},
"identifyMethod": {
"type": "string",
"enum": [
"email",
"account"
]
},
"needCode": {
"type": "boolean"
},
"hasConfirmCode": {
"type": "boolean"
},
"blurredEmail": {
"type": "string"
},
"hashOfEmail": {
"type": "string"
}
}
},
"SignatureMethodPassword": {
"type": "object",
"required": [
"label",
"name",
"hasSignatureFile"
],
"properties": {
"label": {
"type": "string"
},
"name": {
"type": "string"
},
"hasSignatureFile": {
"type": "boolean"
}
}
},
"SignatureMethods": {
"type": "object",
"properties": {
"clickToSign": {
"$ref": "#/components/schemas/SignatureMethod"
},
"emailToken": {
"$ref": "#/components/schemas/SignatureMethod"
"$ref": "#/components/schemas/SignatureMethodEmailToken"
},
"password": {
"$ref": "#/components/schemas/SignatureMethod"
"$ref": "#/components/schemas/SignatureMethodPassword"
}
}
},
Expand Down Expand Up @@ -589,10 +643,7 @@
}
},
"signatureMethods": {
"type": "array",
"items": {
"$ref": "#/components/schemas/SignatureMethods"
}
"$ref": "#/components/schemas/SignatureMethods"
}
}
},
Expand Down
20 changes: 17 additions & 3 deletions src/types/openapi/openapi-full.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1210,10 +1210,24 @@ export type components = {
label: string;
name: string;
};
SignatureMethodEmailToken: {
label: string;
/** @enum {string} */
identifyMethod: "email" | "account";
needCode: boolean;
hasConfirmCode: boolean;
blurredEmail: string;
hashOfEmail: string;
};
SignatureMethodPassword: {
label: string;
name: string;
hasSignatureFile: boolean;
};
SignatureMethods: {
clickToSign?: components["schemas"]["SignatureMethod"];
emailToken?: components["schemas"]["SignatureMethod"];
password?: components["schemas"]["SignatureMethod"];
emailToken?: components["schemas"]["SignatureMethodEmailToken"];
password?: components["schemas"]["SignatureMethodPassword"];
};
Signer: {
description: string | null;
Expand All @@ -1229,7 +1243,7 @@ export type components = {
signRequestId: number;
identifyMethods?: components["schemas"]["IdentifyMethod"][];
visibleElements?: components["schemas"]["VisibleElement"][];
signatureMethods?: components["schemas"]["SignatureMethods"][];
signatureMethods?: components["schemas"]["SignatureMethods"];
};
UserElement: {
/** Format: int64 */
Expand Down
20 changes: 17 additions & 3 deletions src/types/openapi/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1064,10 +1064,24 @@ export type components = {
label: string;
name: string;
};
SignatureMethodEmailToken: {
label: string;
/** @enum {string} */
identifyMethod: "email" | "account";
needCode: boolean;
hasConfirmCode: boolean;
blurredEmail: string;
hashOfEmail: string;
};
SignatureMethodPassword: {
label: string;
name: string;
hasSignatureFile: boolean;
};
SignatureMethods: {
clickToSign?: components["schemas"]["SignatureMethod"];
emailToken?: components["schemas"]["SignatureMethod"];
password?: components["schemas"]["SignatureMethod"];
emailToken?: components["schemas"]["SignatureMethodEmailToken"];
password?: components["schemas"]["SignatureMethodPassword"];
};
Signer: {
description: string | null;
Expand All @@ -1083,7 +1097,7 @@ export type components = {
signRequestId: number;
identifyMethods?: components["schemas"]["IdentifyMethod"][];
visibleElements?: components["schemas"]["VisibleElement"][];
signatureMethods?: components["schemas"]["SignatureMethods"][];
signatureMethods?: components["schemas"]["SignatureMethods"];
};
UserElement: {
/** Format: int64 */
Expand Down

0 comments on commit 4b256ab

Please sign in to comment.