apacuana-sdk-core 0.3.0 → 0.5.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 +82 -82
- package/coverage/coverage-final.json +3 -3
- package/coverage/lcov-report/block-navigation.js +1 -1
- package/coverage/lcov-report/index.html +1 -1
- package/coverage/lcov-report/sorter.js +21 -7
- package/coverage/lcov-report/src/api/certs.js.html +2 -2
- package/coverage/lcov-report/src/api/index.html +1 -1
- package/coverage/lcov-report/src/api/revocations.js.html +12 -15
- package/coverage/lcov-report/src/api/signatures.js.html +320 -140
- 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 +6 -3
- 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 +137 -137
- package/dist/api/certs.d.ts +8 -0
- package/dist/api/revocations.d.ts +7 -0
- package/dist/api/signatures.d.ts +107 -0
- package/dist/api/users.d.ts +15 -0
- package/dist/config/index.d.ts +11 -0
- package/dist/errors/index.d.ts +10 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +204 -97
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +204 -97
- package/dist/index.mjs.map +1 -1
- package/dist/utils/constant.d.ts +18 -0
- package/dist/utils/helpers.d.ts +21 -0
- package/dist/utils/httpClient.d.ts +3 -0
- package/package.json +9 -4
- package/src/api/certs.js +1 -1
- package/src/api/revocations.js +10 -11
- package/src/api/signatures.js +156 -96
- package/src/index.js +2 -1
- package/tests/api/signatures.test.js +11 -4
- package/tsconfig.json +15 -0
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
102
102
|
Code coverage generated by
|
|
103
103
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
104
|
-
at 2025-08-
|
|
104
|
+
at 2025-08-25T18:24:18.701Z
|
|
105
105
|
</div>
|
|
106
106
|
<script src="../../prettify.js"></script>
|
|
107
107
|
<script>
|
|
@@ -193,7 +193,7 @@ export const getConfig = <span class="fstat-no" title="function not covered" >()
|
|
|
193
193
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
194
194
|
Code coverage generated by
|
|
195
195
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
196
|
-
at 2025-08-
|
|
196
|
+
at 2025-08-25T18:24:18.701Z
|
|
197
197
|
</div>
|
|
198
198
|
<script src="../../prettify.js"></script>
|
|
199
199
|
<script>
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
102
102
|
Code coverage generated by
|
|
103
103
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
104
|
-
at 2025-08-
|
|
104
|
+
at 2025-08-25T18:24:18.701Z
|
|
105
105
|
</div>
|
|
106
106
|
<script src="../../prettify.js"></script>
|
|
107
107
|
<script>
|
|
@@ -133,7 +133,7 @@ export default ApacuanaAPIError;
|
|
|
133
133
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
134
134
|
Code coverage generated by
|
|
135
135
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
136
|
-
at 2025-08-
|
|
136
|
+
at 2025-08-25T18:24:18.701Z
|
|
137
137
|
</div>
|
|
138
138
|
<script src="../../prettify.js"></script>
|
|
139
139
|
<script>
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
102
102
|
Code coverage generated by
|
|
103
103
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
104
|
-
at 2025-08-
|
|
104
|
+
at 2025-08-25T18:24:18.701Z
|
|
105
105
|
</div>
|
|
106
106
|
<script src="../prettify.js"></script>
|
|
107
107
|
<script>
|
|
@@ -133,7 +133,8 @@
|
|
|
133
133
|
<a name='L68'></a><a href='#L68'>68</a>
|
|
134
134
|
<a name='L69'></a><a href='#L69'>69</a>
|
|
135
135
|
<a name='L70'></a><a href='#L70'>70</a>
|
|
136
|
-
<a name='L71'></a><a href='#L71'>71</a
|
|
136
|
+
<a name='L71'></a><a href='#L71'>71</a>
|
|
137
|
+
<a name='L72'></a><a href='#L72'>72</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
137
138
|
<span class="cline-any cline-neutral"> </span>
|
|
138
139
|
<span class="cline-any cline-neutral"> </span>
|
|
139
140
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -203,11 +204,12 @@
|
|
|
203
204
|
<span class="cline-any cline-neutral"> </span>
|
|
204
205
|
<span class="cline-any cline-neutral"> </span>
|
|
205
206
|
<span class="cline-any cline-neutral"> </span>
|
|
207
|
+
<span class="cline-any cline-neutral"> </span>
|
|
206
208
|
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import { setConfig, getConfig } from "./config/index";
|
|
207
209
|
import { initHttpClient, setAuthToken } from "./utils/httpClient";
|
|
208
210
|
import getCustomer from "./api/users";
|
|
209
211
|
import requestRevocation from "./api/revocations";
|
|
210
|
-
import { getCertStatus } from "./api/certs";
|
|
212
|
+
import { generateCert, getCertStatus } from "./api/certs";
|
|
211
213
|
import { addSigner, getDocs } from "./api/signatures";
|
|
212
214
|
|
|
213
215
|
const apacuana = {
|
|
@@ -270,6 +272,7 @@ const apacuana = {
|
|
|
270
272
|
getCustomer,
|
|
271
273
|
addSigner,
|
|
272
274
|
getDocs,
|
|
275
|
+
generateCert,
|
|
273
276
|
};
|
|
274
277
|
|
|
275
278
|
export default apacuana;
|
|
@@ -280,7 +283,7 @@ export default apacuana;
|
|
|
280
283
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
281
284
|
Code coverage generated by
|
|
282
285
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
283
|
-
at 2025-08-
|
|
286
|
+
at 2025-08-25T18:24:18.701Z
|
|
284
287
|
</div>
|
|
285
288
|
<script src="../prettify.js"></script>
|
|
286
289
|
<script>
|
|
@@ -130,7 +130,7 @@ export const INTEGRATION_TYPE = {
|
|
|
130
130
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
131
131
|
Code coverage generated by
|
|
132
132
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
133
|
-
at 2025-08-
|
|
133
|
+
at 2025-08-25T18:24:18.701Z
|
|
134
134
|
</div>
|
|
135
135
|
<script src="../../prettify.js"></script>
|
|
136
136
|
<script>
|
|
@@ -742,7 +742,7 @@ export default {
|
|
|
742
742
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
743
743
|
Code coverage generated by
|
|
744
744
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
745
|
-
at 2025-08-
|
|
745
|
+
at 2025-08-25T18:24:18.701Z
|
|
746
746
|
</div>
|
|
747
747
|
<script src="../../prettify.js"></script>
|
|
748
748
|
<script>
|
|
@@ -631,7 +631,7 @@ export const httpRequest = <span class="fstat-no" title="function not covered" >
|
|
|
631
631
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
632
632
|
Code coverage generated by
|
|
633
633
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
634
|
-
at 2025-08-
|
|
634
|
+
at 2025-08-25T18:24:18.701Z
|
|
635
635
|
</div>
|
|
636
636
|
<script src="../../prettify.js"></script>
|
|
637
637
|
<script>
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
132
132
|
Code coverage generated by
|
|
133
133
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
134
|
-
at 2025-08-
|
|
134
|
+
at 2025-08-25T18:24:18.701Z
|
|
135
135
|
</div>
|
|
136
136
|
<script src="../../prettify.js"></script>
|
|
137
137
|
<script>
|
package/coverage/lcov.info
CHANGED
|
@@ -81,174 +81,174 @@ BRH:8
|
|
|
81
81
|
end_of_record
|
|
82
82
|
TN:
|
|
83
83
|
SF:src/api/revocations.js
|
|
84
|
-
FN:
|
|
84
|
+
FN:9,(anonymous_0)
|
|
85
85
|
FNF:1
|
|
86
86
|
FNH:0
|
|
87
87
|
FNDA:0,(anonymous_0)
|
|
88
|
-
DA:
|
|
88
|
+
DA:9,1
|
|
89
|
+
DA:10,0
|
|
89
90
|
DA:11,0
|
|
90
|
-
DA:
|
|
91
|
+
DA:15,0
|
|
91
92
|
DA:16,0
|
|
92
|
-
DA:
|
|
93
|
+
DA:21,0
|
|
93
94
|
DA:22,0
|
|
94
|
-
DA:
|
|
95
|
+
DA:27,0
|
|
95
96
|
DA:28,0
|
|
96
97
|
DA:29,0
|
|
97
|
-
DA:
|
|
98
|
-
DA:
|
|
99
|
-
DA:39,0
|
|
98
|
+
DA:33,0
|
|
99
|
+
DA:38,0
|
|
100
100
|
LF:12
|
|
101
101
|
LH:1
|
|
102
|
-
BRDA:
|
|
103
|
-
BRDA:
|
|
104
|
-
BRDA:
|
|
105
|
-
BRDA:
|
|
106
|
-
BRDA:
|
|
107
|
-
BRDA:
|
|
108
|
-
BRDA:
|
|
109
|
-
BRDA:
|
|
102
|
+
BRDA:15,0,0,0
|
|
103
|
+
BRDA:15,0,1,0
|
|
104
|
+
BRDA:28,1,0,0
|
|
105
|
+
BRDA:28,1,1,0
|
|
106
|
+
BRDA:30,2,0,0
|
|
107
|
+
BRDA:30,2,1,0
|
|
108
|
+
BRDA:34,3,0,0
|
|
109
|
+
BRDA:34,3,1,0
|
|
110
110
|
BRF:8
|
|
111
111
|
BRH:0
|
|
112
112
|
end_of_record
|
|
113
113
|
TN:
|
|
114
114
|
SF:src/api/signatures.js
|
|
115
|
-
FN:
|
|
116
|
-
FN:
|
|
117
|
-
FN:
|
|
118
|
-
FN:
|
|
119
|
-
FN:
|
|
120
|
-
FN:
|
|
121
|
-
FN:
|
|
122
|
-
FN:
|
|
123
|
-
FN:
|
|
124
|
-
FN:
|
|
125
|
-
FN:
|
|
126
|
-
FN:
|
|
115
|
+
FN:68,(anonymous_0)
|
|
116
|
+
FN:76,(anonymous_1)
|
|
117
|
+
FN:84,(anonymous_2)
|
|
118
|
+
FN:113,(anonymous_3)
|
|
119
|
+
FN:121,(anonymous_4)
|
|
120
|
+
FN:134,(anonymous_5)
|
|
121
|
+
FN:142,(anonymous_6)
|
|
122
|
+
FN:150,(anonymous_7)
|
|
123
|
+
FN:198,(anonymous_8)
|
|
124
|
+
FN:222,(anonymous_9)
|
|
125
|
+
FN:248,(anonymous_10)
|
|
126
|
+
FN:283,(anonymous_11)
|
|
127
127
|
FNF:12
|
|
128
128
|
FNH:6
|
|
129
129
|
FNDA:0,(anonymous_0)
|
|
130
130
|
FNDA:0,(anonymous_1)
|
|
131
131
|
FNDA:0,(anonymous_2)
|
|
132
132
|
FNDA:0,(anonymous_3)
|
|
133
|
-
FNDA:
|
|
134
|
-
FNDA:
|
|
133
|
+
FNDA:1,(anonymous_4)
|
|
134
|
+
FNDA:1,(anonymous_5)
|
|
135
135
|
FNDA:1,(anonymous_6)
|
|
136
|
-
FNDA:
|
|
137
|
-
FNDA:
|
|
138
|
-
FNDA:
|
|
139
|
-
FNDA:
|
|
136
|
+
FNDA:2,(anonymous_7)
|
|
137
|
+
FNDA:0,(anonymous_8)
|
|
138
|
+
FNDA:0,(anonymous_9)
|
|
139
|
+
FNDA:4,(anonymous_10)
|
|
140
140
|
FNDA:5,(anonymous_11)
|
|
141
|
-
DA:
|
|
142
|
-
DA:9,0
|
|
143
|
-
DA:16,2
|
|
144
|
-
DA:17,0
|
|
145
|
-
DA:30,2
|
|
146
|
-
DA:31,0
|
|
147
|
-
DA:33,0
|
|
148
|
-
DA:34,0
|
|
149
|
-
DA:37,0
|
|
150
|
-
DA:38,0
|
|
151
|
-
DA:41,0
|
|
152
|
-
DA:48,2
|
|
153
|
-
DA:49,0
|
|
154
|
-
DA:50,0
|
|
155
|
-
DA:57,0
|
|
156
|
-
DA:58,0
|
|
157
|
-
DA:59,0
|
|
158
|
-
DA:66,0
|
|
159
|
-
DA:68,0
|
|
141
|
+
DA:68,2
|
|
160
142
|
DA:69,0
|
|
161
|
-
DA:
|
|
162
|
-
DA:77,
|
|
163
|
-
DA:
|
|
164
|
-
DA:
|
|
165
|
-
DA:
|
|
143
|
+
DA:76,2
|
|
144
|
+
DA:77,0
|
|
145
|
+
DA:84,2
|
|
146
|
+
DA:85,0
|
|
147
|
+
DA:86,0
|
|
148
|
+
DA:93,0
|
|
166
149
|
DA:94,0
|
|
167
|
-
DA:
|
|
168
|
-
DA:
|
|
169
|
-
DA:100,0
|
|
170
|
-
DA:101,0
|
|
150
|
+
DA:95,0
|
|
151
|
+
DA:102,0
|
|
171
152
|
DA:104,0
|
|
172
|
-
DA:
|
|
173
|
-
DA:
|
|
174
|
-
DA:113,
|
|
175
|
-
DA:
|
|
176
|
-
DA:
|
|
177
|
-
DA:
|
|
178
|
-
DA:
|
|
179
|
-
DA:
|
|
180
|
-
DA:
|
|
181
|
-
DA:
|
|
182
|
-
DA:
|
|
183
|
-
DA:
|
|
184
|
-
DA:
|
|
185
|
-
DA:
|
|
186
|
-
DA:
|
|
187
|
-
DA:
|
|
188
|
-
DA:
|
|
153
|
+
DA:105,0
|
|
154
|
+
DA:107,0
|
|
155
|
+
DA:113,2
|
|
156
|
+
DA:114,0
|
|
157
|
+
DA:121,2
|
|
158
|
+
DA:122,1
|
|
159
|
+
DA:123,1
|
|
160
|
+
DA:124,1
|
|
161
|
+
DA:125,1
|
|
162
|
+
DA:127,0
|
|
163
|
+
DA:128,0
|
|
164
|
+
DA:130,0
|
|
165
|
+
DA:134,2
|
|
166
|
+
DA:135,1
|
|
167
|
+
DA:142,2
|
|
168
|
+
DA:143,1
|
|
169
|
+
DA:150,2
|
|
170
|
+
DA:151,2
|
|
171
|
+
DA:152,2
|
|
172
|
+
DA:153,1
|
|
173
|
+
DA:160,1
|
|
189
174
|
DA:161,1
|
|
190
|
-
DA:
|
|
191
|
-
DA:
|
|
175
|
+
DA:167,1
|
|
176
|
+
DA:168,1
|
|
177
|
+
DA:171,1
|
|
192
178
|
DA:172,1
|
|
193
|
-
DA:
|
|
194
|
-
DA:
|
|
195
|
-
DA:
|
|
196
|
-
DA:182,
|
|
197
|
-
DA:
|
|
198
|
-
DA:
|
|
199
|
-
DA:
|
|
200
|
-
DA:
|
|
201
|
-
DA:
|
|
202
|
-
DA:
|
|
203
|
-
DA:202,1
|
|
204
|
-
DA:208,0
|
|
179
|
+
DA:173,1
|
|
180
|
+
DA:179,0
|
|
181
|
+
DA:180,0
|
|
182
|
+
DA:182,0
|
|
183
|
+
DA:198,2
|
|
184
|
+
DA:199,0
|
|
185
|
+
DA:201,0
|
|
186
|
+
DA:202,0
|
|
187
|
+
DA:205,0
|
|
188
|
+
DA:206,0
|
|
205
189
|
DA:209,0
|
|
206
|
-
DA:
|
|
207
|
-
DA:223,
|
|
208
|
-
DA:
|
|
209
|
-
DA:
|
|
210
|
-
DA:228,
|
|
211
|
-
DA:
|
|
212
|
-
DA:232,
|
|
213
|
-
DA:
|
|
214
|
-
DA:
|
|
190
|
+
DA:222,2
|
|
191
|
+
DA:223,0
|
|
192
|
+
DA:225,0
|
|
193
|
+
DA:227,0
|
|
194
|
+
DA:228,0
|
|
195
|
+
DA:231,0
|
|
196
|
+
DA:232,0
|
|
197
|
+
DA:235,0
|
|
198
|
+
DA:248,2
|
|
199
|
+
DA:249,4
|
|
200
|
+
DA:254,1
|
|
201
|
+
DA:260,3
|
|
202
|
+
DA:262,3
|
|
203
|
+
DA:263,1
|
|
204
|
+
DA:266,2
|
|
205
|
+
DA:267,1
|
|
206
|
+
DA:270,1
|
|
207
|
+
DA:283,2
|
|
208
|
+
DA:284,5
|
|
209
|
+
DA:286,3
|
|
210
|
+
DA:288,3
|
|
211
|
+
DA:289,2
|
|
212
|
+
DA:292,1
|
|
213
|
+
DA:293,1
|
|
214
|
+
DA:296,0
|
|
215
215
|
LF:74
|
|
216
216
|
LH:42
|
|
217
|
-
BRDA:
|
|
218
|
-
BRDA:
|
|
219
|
-
BRDA:
|
|
220
|
-
BRDA:
|
|
221
|
-
BRDA:
|
|
222
|
-
BRDA:
|
|
223
|
-
BRDA:
|
|
224
|
-
BRDA:
|
|
225
|
-
BRDA:
|
|
226
|
-
BRDA:
|
|
227
|
-
BRDA:
|
|
228
|
-
BRDA:
|
|
229
|
-
BRDA:
|
|
230
|
-
BRDA:
|
|
231
|
-
BRDA:
|
|
232
|
-
BRDA:
|
|
233
|
-
BRDA:
|
|
234
|
-
BRDA:
|
|
235
|
-
BRDA:
|
|
236
|
-
BRDA:
|
|
237
|
-
BRDA:
|
|
238
|
-
BRDA:
|
|
239
|
-
BRDA:
|
|
240
|
-
BRDA:
|
|
241
|
-
BRDA:
|
|
242
|
-
BRDA:
|
|
243
|
-
BRDA:
|
|
244
|
-
BRDA:
|
|
245
|
-
BRDA:
|
|
246
|
-
BRDA:
|
|
247
|
-
BRDA:
|
|
248
|
-
BRDA:
|
|
249
|
-
BRDA:
|
|
250
|
-
BRDA:
|
|
251
|
-
BRDA:
|
|
217
|
+
BRDA:93,0,0,0
|
|
218
|
+
BRDA:93,0,1,0
|
|
219
|
+
BRDA:94,1,0,0
|
|
220
|
+
BRDA:94,1,1,0
|
|
221
|
+
BRDA:104,2,0,0
|
|
222
|
+
BRDA:104,2,1,0
|
|
223
|
+
BRDA:127,3,0,0
|
|
224
|
+
BRDA:127,3,1,0
|
|
225
|
+
BRDA:152,4,0,1
|
|
226
|
+
BRDA:152,4,1,1
|
|
227
|
+
BRDA:167,5,0,1
|
|
228
|
+
BRDA:167,5,1,0
|
|
229
|
+
BRDA:179,6,0,0
|
|
230
|
+
BRDA:179,6,1,0
|
|
231
|
+
BRDA:201,7,0,0
|
|
232
|
+
BRDA:201,7,1,0
|
|
233
|
+
BRDA:205,8,0,0
|
|
234
|
+
BRDA:205,8,1,0
|
|
235
|
+
BRDA:227,9,0,0
|
|
236
|
+
BRDA:227,9,1,0
|
|
237
|
+
BRDA:231,10,0,0
|
|
238
|
+
BRDA:231,10,1,0
|
|
239
|
+
BRDA:249,11,0,1
|
|
240
|
+
BRDA:249,11,1,3
|
|
241
|
+
BRDA:250,12,0,4
|
|
242
|
+
BRDA:250,12,1,3
|
|
243
|
+
BRDA:250,12,2,3
|
|
244
|
+
BRDA:262,13,0,1
|
|
245
|
+
BRDA:262,13,1,2
|
|
246
|
+
BRDA:266,14,0,1
|
|
247
|
+
BRDA:266,14,1,1
|
|
248
|
+
BRDA:288,15,0,2
|
|
249
|
+
BRDA:288,15,1,1
|
|
250
|
+
BRDA:292,16,0,1
|
|
251
|
+
BRDA:292,16,1,0
|
|
252
252
|
BRF:35
|
|
253
253
|
BRH:15
|
|
254
254
|
end_of_record
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export default requestRevocation;
|
|
2
|
+
/**
|
|
3
|
+
* Simula la solicitud de revocación de un certificado.
|
|
4
|
+
* @param {string} reasonCode - Código o descripción del motivo de la revocación.
|
|
5
|
+
* @returns {Promise<object>} Objeto con el estado de la solicitud de revocación.
|
|
6
|
+
*/
|
|
7
|
+
declare function requestRevocation(reasonCode: string): Promise<object>;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
export function signDocument(): Promise<object>;
|
|
2
|
+
export function getDigest(signData: GetDigestData): Promise<GetDigestResponse>;
|
|
3
|
+
export function addSigner(signerData: SignerData): Promise<AddSignerResponse>;
|
|
4
|
+
export function getDocs(data: GetDocsParams): Promise<GetDocsResponse>;
|
|
5
|
+
/**
|
|
6
|
+
* Define la estructura de un objeto Firmante.
|
|
7
|
+
*/
|
|
8
|
+
export type Signer = {
|
|
9
|
+
/**
|
|
10
|
+
* - Nombre completo del firmante.
|
|
11
|
+
*/
|
|
12
|
+
name: string;
|
|
13
|
+
/**
|
|
14
|
+
* - Correo electrónico del firmante.
|
|
15
|
+
*/
|
|
16
|
+
email: string;
|
|
17
|
+
/**
|
|
18
|
+
* - Documento de identidad del firmante.
|
|
19
|
+
*/
|
|
20
|
+
document: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Define la estructura de datos para añadir un firmante.
|
|
24
|
+
*/
|
|
25
|
+
export type SignerData = {
|
|
26
|
+
/**
|
|
27
|
+
* - Identificador único del documento.
|
|
28
|
+
*/
|
|
29
|
+
docId: string;
|
|
30
|
+
/**
|
|
31
|
+
* - Objeto con la información del firmante.
|
|
32
|
+
*/
|
|
33
|
+
signer: Signer;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Define la estructura de la respuesta al añadir un firmante.
|
|
37
|
+
*/
|
|
38
|
+
export type AddSignerResponse = {
|
|
39
|
+
/**
|
|
40
|
+
* - Identificador de confirmación del firmante añadido.
|
|
41
|
+
*/
|
|
42
|
+
signer: string;
|
|
43
|
+
/**
|
|
44
|
+
* - Indica si la operación fue exitosa.
|
|
45
|
+
*/
|
|
46
|
+
success: boolean;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Define la estructura de datos para obtener el digest de un documento.
|
|
50
|
+
*/
|
|
51
|
+
export type GetDigestData = {
|
|
52
|
+
/**
|
|
53
|
+
* - Certificado del firmante en formato base64.
|
|
54
|
+
*/
|
|
55
|
+
cert: string;
|
|
56
|
+
/**
|
|
57
|
+
* - Identificador único del proceso de firma.
|
|
58
|
+
*/
|
|
59
|
+
signatureId: string;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Define la estructura de la respuesta al obtener el digest.
|
|
63
|
+
*/
|
|
64
|
+
export type GetDigestResponse = {
|
|
65
|
+
/**
|
|
66
|
+
* - El digest del documento que se va a firmar.
|
|
67
|
+
*/
|
|
68
|
+
digest: string;
|
|
69
|
+
/**
|
|
70
|
+
* - Indica si la operación fue exitosa.
|
|
71
|
+
*/
|
|
72
|
+
success: boolean;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Define la estructura de los parámetros para obtener documentos.
|
|
76
|
+
*/
|
|
77
|
+
export type GetDocsParams = {
|
|
78
|
+
/**
|
|
79
|
+
* - Número de página para la paginación.
|
|
80
|
+
*/
|
|
81
|
+
page: number;
|
|
82
|
+
/**
|
|
83
|
+
* - Cantidad de registros por página.
|
|
84
|
+
*/
|
|
85
|
+
size: number;
|
|
86
|
+
/**
|
|
87
|
+
* - (Opcional) Estado para filtrar los documentos.
|
|
88
|
+
*/
|
|
89
|
+
status?: string | undefined;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Define la estructura de la respuesta al obtener documentos.
|
|
93
|
+
*/
|
|
94
|
+
export type GetDocsResponse = {
|
|
95
|
+
/**
|
|
96
|
+
* - El número total de registros encontrados.
|
|
97
|
+
*/
|
|
98
|
+
totalRecords: number;
|
|
99
|
+
/**
|
|
100
|
+
* - Un arreglo con los registros de los documentos.
|
|
101
|
+
*/
|
|
102
|
+
records: Array<object>;
|
|
103
|
+
/**
|
|
104
|
+
* - Indica si la operación fue exitosa.
|
|
105
|
+
*/
|
|
106
|
+
success: boolean;
|
|
107
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default getCustomer;
|
|
2
|
+
/**
|
|
3
|
+
* Obtiene el token de un usuario a través de una petición POST.
|
|
4
|
+
* Este método es útil para endpoints que requieren datos en el cuerpo de la petición
|
|
5
|
+
* para buscar un usuario, como un ID de sesión o un token de acceso.
|
|
6
|
+
*
|
|
7
|
+
* @returns {Promise<{token: string, userData: object, success: boolean}>} Objeto con el token de sesión, los datos del usuario y un indicador de éxito.
|
|
8
|
+
* @throws {Error} Si los parámetros de entrada son inválidos.
|
|
9
|
+
* @throws {ApacuanaAPIError} Si ocurre un error en la API de Apacuana.
|
|
10
|
+
*/
|
|
11
|
+
declare function getCustomer(): Promise<{
|
|
12
|
+
token: string;
|
|
13
|
+
userData: object;
|
|
14
|
+
success: boolean;
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function setConfig(newConfig: any): void;
|
|
2
|
+
export function getConfig(): {
|
|
3
|
+
apiUrl: string;
|
|
4
|
+
secretKey: string;
|
|
5
|
+
apiKey: string;
|
|
6
|
+
verificationId: string;
|
|
7
|
+
customerId: string;
|
|
8
|
+
integrationType: string;
|
|
9
|
+
userData: undefined;
|
|
10
|
+
token: undefined;
|
|
11
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clase de error personalizada para errores de la API de Apacuana.
|
|
3
|
+
*/
|
|
4
|
+
export class ApacuanaAPIError extends Error {
|
|
5
|
+
constructor(message: any, statusCode?: number, errorCode?: null);
|
|
6
|
+
statusCode: number;
|
|
7
|
+
errorCode: any;
|
|
8
|
+
success: boolean;
|
|
9
|
+
}
|
|
10
|
+
export default ApacuanaAPIError;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export default apacuana;
|
|
2
|
+
declare namespace apacuana {
|
|
3
|
+
export function init(config: {
|
|
4
|
+
apiUrl: string;
|
|
5
|
+
secretKey: string;
|
|
6
|
+
apiKey: string;
|
|
7
|
+
verificationId: string;
|
|
8
|
+
customerId: string;
|
|
9
|
+
integrationType: string;
|
|
10
|
+
}): Promise<object>;
|
|
11
|
+
export { getConfig };
|
|
12
|
+
export { requestRevocation };
|
|
13
|
+
export { getCertStatus };
|
|
14
|
+
export { getCustomer };
|
|
15
|
+
export { addSigner };
|
|
16
|
+
export { getDocs };
|
|
17
|
+
export { generateCert };
|
|
18
|
+
}
|
|
19
|
+
import { getConfig } from "./config/index";
|
|
20
|
+
import requestRevocation from "./api/revocations";
|
|
21
|
+
import { getCertStatus } from "./api/certs";
|
|
22
|
+
import getCustomer from "./api/users";
|
|
23
|
+
import { addSigner } from "./api/signatures";
|
|
24
|
+
import { getDocs } from "./api/signatures";
|
|
25
|
+
import { generateCert } from "./api/certs";
|