apacuana-sdk-core 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/coverage/clover.xml +117 -114
- package/coverage/coverage-final.json +6 -6
- package/coverage/lcov-report/index.html +12 -12
- package/coverage/lcov-report/src/api/certs.js.html +1 -1
- package/coverage/lcov-report/src/api/faceLiveness.js.html +34 -7
- package/coverage/lcov-report/src/api/index.html +1 -1
- package/coverage/lcov-report/src/api/revocations.js.html +50 -5
- package/coverage/lcov-report/src/api/signatures.js.html +1 -1
- package/coverage/lcov-report/src/api/users.js.html +20 -5
- package/coverage/lcov-report/src/config/index.html +1 -1
- package/coverage/lcov-report/src/config/index.js.html +1 -1
- package/coverage/lcov-report/src/errors/index.html +1 -1
- package/coverage/lcov-report/src/errors/index.js.html +8 -8
- package/coverage/lcov-report/src/index.html +13 -13
- package/coverage/lcov-report/src/index.js.html +72 -12
- package/coverage/lcov-report/src/success/index.html +1 -1
- package/coverage/lcov-report/src/success/index.js.html +5 -5
- package/coverage/lcov-report/src/utils/constant.js.html +1 -1
- package/coverage/lcov-report/src/utils/helpers.js.html +1 -1
- package/coverage/lcov-report/src/utils/httpClient.js.html +1 -1
- package/coverage/lcov-report/src/utils/index.html +1 -1
- package/coverage/lcov.info +195 -188
- package/dist/api/revocations.d.ts +6 -3
- package/dist/api/users.d.ts +16 -6
- package/dist/index.js +58 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +58 -15
- package/dist/index.mjs.map +1 -1
- package/dist/types/faceLiveness.d.ts +6 -5
- package/dist/types/revocations.d.ts +26 -15
- package/dist/types/signatures.d.ts +60 -65
- package/package.json +1 -1
- package/src/api/faceLiveness.js +13 -4
- package/src/api/revocations.js +18 -3
- package/src/api/users.js +8 -3
- package/src/index.js +25 -5
- package/src/types/faceLiveness.js +11 -2
- package/src/types/revocations.js +29 -9
- package/src/types/signatures.js +42 -28
- package/tests/api/faceLiveness.test.js +28 -30
- package/tests/api/revocations.test.js +4 -4
- package/tests/index.test.js +16 -8
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type ApacuanaSuccess = import("../success").ApacuanaSuccess;
|
|
2
|
+
export type CreateFaceLivenessSessionData = {
|
|
2
3
|
/**
|
|
3
4
|
* - The session ID for the face liveness check.
|
|
4
5
|
*/
|
|
5
6
|
sessionId: string;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
};
|
|
8
|
+
export type CreateFaceLivenessSessionResponse = {
|
|
9
|
+
success: true;
|
|
10
|
+
data: CreateFaceLivenessSessionData;
|
|
10
11
|
};
|
|
@@ -1,32 +1,43 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type ApacuanaSuccess = import("../success").ApacuanaSuccess;
|
|
2
|
+
export type RevocationReason = {
|
|
2
3
|
/**
|
|
3
|
-
* -
|
|
4
|
+
* - The code for the revocation reason.
|
|
4
5
|
*/
|
|
5
|
-
|
|
6
|
+
code: string;
|
|
6
7
|
/**
|
|
7
|
-
* -
|
|
8
|
+
* - The description of the revocation reason.
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
|
+
description: string;
|
|
10
11
|
};
|
|
11
|
-
export type
|
|
12
|
+
export type RequestRevocationData = {
|
|
12
13
|
/**
|
|
13
|
-
* -
|
|
14
|
+
* - A message providing details about the outcome.
|
|
14
15
|
*/
|
|
15
|
-
|
|
16
|
+
message: string;
|
|
17
|
+
};
|
|
18
|
+
export type RequestRevocationResponse = {
|
|
19
|
+
success: true;
|
|
20
|
+
data: RequestRevocationData;
|
|
21
|
+
};
|
|
22
|
+
export type GetRevocationReasonsData = {
|
|
16
23
|
/**
|
|
17
|
-
* - A
|
|
24
|
+
* - A list of revocation reasons.
|
|
18
25
|
*/
|
|
19
|
-
|
|
26
|
+
reasons: RevocationReason[];
|
|
20
27
|
};
|
|
21
|
-
export type
|
|
28
|
+
export type GetRevocationReasonsResponse = {
|
|
29
|
+
success: true;
|
|
30
|
+
data: GetRevocationReasonsData;
|
|
31
|
+
};
|
|
32
|
+
export type RevocationResponse = {
|
|
22
33
|
/**
|
|
23
|
-
* -
|
|
34
|
+
* - Indicates if the revocation request was successful.
|
|
24
35
|
*/
|
|
25
|
-
|
|
36
|
+
success: boolean;
|
|
26
37
|
/**
|
|
27
|
-
* -
|
|
38
|
+
* - A message providing details about the outcome.
|
|
28
39
|
*/
|
|
29
|
-
|
|
40
|
+
message?: string | undefined;
|
|
30
41
|
};
|
|
31
42
|
export type RevocationReasonsResponse = {
|
|
32
43
|
/**
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type ApacuanaSuccess = import("../success").ApacuanaSuccess;
|
|
1
2
|
/**
|
|
2
3
|
* Define la estructura de un objeto Firmante.
|
|
3
4
|
*/
|
|
@@ -15,27 +16,18 @@ export type Signer = {
|
|
|
15
16
|
*/
|
|
16
17
|
document: string;
|
|
17
18
|
};
|
|
18
|
-
|
|
19
|
-
* Define la estructura de datos para añadir un firmante.
|
|
20
|
-
*/
|
|
21
|
-
export type SignerData = {
|
|
19
|
+
export type AddSignerData = {
|
|
22
20
|
/**
|
|
23
|
-
* - Identificador
|
|
21
|
+
* - Identificador de confirmación del firmante añadido.
|
|
24
22
|
*/
|
|
25
|
-
|
|
23
|
+
signer: string;
|
|
26
24
|
};
|
|
27
25
|
/**
|
|
28
26
|
* Define la estructura de la respuesta al añadir un firmante.
|
|
29
27
|
*/
|
|
30
28
|
export type AddSignerResponse = {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
*/
|
|
34
|
-
signer: string;
|
|
35
|
-
/**
|
|
36
|
-
* - Indica si la operación fue exitosa.
|
|
37
|
-
*/
|
|
38
|
-
success: boolean;
|
|
29
|
+
success: true;
|
|
30
|
+
data: AddSignerData;
|
|
39
31
|
};
|
|
40
32
|
/**
|
|
41
33
|
* Define la estructura de datos para obtener el digest de un documento.
|
|
@@ -46,22 +38,61 @@ export type GetDigestData = {
|
|
|
46
38
|
*/
|
|
47
39
|
cert: string;
|
|
48
40
|
/**
|
|
49
|
-
* - Identificador único
|
|
41
|
+
* - Identificador único de la firma.
|
|
50
42
|
*/
|
|
51
43
|
signatureId: string;
|
|
52
44
|
};
|
|
45
|
+
export type SignaturePlacement = {
|
|
46
|
+
/**
|
|
47
|
+
* - Página donde se estampará la firma.
|
|
48
|
+
*/
|
|
49
|
+
page: number;
|
|
50
|
+
/**
|
|
51
|
+
* - Coordenada X de la firma.
|
|
52
|
+
*/
|
|
53
|
+
x: number;
|
|
54
|
+
/**
|
|
55
|
+
* - Coordenada Y de la firma.
|
|
56
|
+
*/
|
|
57
|
+
y: number;
|
|
58
|
+
};
|
|
53
59
|
/**
|
|
54
|
-
* Define la estructura de
|
|
60
|
+
* Define la estructura de datos para añadir un firmante.
|
|
55
61
|
*/
|
|
56
|
-
export type
|
|
62
|
+
export type SignerData = {
|
|
57
63
|
/**
|
|
58
|
-
* -
|
|
64
|
+
* - Nombre del firmante.
|
|
59
65
|
*/
|
|
60
|
-
|
|
66
|
+
name: string;
|
|
67
|
+
/**
|
|
68
|
+
* - Referencia o identificador del firmante.
|
|
69
|
+
*/
|
|
70
|
+
reference: string;
|
|
61
71
|
/**
|
|
62
|
-
* -
|
|
72
|
+
* - Tipo de documento de identidad del firmante.
|
|
73
|
+
*/
|
|
74
|
+
typedoc: string;
|
|
75
|
+
/**
|
|
76
|
+
* - Número de documento de identidad del firmante.
|
|
77
|
+
*/
|
|
78
|
+
doc: string;
|
|
79
|
+
/**
|
|
80
|
+
* - Array con las coordenadas donde se estampará la firma.
|
|
81
|
+
*/
|
|
82
|
+
signature: Array<SignaturePlacement>;
|
|
83
|
+
};
|
|
84
|
+
export type GetDigestResponseData = {
|
|
85
|
+
/**
|
|
86
|
+
* - El digest del documento que se va a firmar.
|
|
63
87
|
*/
|
|
64
|
-
|
|
88
|
+
digest: string;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Define la estructura de la respuesta al obtener el digest.
|
|
92
|
+
*/
|
|
93
|
+
export type GetDigestResponse = {
|
|
94
|
+
success: true;
|
|
95
|
+
data: GetDigestResponseData;
|
|
65
96
|
};
|
|
66
97
|
/**
|
|
67
98
|
* Define la estructura de los parámetros para obtener documentos.
|
|
@@ -80,10 +111,7 @@ export type GetDocsParams = {
|
|
|
80
111
|
*/
|
|
81
112
|
status?: string | undefined;
|
|
82
113
|
};
|
|
83
|
-
|
|
84
|
-
* Define la estructura de la respuesta al obtener documentos.
|
|
85
|
-
*/
|
|
86
|
-
export type GetDocsResponse = {
|
|
114
|
+
export type GetDocsResponseData = {
|
|
87
115
|
/**
|
|
88
116
|
* - El número total de registros encontrados.
|
|
89
117
|
*/
|
|
@@ -92,10 +120,13 @@ export type GetDocsResponse = {
|
|
|
92
120
|
* - Un arreglo con los registros de los documentos.
|
|
93
121
|
*/
|
|
94
122
|
records: Array<object>;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Define la estructura de la respuesta al obtener documentos.
|
|
126
|
+
*/
|
|
127
|
+
export type GetDocsResponse = {
|
|
128
|
+
success: true;
|
|
129
|
+
data: GetDocsResponseData;
|
|
99
130
|
};
|
|
100
131
|
export type SignDocumentData = {
|
|
101
132
|
/**
|
|
@@ -114,39 +145,3 @@ export type SignDocumentData = {
|
|
|
114
145
|
*/
|
|
115
146
|
signedDigest: string;
|
|
116
147
|
};
|
|
117
|
-
export type SignaturePosition = {
|
|
118
|
-
/**
|
|
119
|
-
* - The page number for the signature.
|
|
120
|
-
*/
|
|
121
|
-
page: number;
|
|
122
|
-
/**
|
|
123
|
-
* - The x-coordinate for the signature's position (from 0 to 1).
|
|
124
|
-
*/
|
|
125
|
-
x: number;
|
|
126
|
-
/**
|
|
127
|
-
* - The y-coordinate for the signature's position (from 0 to 1).
|
|
128
|
-
*/
|
|
129
|
-
y: number;
|
|
130
|
-
};
|
|
131
|
-
export type OnboardingSignerData = {
|
|
132
|
-
/**
|
|
133
|
-
* - The name of the document.
|
|
134
|
-
*/
|
|
135
|
-
name: string;
|
|
136
|
-
/**
|
|
137
|
-
* - An external reference for the document.
|
|
138
|
-
*/
|
|
139
|
-
reference: string;
|
|
140
|
-
/**
|
|
141
|
-
* - The type of document of the signer (e.g., "V", "E", "J").
|
|
142
|
-
*/
|
|
143
|
-
typedoc: string;
|
|
144
|
-
/**
|
|
145
|
-
* - The document number of the signer.
|
|
146
|
-
*/
|
|
147
|
-
doc: string;
|
|
148
|
-
/**
|
|
149
|
-
* - An array of signature positions.
|
|
150
|
-
*/
|
|
151
|
-
signature: SignaturePosition[];
|
|
152
|
-
};
|
package/package.json
CHANGED
package/src/api/faceLiveness.js
CHANGED
|
@@ -8,6 +8,12 @@ import { ApacuanaAPIError } from "../errors";
|
|
|
8
8
|
import ApacuanaSuccess from "../success";
|
|
9
9
|
import { INTEGRATION_TYPE } from "../utils/constant";
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new Face Liveness session.
|
|
13
|
+
* @returns {Promise<CreateFaceLivenessSessionResponse>} Object with the session ID and a success indicator.
|
|
14
|
+
* @throws {ApacuanaAPIError} If the API response is invalid or the integration type is not supported.
|
|
15
|
+
* @throws {Error} If the request fails for another reason.
|
|
16
|
+
*/
|
|
11
17
|
const createFaceLivenessSessionOnBoarding = async () => {
|
|
12
18
|
try {
|
|
13
19
|
const response = await httpRequest(
|
|
@@ -15,8 +21,7 @@ const createFaceLivenessSessionOnBoarding = async () => {
|
|
|
15
21
|
{},
|
|
16
22
|
"POST"
|
|
17
23
|
);
|
|
18
|
-
|
|
19
|
-
if (!response.sessionId) {
|
|
24
|
+
if (!response.sessionid) {
|
|
20
25
|
throw new ApacuanaAPIError(
|
|
21
26
|
"The API response does not contain the session ID.",
|
|
22
27
|
response.status,
|
|
@@ -24,12 +29,16 @@ const createFaceLivenessSessionOnBoarding = async () => {
|
|
|
24
29
|
);
|
|
25
30
|
}
|
|
26
31
|
|
|
27
|
-
return new ApacuanaSuccess({
|
|
32
|
+
return new ApacuanaSuccess({
|
|
33
|
+
sessionId: response.sessionid,
|
|
34
|
+
});
|
|
28
35
|
} catch (error) {
|
|
29
36
|
if (error instanceof ApacuanaAPIError) {
|
|
30
37
|
throw error;
|
|
31
38
|
}
|
|
32
|
-
throw new
|
|
39
|
+
throw new ApacuanaAPIError(
|
|
40
|
+
`Failed to create Face Liveness session: ${error.message}`
|
|
41
|
+
);
|
|
33
42
|
}
|
|
34
43
|
};
|
|
35
44
|
|
package/src/api/revocations.js
CHANGED
|
@@ -4,10 +4,13 @@ import { INTEGRATION_TYPE } from "../utils/constant";
|
|
|
4
4
|
import { ApacuanaAPIError } from "../errors";
|
|
5
5
|
import ApacuanaSuccess from "../success";
|
|
6
6
|
|
|
7
|
+
/** @typedef {import("../types/revocations").RequestRevocationResponse} RequestRevocationResponse */
|
|
8
|
+
/** @typedef {import("../types/revocations").GetRevocationReasonsResponse} GetRevocationReasonsResponse */
|
|
9
|
+
|
|
7
10
|
const requestRevocationOnBoarding = async (params) => {
|
|
8
11
|
try {
|
|
9
12
|
const response = await httpRequest(
|
|
10
|
-
"services/api/
|
|
13
|
+
"services/api/onboardingclient/requestcert",
|
|
11
14
|
params,
|
|
12
15
|
"POST"
|
|
13
16
|
);
|
|
@@ -28,6 +31,13 @@ const requestRevocationOnPremise = async () => {
|
|
|
28
31
|
);
|
|
29
32
|
};
|
|
30
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Solicita la revocación de un certificado.
|
|
36
|
+
* @param {object} params - Parámetros para la solicitud.
|
|
37
|
+
* @param {number} params.reasonCode - El código de la razón de la revocación.
|
|
38
|
+
* @returns {Promise<RequestRevocationResponse>} Una promesa que resuelve con la confirmación de la solicitud.
|
|
39
|
+
* @throws {Error} Si los parámetros son inválidos.
|
|
40
|
+
*/
|
|
31
41
|
export const requestRevocation = async (params) => {
|
|
32
42
|
if (!params || typeof params.reasonCode !== "number") {
|
|
33
43
|
throw new Error(
|
|
@@ -53,14 +63,14 @@ export const requestRevocation = async (params) => {
|
|
|
53
63
|
const getRevocationReasonsOnBoarding = async () => {
|
|
54
64
|
try {
|
|
55
65
|
const response = await httpRequest(
|
|
56
|
-
"
|
|
66
|
+
"config/api/revocation/reasonsonboarding",
|
|
57
67
|
{},
|
|
58
68
|
"GET"
|
|
59
69
|
);
|
|
60
70
|
if (!response || !response.records) {
|
|
61
71
|
throw new ApacuanaAPIError("Failed to fetch revocation reasons.");
|
|
62
72
|
}
|
|
63
|
-
return new ApacuanaSuccess(response.records);
|
|
73
|
+
return new ApacuanaSuccess({ reasons: response.records });
|
|
64
74
|
} catch (error) {
|
|
65
75
|
if (error instanceof ApacuanaAPIError) {
|
|
66
76
|
throw error;
|
|
@@ -77,6 +87,11 @@ const getRevocationReasonsOnPremise = async () => {
|
|
|
77
87
|
);
|
|
78
88
|
};
|
|
79
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Obtiene la lista de razones de revocación de certificados.
|
|
92
|
+
* @returns {Promise<GetRevocationReasonsResponse>} Una promesa que resuelve con la lista de razones de revocación.
|
|
93
|
+
* @throws {ApacuanaAPIError} Si la llamada a la API falla o el tipo de integración no es soportado.
|
|
94
|
+
*/
|
|
80
95
|
export const getRevocationReasons = async () => {
|
|
81
96
|
const { integrationType } = getConfig();
|
|
82
97
|
|
package/src/api/users.js
CHANGED
|
@@ -4,10 +4,15 @@ import { getConfig } from "../config/index";
|
|
|
4
4
|
import ApacuanaSuccess from "../success";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* @typedef {object}
|
|
7
|
+
* @typedef {object} GetCustomerData
|
|
8
8
|
* @property {string} token - El token de sesión del usuario.
|
|
9
9
|
* @property {object} userData - Los datos del usuario obtenidos.
|
|
10
|
-
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @typedef {object} GetCustomerResponse
|
|
14
|
+
* @property {true} success - Indica que la operación fue exitosa.
|
|
15
|
+
* @property {GetCustomerData} data - El payload de la respuesta.
|
|
11
16
|
*/
|
|
12
17
|
|
|
13
18
|
/**
|
|
@@ -15,7 +20,7 @@ import ApacuanaSuccess from "../success";
|
|
|
15
20
|
* Este método es útil para endpoints que requieren datos en el cuerpo de la petición
|
|
16
21
|
* para buscar un usuario, como un ID de sesión o un token de acceso.
|
|
17
22
|
*
|
|
18
|
-
* @returns {Promise<GetCustomerResponse>}
|
|
23
|
+
* @returns {Promise<GetCustomerResponse>} Una promesa que resuelve a un objeto con la respuesta exitosa.
|
|
19
24
|
* @throws {Error} Si los parámetros de entrada son inválidos.
|
|
20
25
|
* @throws {ApacuanaAPIError} Si ocurre un error en la API de Apacuana.
|
|
21
26
|
*/
|
package/src/index.js
CHANGED
|
@@ -22,6 +22,8 @@ import {
|
|
|
22
22
|
createFaceLivenessSession,
|
|
23
23
|
validateFaceLiveness,
|
|
24
24
|
} from "./api/faceLiveness";
|
|
25
|
+
import ApacuanaSuccess from "./success/index";
|
|
26
|
+
import { ApacuanaAPIError } from "./errors/index";
|
|
25
27
|
|
|
26
28
|
const apacuana = {
|
|
27
29
|
/**
|
|
@@ -42,21 +44,39 @@ const apacuana = {
|
|
|
42
44
|
initHttpClient();
|
|
43
45
|
const currentConfig = getConfig();
|
|
44
46
|
if (!currentConfig.customerId) {
|
|
45
|
-
throw new
|
|
47
|
+
throw new ApacuanaAPIError(
|
|
46
48
|
"Apacuana SDK: La configuración de CustomerId no se ha guardado" +
|
|
47
|
-
" correctamente."
|
|
49
|
+
" correctamente.",
|
|
50
|
+
400,
|
|
51
|
+
{ code: "CONFIG_ERROR" }
|
|
48
52
|
);
|
|
49
53
|
}
|
|
50
|
-
|
|
54
|
+
|
|
55
|
+
const customer = await getCustomer();
|
|
56
|
+
const { token, userData } = customer.data;
|
|
51
57
|
setConfig({ ...currentConfig, token, userData });
|
|
52
58
|
setAuthToken(token);
|
|
53
|
-
return
|
|
59
|
+
return new ApacuanaSuccess({
|
|
60
|
+
initialized: true,
|
|
61
|
+
message: "SDK inicializado correctamente.",
|
|
62
|
+
});
|
|
54
63
|
} catch (error) {
|
|
55
64
|
// eslint-disable-next-line no-console
|
|
56
65
|
console.error("Error durante la inicialización del SDK:", error);
|
|
57
|
-
|
|
66
|
+
if (error instanceof ApacuanaAPIError) {
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
throw new ApacuanaAPIError(
|
|
70
|
+
error.message || "Error desconocido durante la inicialización.",
|
|
71
|
+
500,
|
|
72
|
+
error
|
|
73
|
+
);
|
|
58
74
|
}
|
|
59
75
|
},
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Permite obtener la configuración actual del SDK.
|
|
79
|
+
*/
|
|
60
80
|
close: () => close(),
|
|
61
81
|
getConfig,
|
|
62
82
|
requestRevocation,
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef {
|
|
2
|
+
* @typedef {import('../success').ApacuanaSuccess} ApacuanaSuccess
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {object} CreateFaceLivenessSessionData
|
|
3
7
|
* @property {string} sessionId - The session ID for the face liveness check.
|
|
4
|
-
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @typedef {object} CreateFaceLivenessSessionResponse
|
|
12
|
+
* @property {true} success
|
|
13
|
+
* @property {CreateFaceLivenessSessionData} data
|
|
5
14
|
*/
|
|
6
15
|
|
|
7
16
|
export {};
|
package/src/types/revocations.js
CHANGED
|
@@ -1,19 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('../success').ApacuanaSuccess} ApacuanaSuccess
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {object} RevocationReason
|
|
7
|
+
* @property {string} code - The code for the revocation reason.
|
|
8
|
+
* @property {string} description - The description of the revocation reason.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {object} RequestRevocationData
|
|
13
|
+
* @property {string} message - A message providing details about the outcome.
|
|
14
|
+
*/
|
|
15
|
+
|
|
1
16
|
/**
|
|
2
17
|
* @typedef {object} RequestRevocationResponse
|
|
3
|
-
* @property {
|
|
4
|
-
* @property {
|
|
18
|
+
* @property {true} success
|
|
19
|
+
* @property {RequestRevocationData} data
|
|
5
20
|
*/
|
|
6
21
|
|
|
7
22
|
/**
|
|
8
|
-
* @typedef {object}
|
|
9
|
-
* @property {
|
|
10
|
-
* @property {string} [message] - A message providing details about the outcome.
|
|
23
|
+
* @typedef {object} GetRevocationReasonsData
|
|
24
|
+
* @property {RevocationReason[]} reasons - A list of revocation reasons.
|
|
11
25
|
*/
|
|
12
26
|
|
|
13
27
|
/**
|
|
14
|
-
* @typedef {object}
|
|
15
|
-
* @property {
|
|
16
|
-
* @property {
|
|
28
|
+
* @typedef {object} GetRevocationReasonsResponse
|
|
29
|
+
* @property {true} success
|
|
30
|
+
* @property {GetRevocationReasonsData} data
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @typedef {object} RevocationResponse
|
|
35
|
+
* @property {boolean} success - Indicates if the revocation request was successful.
|
|
36
|
+
* @property {string} [message] - A message providing details about the outcome.
|
|
17
37
|
*/
|
|
18
38
|
|
|
19
39
|
/**
|
|
@@ -22,4 +42,4 @@
|
|
|
22
42
|
* @property {RevocationReason[]} reasons - A list of revocation reasons.
|
|
23
43
|
*/
|
|
24
44
|
|
|
25
|
-
export {};
|
|
45
|
+
export {};
|
package/src/types/signatures.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('../success').ApacuanaSuccess} ApacuanaSuccess
|
|
3
|
+
*/
|
|
4
|
+
|
|
1
5
|
/**
|
|
2
6
|
* Define la estructura de un objeto Firmante.
|
|
3
7
|
* @typedef {object} Signer
|
|
@@ -7,30 +11,51 @@
|
|
|
7
11
|
*/
|
|
8
12
|
|
|
9
13
|
/**
|
|
10
|
-
*
|
|
11
|
-
* @
|
|
12
|
-
* @property {string} docId - Identificador único del documento.
|
|
14
|
+
* @typedef {object} AddSignerData
|
|
15
|
+
* @property {string} signer - Identificador de confirmación del firmante añadido.
|
|
13
16
|
*/
|
|
14
17
|
|
|
15
18
|
/**
|
|
16
19
|
* Define la estructura de la respuesta al añadir un firmante.
|
|
17
20
|
* @typedef {object} AddSignerResponse
|
|
18
|
-
* @property {
|
|
19
|
-
* @property {
|
|
21
|
+
* @property {true} success
|
|
22
|
+
* @property {AddSignerData} data
|
|
20
23
|
*/
|
|
21
24
|
|
|
22
25
|
/**
|
|
23
26
|
* Define la estructura de datos para obtener el digest de un documento.
|
|
24
27
|
* @typedef {object} GetDigestData
|
|
25
28
|
* @property {string} cert - Certificado del firmante en formato base64.
|
|
26
|
-
* @property {string} signatureId - Identificador único
|
|
29
|
+
* @property {string} signatureId - Identificador único de la firma.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @typedef {object} SignaturePlacement
|
|
34
|
+
* @property {number} page - Página donde se estampará la firma.
|
|
35
|
+
* @property {number} x - Coordenada X de la firma.
|
|
36
|
+
* @property {number} y - Coordenada Y de la firma.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Define la estructura de datos para añadir un firmante.
|
|
41
|
+
* @typedef {object} SignerData
|
|
42
|
+
* @property {string} name - Nombre del firmante.
|
|
43
|
+
* @property {string} reference - Referencia o identificador del firmante.
|
|
44
|
+
* @property {string} typedoc - Tipo de documento de identidad del firmante.
|
|
45
|
+
* @property {string} doc - Número de documento de identidad del firmante.
|
|
46
|
+
* @property {Array<SignaturePlacement>} signature - Array con las coordenadas donde se estampará la firma.
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @typedef {object} GetDigestResponseData
|
|
51
|
+
* @property {string} digest - El digest del documento que se va a firmar.
|
|
27
52
|
*/
|
|
28
53
|
|
|
29
54
|
/**
|
|
30
55
|
* Define la estructura de la respuesta al obtener el digest.
|
|
31
56
|
* @typedef {object} GetDigestResponse
|
|
32
|
-
* @property {
|
|
33
|
-
* @property {
|
|
57
|
+
* @property {true} success
|
|
58
|
+
* @property {GetDigestResponseData} data
|
|
34
59
|
*/
|
|
35
60
|
|
|
36
61
|
/**
|
|
@@ -42,11 +67,16 @@
|
|
|
42
67
|
*/
|
|
43
68
|
|
|
44
69
|
/**
|
|
45
|
-
*
|
|
46
|
-
* @typedef {object} GetDocsResponse
|
|
70
|
+
* @typedef {object} GetDocsResponseData
|
|
47
71
|
* @property {number} totalRecords - El número total de registros encontrados.
|
|
48
72
|
* @property {Array<object>} records - Un arreglo con los registros de los documentos.
|
|
49
|
-
|
|
73
|
+
*/
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Define la estructura de la respuesta al obtener documentos.
|
|
77
|
+
* @typedef {object} GetDocsResponse
|
|
78
|
+
* @property {true} success
|
|
79
|
+
* @property {GetDocsResponseData} data
|
|
50
80
|
*/
|
|
51
81
|
|
|
52
82
|
/**
|
|
@@ -58,20 +88,4 @@
|
|
|
58
88
|
* @property {string} signedDigest - Digest firmado.
|
|
59
89
|
*/
|
|
60
90
|
|
|
61
|
-
|
|
62
|
-
* @typedef {object} SignaturePosition
|
|
63
|
-
* @property {number} page - The page number for the signature.
|
|
64
|
-
* @property {number} x - The x-coordinate for the signature's position (from 0 to 1).
|
|
65
|
-
* @property {number} y - The y-coordinate for the signature's position (from 0 to 1).
|
|
66
|
-
*/
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* @typedef {object} OnboardingSignerData
|
|
70
|
-
* @property {string} name - The name of the document.
|
|
71
|
-
* @property {string} reference - An external reference for the document.
|
|
72
|
-
* @property {string} typedoc - The type of document of the signer (e.g., "V", "E", "J").
|
|
73
|
-
* @property {string} doc - The document number of the signer.
|
|
74
|
-
* @property {SignaturePosition[]} signature - An array of signature positions.
|
|
75
|
-
*/
|
|
76
|
-
|
|
77
|
-
export {};
|
|
91
|
+
export {};
|