@assinafy/cli 2.1.3 → 2.3.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/.env.example +1 -0
- package/README.en.md +8 -3
- package/README.md +6 -2
- package/dist/api.cjs +44 -5
- package/dist/api.cjs.map +1 -1
- package/dist/api.js +44 -5
- package/dist/api.js.map +1 -1
- package/dist/cli.cjs +72 -10
- package/dist/types/api/resources/assignments.d.ts +0 -1
- package/dist/types/api/resources/assignments.d.ts.map +1 -1
- package/dist/types/api/resources/signer-documents.d.ts +18 -6
- package/dist/types/api/resources/signer-documents.d.ts.map +1 -1
- package/dist/types/api/types.d.ts +13 -0
- package/dist/types/api/types.d.ts.map +1 -1
- package/docs/sdk-reference.md +89 -2
- package/docs/signer.md +33 -4
- package/package.json +1 -1
package/dist/api.js
CHANGED
|
@@ -359,7 +359,7 @@ function buildAssignmentPayload(payload, options = {}) {
|
|
|
359
359
|
throw new ValidationError("method must be virtual or collect");
|
|
360
360
|
}
|
|
361
361
|
const signers = extractSignerRefs(payload);
|
|
362
|
-
if (signers.length === 0
|
|
362
|
+
if (signers.length === 0) {
|
|
363
363
|
throw new ValidationError("At least one signer is required", {
|
|
364
364
|
signers: payload.signers ?? payload.signer_ids ?? payload.signerIds
|
|
365
365
|
});
|
|
@@ -459,7 +459,6 @@ var AssignmentResource = class extends BaseResource {
|
|
|
459
459
|
`/documents/${docId}/assignments/estimate-cost`,
|
|
460
460
|
buildAssignmentPayload(payload, {
|
|
461
461
|
allowSignersWithoutId: true,
|
|
462
|
-
allowEmptySigners: true,
|
|
463
462
|
skipDigitalCertificateStepValidation: true
|
|
464
463
|
})
|
|
465
464
|
)
|
|
@@ -1420,15 +1419,55 @@ var SignerDocumentsResource = class extends BaseResource {
|
|
|
1420
1419
|
() => this.http.put("/signers/accept-terms", void 0, signerAccessConfig(code))
|
|
1421
1420
|
);
|
|
1422
1421
|
}
|
|
1423
|
-
/** `POST /verify` — verify
|
|
1424
|
-
async
|
|
1422
|
+
/** `POST /verify` — verify an email or WhatsApp OTP for a signer. */
|
|
1423
|
+
async verifyCode(payload) {
|
|
1425
1424
|
const code = this.requireId(payload.signerAccessCode, "signer-access-code");
|
|
1426
1425
|
const otp = this.requireId(payload.verificationCode, "verification-code");
|
|
1427
1426
|
return this.call(
|
|
1428
|
-
"Failed to verify signer
|
|
1427
|
+
"Failed to verify signer code",
|
|
1429
1428
|
() => this.http.post("/verify", { "verification-code": otp }, signerAccessConfig(code))
|
|
1430
1429
|
);
|
|
1431
1430
|
}
|
|
1431
|
+
/** Compatibility alias for {@link verifyCode}; accepts email and WhatsApp OTPs. */
|
|
1432
|
+
async verifyEmail(payload) {
|
|
1433
|
+
return this.verifyCode(payload);
|
|
1434
|
+
}
|
|
1435
|
+
/**
|
|
1436
|
+
* `POST /signers/certificate/start` — start an ICP-Brasil A1/A3 signature.
|
|
1437
|
+
* Returns `{ token }` for the signer's Web PKI client. This production route
|
|
1438
|
+
* is used by Assinafy's signing frontend but is absent from OpenAPI paths.
|
|
1439
|
+
*/
|
|
1440
|
+
async startCertificate(signerAccessCode) {
|
|
1441
|
+
const code = this.requireId(signerAccessCode, "signer-access-code");
|
|
1442
|
+
return this.call(
|
|
1443
|
+
"Failed to start certificate signature",
|
|
1444
|
+
() => this.http.post(
|
|
1445
|
+
"/signers/certificate/start",
|
|
1446
|
+
{ "signer-access-code": code },
|
|
1447
|
+
signerAccessConfig(code)
|
|
1448
|
+
)
|
|
1449
|
+
);
|
|
1450
|
+
}
|
|
1451
|
+
/**
|
|
1452
|
+
* `POST /signers/certificate/complete` — finish an ICP-Brasil A1/A3 signature.
|
|
1453
|
+
* Pass the same token returned by {@link startCertificate}, after Web PKI
|
|
1454
|
+
* successfully signs it. Returns `{ signerName }`; private keys stay local.
|
|
1455
|
+
* This production route is absent from OpenAPI paths.
|
|
1456
|
+
*/
|
|
1457
|
+
async completeCertificate(signerAccessCode, token) {
|
|
1458
|
+
const code = this.requireId(signerAccessCode, "signer-access-code");
|
|
1459
|
+
if (typeof token !== "string" || !token.trim()) {
|
|
1460
|
+
throw new ValidationError("Certificate token is required");
|
|
1461
|
+
}
|
|
1462
|
+
return this.call(
|
|
1463
|
+
"Failed to complete certificate signature",
|
|
1464
|
+
() => this.http.post(
|
|
1465
|
+
"/signers/certificate/complete",
|
|
1466
|
+
{ "signer-access-code": code, token },
|
|
1467
|
+
signerAccessConfig(code)
|
|
1468
|
+
)
|
|
1469
|
+
);
|
|
1470
|
+
}
|
|
1432
1471
|
/**
|
|
1433
1472
|
* `PUT /documents/{documentId}/signers/confirm-data?signer-access-code=…`
|
|
1434
1473
|
*
|