apacuana-sdk-core 0.6.2 → 0.7.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.
Files changed (35) hide show
  1. package/README.md +105 -288
  2. package/coverage/clover.xml +142 -136
  3. package/coverage/coverage-final.json +5 -5
  4. package/coverage/lcov-report/index.html +34 -34
  5. package/coverage/lcov-report/src/api/certs.js.html +34 -7
  6. package/coverage/lcov-report/src/api/index.html +19 -19
  7. package/coverage/lcov-report/src/api/revocations.js.html +135 -30
  8. package/coverage/lcov-report/src/api/signatures.js.html +76 -4
  9. package/coverage/lcov-report/src/api/users.js.html +1 -1
  10. package/coverage/lcov-report/src/config/index.html +13 -13
  11. package/coverage/lcov-report/src/config/index.js.html +69 -18
  12. package/coverage/lcov-report/src/errors/index.html +1 -1
  13. package/coverage/lcov-report/src/errors/index.js.html +1 -1
  14. package/coverage/lcov-report/src/index.html +15 -15
  15. package/coverage/lcov-report/src/index.js.html +14 -68
  16. package/coverage/lcov-report/src/utils/constant.js.html +1 -1
  17. package/coverage/lcov-report/src/utils/helpers.js.html +1 -1
  18. package/coverage/lcov-report/src/utils/httpClient.js.html +1 -1
  19. package/coverage/lcov-report/src/utils/index.html +1 -1
  20. package/coverage/lcov.info +224 -216
  21. package/dist/api/certs.d.ts +11 -1
  22. package/dist/api/revocations.d.ts +32 -12
  23. package/dist/api/signatures.d.ts +37 -5
  24. package/dist/config/index.d.ts +13 -2
  25. package/dist/index.d.ts +4 -1
  26. package/dist/index.js +160 -75
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +160 -75
  29. package/dist/index.mjs.map +1 -1
  30. package/package.json +1 -1
  31. package/src/api/certs.js +12 -3
  32. package/src/api/revocations.js +55 -20
  33. package/src/api/signatures.js +25 -1
  34. package/src/config/index.js +25 -8
  35. package/src/index.js +4 -22
@@ -1,131 +1,134 @@
1
1
  TN:
2
2
  SF:src/index.js
3
3
  FN:21,(anonymous_0)
4
- FNF:1
4
+ FN:42,(anonymous_1)
5
+ FNF:2
5
6
  FNH:1
6
7
  FNDA:4,(anonymous_0)
8
+ FNDA:0,(anonymous_1)
7
9
  DA:8,1
10
+ DA:22,4
8
11
  DA:23,4
9
- DA:27,4
10
- DA:29,4
12
+ DA:24,3
13
+ DA:25,3
14
+ DA:26,3
15
+ DA:27,0
11
16
  DA:32,3
12
- DA:35,3
13
- DA:36,3
14
- DA:37,0
15
- DA:44,3
16
- DA:48,2
17
- DA:49,2
18
- DA:51,2
19
- DA:55,2
20
- DA:58,2
21
- DA:59,2
22
- LF:15
23
- LH:14
24
- BRDA:36,0,0,0
25
- BRDA:36,0,1,3
17
+ DA:33,2
18
+ DA:34,2
19
+ DA:35,2
20
+ DA:38,2
21
+ DA:39,2
22
+ DA:42,0
23
+ LF:14
24
+ LH:12
25
+ BRDA:26,0,0,0
26
+ BRDA:26,0,1,3
26
27
  BRF:2
27
28
  BRH:1
28
29
  end_of_record
29
30
  TN:
30
31
  SF:src/api/certs.js
31
- FN:19,(anonymous_0)
32
- FN:45,(anonymous_1)
33
- FN:60,(anonymous_2)
34
- FN:82,(anonymous_3)
32
+ FN:28,(anonymous_0)
33
+ FN:54,(anonymous_1)
34
+ FN:69,(anonymous_2)
35
+ FN:91,(anonymous_3)
35
36
  FNF:4
36
37
  FNH:4
37
38
  FNDA:1,(anonymous_0)
38
39
  FNDA:1,(anonymous_1)
39
40
  FNDA:3,(anonymous_2)
40
41
  FNDA:1,(anonymous_3)
41
- DA:19,2
42
- DA:20,1
43
- DA:21,1
44
- DA:26,1
45
- DA:27,1
46
- DA:28,0
42
+ DA:28,2
43
+ DA:29,1
44
+ DA:30,1
47
45
  DA:35,1
48
- DA:38,0
49
- DA:39,0
50
- DA:41,0
51
- DA:45,2
52
- DA:46,1
53
- DA:60,2
54
- DA:61,3
55
- DA:62,3
56
- DA:63,3
57
- DA:64,1
58
- DA:66,2
59
- DA:67,1
60
- DA:70,1
61
- DA:82,2
62
- DA:83,1
63
- DA:84,1
64
- DA:88,1
46
+ DA:36,1
47
+ DA:37,0
48
+ DA:44,1
49
+ DA:47,0
50
+ DA:48,0
51
+ DA:50,0
52
+ DA:54,2
53
+ DA:55,1
54
+ DA:69,2
55
+ DA:70,3
56
+ DA:71,3
57
+ DA:72,3
58
+ DA:73,1
59
+ DA:75,2
60
+ DA:76,1
61
+ DA:79,1
62
+ DA:91,2
63
+ DA:92,1
64
+ DA:93,1
65
+ DA:97,1
65
66
  LF:24
66
67
  LH:20
67
- BRDA:19,0,0,0
68
- BRDA:27,1,0,0
69
- BRDA:27,1,1,1
70
- BRDA:27,2,0,1
71
- BRDA:27,2,1,1
72
- BRDA:38,3,0,0
73
- BRDA:38,3,1,0
74
- BRDA:60,4,0,0
75
- BRDA:63,5,0,1
76
- BRDA:63,5,1,2
77
- BRDA:66,6,0,1
78
- BRDA:66,6,1,1
79
- BRDA:82,7,0,0
80
- BRF:13
68
+ BRDA:36,0,0,0
69
+ BRDA:36,0,1,1
70
+ BRDA:36,1,0,1
71
+ BRDA:36,1,1,1
72
+ BRDA:47,2,0,0
73
+ BRDA:47,2,1,0
74
+ BRDA:72,3,0,1
75
+ BRDA:72,3,1,2
76
+ BRDA:75,4,0,1
77
+ BRDA:75,4,1,1
78
+ BRDA:91,5,0,0
79
+ BRF:11
81
80
  BRH:7
82
81
  end_of_record
83
82
  TN:
84
83
  SF:src/api/revocations.js
85
- FN:15,(anonymous_0)
86
- FNF:1
84
+ FN:39,(anonymous_0)
85
+ FN:62,(anonymous_1)
86
+ FNF:2
87
87
  FNH:0
88
88
  FNDA:0,(anonymous_0)
89
- DA:15,1
90
- DA:16,0
91
- DA:17,0
92
- DA:21,0
93
- DA:22,0
94
- DA:27,0
95
- DA:28,0
96
- DA:33,0
97
- DA:34,0
98
- DA:35,0
99
- DA:39,0
89
+ FNDA:0,(anonymous_1)
90
+ DA:39,1
91
+ DA:40,0
92
+ DA:41,0
100
93
  DA:44,0
101
- LF:12
102
- LH:1
103
- BRDA:21,0,0,0
104
- BRDA:21,0,1,0
105
- BRDA:34,1,0,0
106
- BRDA:34,1,1,0
107
- BRDA:36,2,0,0
108
- BRDA:36,2,1,0
109
- BRDA:40,3,0,0
110
- BRDA:40,3,1,0
111
- BRF:8
94
+ DA:45,0
95
+ DA:51,0
96
+ DA:53,0
97
+ DA:62,1
98
+ DA:63,0
99
+ DA:64,0
100
+ DA:70,0
101
+ DA:71,0
102
+ DA:74,0
103
+ DA:76,0
104
+ DA:77,0
105
+ DA:79,0
106
+ LF:16
107
+ LH:2
108
+ BRDA:40,0,0,0
109
+ BRDA:40,0,1,0
110
+ BRDA:70,1,0,0
111
+ BRDA:70,1,1,0
112
+ BRDA:76,2,0,0
113
+ BRDA:76,2,1,0
114
+ BRF:6
112
115
  BRH:0
113
116
  end_of_record
114
117
  TN:
115
118
  SF:src/api/signatures.js
116
- FN:77,(anonymous_0)
117
- FN:83,(anonymous_1)
118
- FN:110,(anonymous_2)
119
- FN:118,(anonymous_3)
120
- FN:147,(anonymous_4)
121
- FN:155,(anonymous_5)
122
- FN:168,(anonymous_6)
123
- FN:176,(anonymous_7)
124
- FN:184,(anonymous_8)
125
- FN:233,(anonymous_9)
126
- FN:257,(anonymous_10)
127
- FN:283,(anonymous_11)
128
- FN:318,(anonymous_12)
119
+ FN:76,(anonymous_0)
120
+ FN:82,(anonymous_1)
121
+ FN:109,(anonymous_2)
122
+ FN:117,(anonymous_3)
123
+ FN:146,(anonymous_4)
124
+ FN:154,(anonymous_5)
125
+ FN:167,(anonymous_6)
126
+ FN:175,(anonymous_7)
127
+ FN:183,(anonymous_8)
128
+ FN:232,(anonymous_9)
129
+ FN:256,(anonymous_10)
130
+ FN:307,(anonymous_11)
131
+ FN:342,(anonymous_12)
129
132
  FNF:13
130
133
  FNH:6
131
134
  FNDA:0,(anonymous_0)
@@ -141,130 +144,130 @@ FNDA:0,(anonymous_9)
141
144
  FNDA:0,(anonymous_10)
142
145
  FNDA:4,(anonymous_11)
143
146
  FNDA:5,(anonymous_12)
144
- DA:77,2
147
+ DA:76,2
148
+ DA:77,0
145
149
  DA:78,0
146
150
  DA:79,0
147
151
  DA:80,0
148
- DA:81,0
149
- DA:83,0
150
- DA:94,0
151
- DA:99,0
152
+ DA:82,0
153
+ DA:93,0
154
+ DA:98,0
155
+ DA:100,0
152
156
  DA:101,0
153
- DA:102,0
154
- DA:104,0
155
- DA:110,2
156
- DA:111,0
157
- DA:118,2
157
+ DA:103,0
158
+ DA:109,2
159
+ DA:110,0
160
+ DA:117,2
161
+ DA:118,0
158
162
  DA:119,0
159
- DA:120,0
163
+ DA:126,0
160
164
  DA:127,0
161
165
  DA:128,0
162
- DA:129,0
163
- DA:136,0
166
+ DA:135,0
167
+ DA:137,0
164
168
  DA:138,0
165
- DA:139,0
166
- DA:141,0
167
- DA:147,2
168
- DA:148,0
169
- DA:155,2
169
+ DA:140,0
170
+ DA:146,2
171
+ DA:147,0
172
+ DA:154,2
173
+ DA:155,1
170
174
  DA:156,1
171
175
  DA:157,1
172
176
  DA:158,1
173
- DA:159,1
177
+ DA:160,0
174
178
  DA:161,0
175
- DA:162,0
176
- DA:164,0
177
- DA:168,2
178
- DA:169,1
179
- DA:176,2
180
- DA:177,1
179
+ DA:163,0
180
+ DA:167,2
181
+ DA:168,1
182
+ DA:175,2
183
+ DA:176,1
184
+ DA:183,2
181
185
  DA:184,2
182
186
  DA:185,2
183
- DA:186,2
184
- DA:187,1
187
+ DA:186,1
188
+ DA:193,1
185
189
  DA:194,1
186
- DA:195,1
190
+ DA:200,1
187
191
  DA:201,1
188
- DA:202,1
192
+ DA:204,1
189
193
  DA:205,1
190
194
  DA:206,1
191
- DA:207,1
195
+ DA:212,0
192
196
  DA:213,0
193
- DA:214,0
194
- DA:216,0
195
- DA:233,2
196
- DA:234,0
197
+ DA:215,0
198
+ DA:232,2
199
+ DA:233,0
200
+ DA:235,0
197
201
  DA:236,0
198
- DA:237,0
202
+ DA:239,0
199
203
  DA:240,0
200
- DA:241,0
201
- DA:244,0
202
- DA:257,2
203
- DA:258,0
204
- DA:260,0
204
+ DA:243,0
205
+ DA:256,2
206
+ DA:257,0
207
+ DA:259,0
208
+ DA:261,0
205
209
  DA:262,0
206
- DA:263,0
210
+ DA:265,0
207
211
  DA:266,0
208
- DA:267,0
209
- DA:270,0
210
- DA:283,2
211
- DA:284,4
212
- DA:289,1
213
- DA:295,3
214
- DA:297,3
215
- DA:298,1
216
- DA:301,2
217
- DA:302,1
218
- DA:305,1
219
- DA:318,2
220
- DA:319,5
212
+ DA:269,0
213
+ DA:307,2
214
+ DA:308,4
215
+ DA:313,1
216
+ DA:319,3
221
217
  DA:321,3
222
- DA:323,3
223
- DA:324,2
224
- DA:327,1
225
- DA:328,1
226
- DA:331,0
218
+ DA:322,1
219
+ DA:325,2
220
+ DA:326,1
221
+ DA:329,1
222
+ DA:342,2
223
+ DA:343,5
224
+ DA:345,3
225
+ DA:347,3
226
+ DA:348,2
227
+ DA:351,1
228
+ DA:352,1
229
+ DA:355,0
227
230
  LF:83
228
231
  LH:42
229
- BRDA:101,0,0,0
230
- BRDA:101,0,1,0
231
- BRDA:105,1,0,0
232
- BRDA:105,1,1,0
233
- BRDA:127,2,0,0
234
- BRDA:127,2,1,0
235
- BRDA:128,3,0,0
236
- BRDA:128,3,1,0
237
- BRDA:138,4,0,0
238
- BRDA:138,4,1,0
239
- BRDA:161,5,0,0
240
- BRDA:161,5,1,0
241
- BRDA:186,6,0,1
242
- BRDA:186,6,1,1
243
- BRDA:201,7,0,1
244
- BRDA:201,7,1,0
245
- BRDA:213,8,0,0
246
- BRDA:213,8,1,0
247
- BRDA:236,9,0,0
248
- BRDA:236,9,1,0
249
- BRDA:240,10,0,0
250
- BRDA:240,10,1,0
251
- BRDA:262,11,0,0
252
- BRDA:262,11,1,0
253
- BRDA:266,12,0,0
254
- BRDA:266,12,1,0
255
- BRDA:284,13,0,1
256
- BRDA:284,13,1,3
257
- BRDA:285,14,0,4
258
- BRDA:285,14,1,3
259
- BRDA:285,14,2,3
260
- BRDA:297,15,0,1
261
- BRDA:297,15,1,2
262
- BRDA:301,16,0,1
263
- BRDA:301,16,1,1
264
- BRDA:323,17,0,2
265
- BRDA:323,17,1,1
266
- BRDA:327,18,0,1
267
- BRDA:327,18,1,0
232
+ BRDA:100,0,0,0
233
+ BRDA:100,0,1,0
234
+ BRDA:104,1,0,0
235
+ BRDA:104,1,1,0
236
+ BRDA:126,2,0,0
237
+ BRDA:126,2,1,0
238
+ BRDA:127,3,0,0
239
+ BRDA:127,3,1,0
240
+ BRDA:137,4,0,0
241
+ BRDA:137,4,1,0
242
+ BRDA:160,5,0,0
243
+ BRDA:160,5,1,0
244
+ BRDA:185,6,0,1
245
+ BRDA:185,6,1,1
246
+ BRDA:200,7,0,1
247
+ BRDA:200,7,1,0
248
+ BRDA:212,8,0,0
249
+ BRDA:212,8,1,0
250
+ BRDA:235,9,0,0
251
+ BRDA:235,9,1,0
252
+ BRDA:239,10,0,0
253
+ BRDA:239,10,1,0
254
+ BRDA:261,11,0,0
255
+ BRDA:261,11,1,0
256
+ BRDA:265,12,0,0
257
+ BRDA:265,12,1,0
258
+ BRDA:308,13,0,1
259
+ BRDA:308,13,1,3
260
+ BRDA:309,14,0,4
261
+ BRDA:309,14,1,3
262
+ BRDA:309,14,2,3
263
+ BRDA:321,15,0,1
264
+ BRDA:321,15,1,2
265
+ BRDA:325,16,0,1
266
+ BRDA:325,16,1,1
267
+ BRDA:347,17,0,2
268
+ BRDA:347,17,1,1
269
+ BRDA:351,18,0,1
270
+ BRDA:351,18,1,0
268
271
  BRF:39
269
272
  BRH:15
270
273
  end_of_record
@@ -306,33 +309,38 @@ BRH:11
306
309
  end_of_record
307
310
  TN:
308
311
  SF:src/config/index.js
309
- FN:15,(anonymous_0)
310
- FN:41,(anonymous_1)
311
- FNF:2
312
+ FN:30,(anonymous_0)
313
+ FN:53,(anonymous_1)
314
+ FN:55,(anonymous_2)
315
+ FNF:3
312
316
  FNH:0
313
317
  FNDA:0,(anonymous_0)
314
318
  FNDA:0,(anonymous_1)
315
- DA:4,2
316
- DA:15,2
317
- DA:16,0
318
- DA:18,0
319
- DA:19,0
320
- DA:26,0
321
- DA:27,0
322
- DA:33,0
319
+ FNDA:0,(anonymous_2)
320
+ DA:16,2
321
+ DA:28,2
322
+ DA:30,2
323
+ DA:32,0
324
+ DA:34,0
323
325
  DA:35,0
324
- DA:41,2
325
- LF:10
326
- LH:3
327
- BRDA:18,0,0,0
328
- BRDA:18,0,1,0
329
- BRDA:18,1,0,0
330
- BRDA:18,1,1,0
331
- BRDA:18,1,2,0
332
- BRDA:18,1,3,0
333
- BRDA:18,1,4,0
334
- BRDA:26,2,0,0
335
- BRDA:26,2,1,0
326
+ DA:42,0
327
+ DA:43,0
328
+ DA:49,0
329
+ DA:53,2
330
+ DA:55,2
331
+ DA:56,0
332
+ DA:57,0
333
+ LF:13
334
+ LH:5
335
+ BRDA:34,0,0,0
336
+ BRDA:34,0,1,0
337
+ BRDA:34,1,0,0
338
+ BRDA:34,1,1,0
339
+ BRDA:34,1,2,0
340
+ BRDA:34,1,3,0
341
+ BRDA:34,1,4,0
342
+ BRDA:42,2,0,0
343
+ BRDA:42,2,1,0
336
344
  BRF:9
337
345
  BRH:0
338
346
  end_of_record
@@ -1,10 +1,14 @@
1
- export function generateCert(encryptedCSR?: undefined): Promise<GenerateCertResponse>;
1
+ export function generateCert(encryptedCSR: EncryptedCSRObject): Promise<GenerateCertResponse>;
2
2
  export function getCertStatus(isCertificateInDevice?: boolean): GetCertStatusResponse;
3
3
  export type GenerateCertResponse = {
4
4
  /**
5
5
  * - El certificado generado en formato string.
6
6
  */
7
7
  cert: string;
8
+ /**
9
+ * - El ID del certificado generado.
10
+ */
11
+ certifiedid: string;
8
12
  /**
9
13
  * - Indica si la operación fue exitosa.
10
14
  */
@@ -20,3 +24,9 @@ export type GetCertStatusResponse = {
20
24
  */
21
25
  success: boolean;
22
26
  };
27
+ export type EncryptedCSRObject = {
28
+ /**
29
+ * - The encrypted Certificate Signing Request.
30
+ */
31
+ csr: string;
32
+ };
@@ -1,4 +1,5 @@
1
- export default requestRevocation;
1
+ export function requestRevocation(reasonCode: number): Promise<RevocationResponse>;
2
+ export function getRevocationReasons(): Promise<RevocationReasonsResponse>;
2
3
  export type RequestRevocationResponse = {
3
4
  /**
4
5
  * - El estado de la solicitud de revocación (e.g., "pending").
@@ -9,14 +10,33 @@ export type RequestRevocationResponse = {
9
10
  */
10
11
  requestId: string | number;
11
12
  };
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
- */
17
- /**
18
- * Simula la solicitud de revocación de un certificado.
19
- * @param {string} reasonCode - Código o descripción del motivo de la revocación.
20
- * @returns {Promise<RequestRevocationResponse>} Objeto con el estado de la solicitud de revocación.
21
- */
22
- declare function requestRevocation(reasonCode: string): Promise<RequestRevocationResponse>;
13
+ export type RevocationResponse = {
14
+ /**
15
+ * - Indicates if the revocation request was successful.
16
+ */
17
+ success: boolean;
18
+ /**
19
+ * - A message providing details about the outcome.
20
+ */
21
+ message?: string | undefined;
22
+ };
23
+ export type RevocationReason = {
24
+ /**
25
+ * - The code for the revocation reason.
26
+ */
27
+ code: string;
28
+ /**
29
+ * - The description of the revocation reason.
30
+ */
31
+ description: string;
32
+ };
33
+ export type RevocationReasonsResponse = {
34
+ /**
35
+ * - Indicates if the request was successful.
36
+ */
37
+ success: boolean;
38
+ /**
39
+ * - A list of revocation reasons.
40
+ */
41
+ reasons: RevocationReason[];
42
+ };
@@ -1,6 +1,6 @@
1
1
  export function signDocument(signData: SignDocumentData): Promise<object>;
2
2
  export function getDigest(signData: GetDigestData): Promise<GetDigestResponse>;
3
- export function addSigner(signerData: SignerData): Promise<AddSignerResponse>;
3
+ export function addSigner(signerData: OnboardingSignerData | object): Promise<object>;
4
4
  export function getDocs(data: GetDocsParams): Promise<GetDocsResponse>;
5
5
  /**
6
6
  * Define la estructura de un objeto Firmante.
@@ -27,10 +27,6 @@ export type SignerData = {
27
27
  * - Identificador único del documento.
28
28
  */
29
29
  docId: string;
30
- /**
31
- * - Objeto con la información del firmante.
32
- */
33
- signer: Signer;
34
30
  };
35
31
  /**
36
32
  * Define la estructura de la respuesta al añadir un firmante.
@@ -122,3 +118,39 @@ export type SignDocumentData = {
122
118
  */
123
119
  signedDigest: string;
124
120
  };
121
+ export type SignaturePosition = {
122
+ /**
123
+ * - The page number for the signature.
124
+ */
125
+ page: number;
126
+ /**
127
+ * - The x-coordinate for the signature's position (from 0 to 1).
128
+ */
129
+ x: number;
130
+ /**
131
+ * - The y-coordinate for the signature's position (from 0 to 1).
132
+ */
133
+ y: number;
134
+ };
135
+ export type OnboardingSignerData = {
136
+ /**
137
+ * - The name of the document.
138
+ */
139
+ name: string;
140
+ /**
141
+ * - An external reference for the document.
142
+ */
143
+ reference: string;
144
+ /**
145
+ * - The type of document of the signer (e.g., "V", "E", "J").
146
+ */
147
+ typedoc: string;
148
+ /**
149
+ * - The document number of the signer.
150
+ */
151
+ doc: string;
152
+ /**
153
+ * - An array of signature positions.
154
+ */
155
+ signature: SignaturePosition[];
156
+ };
@@ -6,6 +6,17 @@ export function getConfig(): {
6
6
  verificationId: string;
7
7
  customerId: string;
8
8
  integrationType: string;
9
- userData: undefined;
10
- token: undefined;
9
+ userData?: object | undefined;
10
+ token?: string | undefined;
11
+ };
12
+ export function cleanConfig(): void;
13
+ export type SDKConfig = {
14
+ apiUrl: string;
15
+ secretKey: string;
16
+ apiKey: string;
17
+ verificationId: string;
18
+ customerId: string;
19
+ integrationType: string;
20
+ userData?: object | undefined;
21
+ token?: string | undefined;
11
22
  };