apacuana-sdk-core 1.11.0 → 1.13.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 +72 -66
- package/coverage/coverage-final.json +1 -1
- package/coverage/lcov-report/index.html +14 -14
- package/coverage/lcov-report/src/api/certs.js.html +1 -1
- package/coverage/lcov-report/src/api/faceLiveness.js.html +1 -1
- package/coverage/lcov-report/src/api/index.html +1 -1
- package/coverage/lcov-report/src/api/revocations.js.html +1 -1
- package/coverage/lcov-report/src/api/signatures.js.html +2 -2
- 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 +1 -1
- 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 +1 -1
- package/coverage/lcov-report/src/utils/helpers.js.html +61 -16
- package/coverage/lcov-report/src/utils/httpClient.js.html +1 -1
- package/coverage/lcov-report/src/utils/index.html +13 -13
- package/coverage/lcov.info +196 -171
- package/dist/index.js +10 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/signatures.js +1 -1
- package/src/utils/helpers.js +23 -8
package/package.json
CHANGED
package/src/api/signatures.js
CHANGED
|
@@ -96,7 +96,7 @@ const addSignerOnBoarding = async (signerData) => {
|
|
|
96
96
|
);
|
|
97
97
|
return new ApacuanaSuccess({
|
|
98
98
|
signer: signerData.typedoc + signerData.doc,
|
|
99
|
-
docId: response.
|
|
99
|
+
docId: response.id,
|
|
100
100
|
});
|
|
101
101
|
} catch (error) {
|
|
102
102
|
if (error instanceof ApacuanaAPIError) {
|
package/src/utils/helpers.js
CHANGED
|
@@ -100,11 +100,16 @@ const encryptedCsr = (csr, encryptKey = KEY_HEX) => {
|
|
|
100
100
|
const createPayloadGetDigest = (signData) => {
|
|
101
101
|
const formData = new FormData();
|
|
102
102
|
|
|
103
|
-
// Iterate over the object's own properties
|
|
104
103
|
Object.keys(signData).forEach((key) => {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
const value = signData[key];
|
|
105
|
+
const isRNFile =
|
|
106
|
+
value &&
|
|
107
|
+
typeof value === "object" &&
|
|
108
|
+
value.uri &&
|
|
109
|
+
value.name &&
|
|
110
|
+
value.type;
|
|
111
|
+
|
|
112
|
+
if (key === "document" && (signData[key] instanceof File || isRNFile)) {
|
|
108
113
|
// Append the file directly
|
|
109
114
|
formData.append(key, signData[key]);
|
|
110
115
|
} else if (key === "cert") {
|
|
@@ -129,7 +134,6 @@ const validateOnBoardingSignerData = (signerData) => {
|
|
|
129
134
|
);
|
|
130
135
|
}
|
|
131
136
|
|
|
132
|
-
// Limpia 'reference' si es inválido o está vacío.
|
|
133
137
|
if (
|
|
134
138
|
!validatedSignerData.reference ||
|
|
135
139
|
typeof validatedSignerData.reference !== "string" ||
|
|
@@ -138,7 +142,6 @@ const validateOnBoardingSignerData = (signerData) => {
|
|
|
138
142
|
delete validatedSignerData.reference;
|
|
139
143
|
}
|
|
140
144
|
|
|
141
|
-
// Limpia 'file' si no es una instancia de File.
|
|
142
145
|
if (
|
|
143
146
|
typeof File === "undefined" ||
|
|
144
147
|
!validatedSignerData.file ||
|
|
@@ -229,9 +232,17 @@ const validateOnBoardingSignerData = (signerData) => {
|
|
|
229
232
|
|
|
230
233
|
const formData = new FormData();
|
|
231
234
|
Object.keys(validatedSignerData).forEach((key) => {
|
|
235
|
+
const value = validatedSignerData[key];
|
|
236
|
+
const isRNFile =
|
|
237
|
+
value &&
|
|
238
|
+
typeof value === "object" &&
|
|
239
|
+
value.uri &&
|
|
240
|
+
value.name &&
|
|
241
|
+
value.type;
|
|
242
|
+
|
|
232
243
|
if (key === "signature") {
|
|
233
244
|
formData.append(key, JSON.stringify(validatedSignerData[key]));
|
|
234
|
-
} else if (key === "file") {
|
|
245
|
+
} else if (key === "file" || isRNFile) {
|
|
235
246
|
formData.append("document", validatedSignerData[key]);
|
|
236
247
|
} else if (validatedSignerData[key] !== undefined) {
|
|
237
248
|
formData.append(key, validatedSignerData[key]);
|
|
@@ -356,7 +367,11 @@ const validateOnBoardingSignDocumentData = (signData) => {
|
|
|
356
367
|
);
|
|
357
368
|
formData.append("publickey", cert);
|
|
358
369
|
formData.append("signeddigest", signedDigest);
|
|
359
|
-
|
|
370
|
+
const value = signData.document;
|
|
371
|
+
const isRNFile =
|
|
372
|
+
value && typeof value === "object" && value.uri && value.name && value.type;
|
|
373
|
+
|
|
374
|
+
if (signData.document && (signData.document instanceof File || isRNFile)) {
|
|
360
375
|
formData.append("document", signData.document);
|
|
361
376
|
}
|
|
362
377
|
|