apacuana-sdk-core 1.9.0 → 1.10.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 +81 -80
- package/coverage/coverage-final.json +3 -3
- package/coverage/lcov-report/index.html +10 -10
- package/coverage/lcov-report/src/api/certs.js.html +190 -7
- package/coverage/lcov-report/src/api/faceLiveness.js.html +1 -1
- package/coverage/lcov-report/src/api/index.html +10 -10
- package/coverage/lcov-report/src/api/revocations.js.html +1 -1
- package/coverage/lcov-report/src/api/signatures.js.html +1 -1
- package/coverage/lcov-report/src/api/users.js.html +1 -1
- 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 +1 -1
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/index.js.html +14 -2
- package/coverage/lcov-report/src/success/index.html +1 -1
- package/coverage/lcov-report/src/success/index.js.html +1 -1
- package/coverage/lcov-report/src/utils/constant.js.html +5 -2
- 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 +128 -127
- package/dist/api/certs.d.ts +2 -0
- package/dist/index.js +66 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +66 -0
- package/dist/index.mjs.map +1 -1
- package/dist/types/certs.d.ts +16 -0
- package/dist/utils/constant.d.ts +5 -4
- package/dist/utils/helpers.d.ts +1 -1
- package/package.json +1 -1
- package/src/api/certs.js +62 -1
- package/src/index.js +4 -0
- package/src/types/certs.js +9 -0
- package/src/utils/constant.js +1 -0
package/dist/types/certs.d.ts
CHANGED
|
@@ -81,3 +81,19 @@ export type CertificateRequestParams = {
|
|
|
81
81
|
file: string;
|
|
82
82
|
}>;
|
|
83
83
|
};
|
|
84
|
+
export type ValidateCertificateRequestParams = {
|
|
85
|
+
/**
|
|
86
|
+
* - An optional observation for the certificate request.
|
|
87
|
+
*/
|
|
88
|
+
challenge?: string | undefined;
|
|
89
|
+
};
|
|
90
|
+
export type ValidateCertificateResponseData = {
|
|
91
|
+
/**
|
|
92
|
+
* - A message confirming the request.
|
|
93
|
+
*/
|
|
94
|
+
message: string;
|
|
95
|
+
/**
|
|
96
|
+
* - A boolean confirming the request.
|
|
97
|
+
*/
|
|
98
|
+
auth: boolean;
|
|
99
|
+
};
|
package/dist/utils/constant.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export namespace STATUS_CERTIFICATE {
|
|
2
2
|
let request: string;
|
|
3
|
+
let request_cert: string;
|
|
3
4
|
let generate: string;
|
|
4
5
|
let current: string;
|
|
5
6
|
let revoque: string;
|
|
@@ -13,6 +14,10 @@ export const PARSE_STATUS: {
|
|
|
13
14
|
text: string;
|
|
14
15
|
descriptionText: undefined;
|
|
15
16
|
};
|
|
17
|
+
[STATUS_CERTIFICATE.request_cert]: {
|
|
18
|
+
text: string;
|
|
19
|
+
descriptionText: string;
|
|
20
|
+
};
|
|
16
21
|
[STATUS_CERTIFICATE.request]: {
|
|
17
22
|
text: string;
|
|
18
23
|
descriptionText: string;
|
|
@@ -34,10 +39,6 @@ export const PARSE_STATUS: {
|
|
|
34
39
|
text: string;
|
|
35
40
|
descriptionText: string;
|
|
36
41
|
};
|
|
37
|
-
[STATUS_CERTIFICATE.request_cert]: {
|
|
38
|
-
text: string;
|
|
39
|
-
descriptionText: string;
|
|
40
|
-
};
|
|
41
42
|
};
|
|
42
43
|
export namespace VERIFICATION_STATUS {
|
|
43
44
|
let IN_REGISTER: number;
|
package/dist/utils/helpers.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ declare namespace _default {
|
|
|
11
11
|
export { createPayloadGetDigest };
|
|
12
12
|
}
|
|
13
13
|
export default _default;
|
|
14
|
-
declare function getCertificateStatus(userData: any, certificateInDevice: any, integrationType: any):
|
|
14
|
+
declare function getCertificateStatus(userData: any, certificateInDevice: any, integrationType: any): string;
|
|
15
15
|
declare function exportPrivateKey(key: any): Promise<string>;
|
|
16
16
|
declare function arrayBufferToBase64(buffer: any): string;
|
|
17
17
|
declare function encryptedCsr(csr: any, encryptKey?: string): {
|
package/package.json
CHANGED
package/src/api/certs.js
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
* @typedef {import('../types/certs').GetRequirementsResponse} GetRequirementsResponse
|
|
8
8
|
* @typedef {import('../types/certs').CertificateRequestParams} CertificateRequestParams
|
|
9
9
|
* @typedef {import('../types/certs').RequestCertificateResponse} RequestCertificateResponse
|
|
10
|
+
* @typedef {import('../types/certs').ValidateCertificateResponseData} ValidateCertificateResponseData
|
|
11
|
+
* @typedef {import('../types/certs').ValidateCertificateRequestParams} ValidateCertificateRequestParams
|
|
10
12
|
*/
|
|
11
13
|
|
|
12
14
|
import { getConfig } from "../config/index";
|
|
@@ -93,7 +95,10 @@ export const getCertStatus = async (isCertificateInDevice = false) => {
|
|
|
93
95
|
config.integrationType
|
|
94
96
|
);
|
|
95
97
|
const parseStatus = PARSE_STATUS[status];
|
|
96
|
-
|
|
98
|
+
console.log({
|
|
99
|
+
status,
|
|
100
|
+
parseStatus,
|
|
101
|
+
});
|
|
97
102
|
return new ApacuanaSuccess({ status: parseStatus });
|
|
98
103
|
};
|
|
99
104
|
|
|
@@ -257,3 +262,59 @@ export const requestCertificate = async (params) => {
|
|
|
257
262
|
"UNSUPPORTED_INTEGRATION_TYPE"
|
|
258
263
|
);
|
|
259
264
|
};
|
|
265
|
+
|
|
266
|
+
// const validateCertificateOnBoarding = async (params) => {
|
|
267
|
+
// throw new ApacuanaAPIError(
|
|
268
|
+
// "Requesting a certificate is not supported for integration type: ONBOARDING",
|
|
269
|
+
// 501,
|
|
270
|
+
// "NOT_IMPLEMENTED"
|
|
271
|
+
// );
|
|
272
|
+
// // try {
|
|
273
|
+
// // const response = await httpRequest(
|
|
274
|
+
// // "services/api/customer/request-certificate",
|
|
275
|
+
// // params,
|
|
276
|
+
// // "POST"
|
|
277
|
+
// // );
|
|
278
|
+
// // return new ApacuanaSuccess(response);
|
|
279
|
+
// // } catch (error) {
|
|
280
|
+
// // if (error instanceof ApacuanaAPIError) {
|
|
281
|
+
// // throw error;
|
|
282
|
+
// // }
|
|
283
|
+
// // throw new Error(`Failed to request certificate: ${error.message}`);
|
|
284
|
+
// // }
|
|
285
|
+
// };
|
|
286
|
+
|
|
287
|
+
// const validateCertificateOnPremise = async () => {
|
|
288
|
+
// throw new ApacuanaAPIError(
|
|
289
|
+
// "Requesting a certificate is not supported for integration type: ONPREMISE",
|
|
290
|
+
// 501,
|
|
291
|
+
// "NOT_IMPLEMENTED"
|
|
292
|
+
// );
|
|
293
|
+
// };
|
|
294
|
+
|
|
295
|
+
// /**
|
|
296
|
+
// * Requests a certificate for the user.
|
|
297
|
+
// * @param {ValidateCertificateRequestParams} params - The parameters for the certificate request.
|
|
298
|
+
// * @returns {Promise<ValidateCertificateResponseData>} Object with a confirmation message and a success indicator.
|
|
299
|
+
// * @throws {ApacuanaAPIError} If the API response is invalid or the integration type is not supported.
|
|
300
|
+
// * @throws {Error} If the request fails for another reason or the params are invalid.
|
|
301
|
+
// */
|
|
302
|
+
// export const validateCertificate = async (params) => {
|
|
303
|
+
// if (!params || typeof params.challenge !== "string") {
|
|
304
|
+
// throw new Error("Invalid params.");
|
|
305
|
+
// }
|
|
306
|
+
|
|
307
|
+
// const { integrationType } = getConfig();
|
|
308
|
+
// if (integrationType === INTEGRATION_TYPE.ONBOARDING) {
|
|
309
|
+
// return requestCertificateOnBoarding(params);
|
|
310
|
+
// }
|
|
311
|
+
// if (integrationType === INTEGRATION_TYPE.ONPREMISE) {
|
|
312
|
+
// return requestCertificateOnPremise();
|
|
313
|
+
// }
|
|
314
|
+
|
|
315
|
+
// throw new ApacuanaAPIError(
|
|
316
|
+
// `Unsupported integration type: ${integrationType}`,
|
|
317
|
+
// 400,
|
|
318
|
+
// "UNSUPPORTED_INTEGRATION_TYPE"
|
|
319
|
+
// );
|
|
320
|
+
// };
|
package/src/index.js
CHANGED
package/src/types/certs.js
CHANGED
|
@@ -63,5 +63,14 @@
|
|
|
63
63
|
* @property {string} [observation] - An optional observation for the certificate request.
|
|
64
64
|
* @property {Array<{id: string, file: string}>} documents - The documents required for the certificate.
|
|
65
65
|
*/
|
|
66
|
+
/**
|
|
67
|
+
* @typedef {object} ValidateCertificateRequestParams
|
|
68
|
+
* @property {string} [challenge] - An optional observation for the certificate request.
|
|
69
|
+
*/
|
|
70
|
+
/**
|
|
71
|
+
* @typedef {object} ValidateCertificateResponseData
|
|
72
|
+
* @property {string} message - A message confirming the request.
|
|
73
|
+
* @property {boolean} auth - A boolean confirming the request.
|
|
74
|
+
*/
|
|
66
75
|
|
|
67
76
|
export {};
|