apacuana-sdk-core 0.5.0 → 0.6.2
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/README.md +128 -55
- package/babel.config.cjs +11 -0
- package/coverage/clover.xml +179 -170
- package/coverage/coverage-final.json +8 -8
- package/coverage/lcov-report/api/index.html +131 -0
- package/coverage/lcov-report/api/signatures.js.html +1093 -0
- package/coverage/lcov-report/api/users.js.html +292 -0
- package/coverage/lcov-report/config/index.html +116 -0
- package/coverage/lcov-report/config/index.js.html +208 -0
- package/coverage/lcov-report/errors/index.html +116 -0
- package/coverage/lcov-report/errors/index.js.html +148 -0
- package/coverage/lcov-report/index.html +26 -26
- package/coverage/lcov-report/src/api/certs.js.html +65 -35
- package/coverage/lcov-report/src/api/index.html +27 -27
- package/coverage/lcov-report/src/api/revocations.js.html +21 -3
- package/coverage/lcov-report/src/api/signatures.js.html +123 -18
- package/coverage/lcov-report/src/api/users.js.html +24 -3
- 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 +1 -1
- package/coverage/lcov-report/src/index.js.html +9 -3
- package/coverage/lcov-report/src/utils/constant.js.html +3 -3
- package/coverage/lcov-report/src/utils/helpers.js.html +134 -32
- package/coverage/lcov-report/src/utils/httpClient.js.html +6 -72
- package/coverage/lcov-report/src/utils/index.html +20 -20
- package/coverage/lcov-report/utils/constant.js.html +145 -0
- package/coverage/lcov-report/utils/httpClient.js.html +646 -0
- package/coverage/lcov-report/utils/index.html +131 -0
- package/coverage/lcov.info +335 -298
- package/dist/api/certs.d.ts +17 -3
- package/dist/api/revocations.d.ts +17 -2
- package/dist/api/signatures.d.ts +18 -1
- package/dist/api/users.d.ts +22 -6
- package/dist/index.d.ts +4 -0
- package/dist/index.js +616 -242
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +616 -242
- package/dist/index.mjs.map +1 -1
- package/dist/utils/helpers.d.ts +3 -1
- package/jest.config.cjs +6 -1
- package/package.json +12 -7
- package/rollup.config.js +1 -1
- package/src/api/certs.js +21 -11
- package/src/api/revocations.js +7 -1
- package/src/api/signatures.js +43 -8
- package/src/api/users.js +8 -1
- package/src/index.js +3 -1
- package/src/utils/constant.js +2 -2
- package/src/utils/helpers.js +56 -22
- package/src/utils/httpClient.js +0 -22
- package/tests/api/certs.test.js +30 -48
- package/tsconfig.json +2 -1
- package/.babelrc +0 -3
package/dist/api/certs.d.ts
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
|
-
export function generateCert(
|
|
1
|
+
export function generateCert(encryptedCSR?: undefined): Promise<GenerateCertResponse>;
|
|
2
|
+
export function getCertStatus(isCertificateInDevice?: boolean): GetCertStatusResponse;
|
|
3
|
+
export type GenerateCertResponse = {
|
|
4
|
+
/**
|
|
5
|
+
* - El certificado generado en formato string.
|
|
6
|
+
*/
|
|
2
7
|
cert: string;
|
|
8
|
+
/**
|
|
9
|
+
* - Indica si la operación fue exitosa.
|
|
10
|
+
*/
|
|
3
11
|
success: boolean;
|
|
4
|
-
}
|
|
5
|
-
export
|
|
12
|
+
};
|
|
13
|
+
export type GetCertStatusResponse = {
|
|
14
|
+
/**
|
|
15
|
+
* - El estado actual del certificado del usuario.
|
|
16
|
+
*/
|
|
6
17
|
status: string;
|
|
18
|
+
/**
|
|
19
|
+
* - Indica si la operación fue exitosa.
|
|
20
|
+
*/
|
|
7
21
|
success: boolean;
|
|
8
22
|
};
|
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
export default requestRevocation;
|
|
2
|
+
export type RequestRevocationResponse = {
|
|
3
|
+
/**
|
|
4
|
+
* - El estado de la solicitud de revocación (e.g., "pending").
|
|
5
|
+
*/
|
|
6
|
+
revocationStatus: string;
|
|
7
|
+
/**
|
|
8
|
+
* - El ID de la solicitud de revocación.
|
|
9
|
+
*/
|
|
10
|
+
requestId: string | number;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* @typedef {object} RequestRevocationResponse
|
|
14
|
+
* @property {string} revocationStatus - El estado de la solicitud de revocación (e.g., "pending").
|
|
15
|
+
* @property {string|number} requestId - El ID de la solicitud de revocación.
|
|
16
|
+
*/
|
|
2
17
|
/**
|
|
3
18
|
* Simula la solicitud de revocación de un certificado.
|
|
4
19
|
* @param {string} reasonCode - Código o descripción del motivo de la revocación.
|
|
5
|
-
* @returns {Promise<
|
|
20
|
+
* @returns {Promise<RequestRevocationResponse>} Objeto con el estado de la solicitud de revocación.
|
|
6
21
|
*/
|
|
7
|
-
declare function requestRevocation(reasonCode: string): Promise<
|
|
22
|
+
declare function requestRevocation(reasonCode: string): Promise<RequestRevocationResponse>;
|
package/dist/api/signatures.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function signDocument(): Promise<object>;
|
|
1
|
+
export function signDocument(signData: SignDocumentData): Promise<object>;
|
|
2
2
|
export function getDigest(signData: GetDigestData): Promise<GetDigestResponse>;
|
|
3
3
|
export function addSigner(signerData: SignerData): Promise<AddSignerResponse>;
|
|
4
4
|
export function getDocs(data: GetDocsParams): Promise<GetDocsResponse>;
|
|
@@ -105,3 +105,20 @@ export type GetDocsResponse = {
|
|
|
105
105
|
*/
|
|
106
106
|
success: boolean;
|
|
107
107
|
};
|
|
108
|
+
export type SignDocumentData = {
|
|
109
|
+
/**
|
|
110
|
+
* - Objeto con información de la firma.
|
|
111
|
+
*/
|
|
112
|
+
signature: {
|
|
113
|
+
id: string;
|
|
114
|
+
positions: Array<object>;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* - Certificado en base64.
|
|
118
|
+
*/
|
|
119
|
+
cert: string;
|
|
120
|
+
/**
|
|
121
|
+
* - Digest firmado.
|
|
122
|
+
*/
|
|
123
|
+
signedDigest: string;
|
|
124
|
+
};
|
package/dist/api/users.d.ts
CHANGED
|
@@ -1,15 +1,31 @@
|
|
|
1
1
|
export default getCustomer;
|
|
2
|
+
export type GetCustomerResponse = {
|
|
3
|
+
/**
|
|
4
|
+
* - El token de sesión del usuario.
|
|
5
|
+
*/
|
|
6
|
+
token: string;
|
|
7
|
+
/**
|
|
8
|
+
* - Los datos del usuario obtenidos.
|
|
9
|
+
*/
|
|
10
|
+
userData: object;
|
|
11
|
+
/**
|
|
12
|
+
* - Indica si la operación fue exitosa.
|
|
13
|
+
*/
|
|
14
|
+
success: boolean;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* @typedef {object} GetCustomerResponse
|
|
18
|
+
* @property {string} token - El token de sesión del usuario.
|
|
19
|
+
* @property {object} userData - Los datos del usuario obtenidos.
|
|
20
|
+
* @property {boolean} success - Indica si la operación fue exitosa.
|
|
21
|
+
*/
|
|
2
22
|
/**
|
|
3
23
|
* Obtiene el token de un usuario a través de una petición POST.
|
|
4
24
|
* Este método es útil para endpoints que requieren datos en el cuerpo de la petición
|
|
5
25
|
* para buscar un usuario, como un ID de sesión o un token de acceso.
|
|
6
26
|
*
|
|
7
|
-
* @returns {Promise<
|
|
27
|
+
* @returns {Promise<GetCustomerResponse>} Objeto con el token de sesión, los datos del usuario y un indicador de éxito.
|
|
8
28
|
* @throws {Error} Si los parámetros de entrada son inválidos.
|
|
9
29
|
* @throws {ApacuanaAPIError} Si ocurre un error en la API de Apacuana.
|
|
10
30
|
*/
|
|
11
|
-
declare function getCustomer(): Promise<
|
|
12
|
-
token: string;
|
|
13
|
-
userData: object;
|
|
14
|
-
success: boolean;
|
|
15
|
-
}>;
|
|
31
|
+
declare function getCustomer(): Promise<GetCustomerResponse>;
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ declare namespace apacuana {
|
|
|
15
15
|
export { addSigner };
|
|
16
16
|
export { getDocs };
|
|
17
17
|
export { generateCert };
|
|
18
|
+
export { signDocument };
|
|
19
|
+
export { getDigest };
|
|
18
20
|
}
|
|
19
21
|
import { getConfig } from "./config/index";
|
|
20
22
|
import requestRevocation from "./api/revocations";
|
|
@@ -23,3 +25,5 @@ import getCustomer from "./api/users";
|
|
|
23
25
|
import { addSigner } from "./api/signatures";
|
|
24
26
|
import { getDocs } from "./api/signatures";
|
|
25
27
|
import { generateCert } from "./api/certs";
|
|
28
|
+
import { signDocument } from "./api/signatures";
|
|
29
|
+
import { getDigest } from "./api/signatures";
|