@assinafy/cli 2.1.3 → 2.2.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/dist/api.js CHANGED
@@ -1420,15 +1420,55 @@ var SignerDocumentsResource = class extends BaseResource {
1420
1420
  () => this.http.put("/signers/accept-terms", void 0, signerAccessConfig(code))
1421
1421
  );
1422
1422
  }
1423
- /** `POST /verify` — verify the email OTP for a signer. */
1424
- async verifyEmail(payload) {
1423
+ /** `POST /verify` — verify an email or WhatsApp OTP for a signer. */
1424
+ async verifyCode(payload) {
1425
1425
  const code = this.requireId(payload.signerAccessCode, "signer-access-code");
1426
1426
  const otp = this.requireId(payload.verificationCode, "verification-code");
1427
1427
  return this.call(
1428
- "Failed to verify signer email",
1428
+ "Failed to verify signer code",
1429
1429
  () => this.http.post("/verify", { "verification-code": otp }, signerAccessConfig(code))
1430
1430
  );
1431
1431
  }
1432
+ /** Compatibility alias for {@link verifyCode}; accepts email and WhatsApp OTPs. */
1433
+ async verifyEmail(payload) {
1434
+ return this.verifyCode(payload);
1435
+ }
1436
+ /**
1437
+ * `POST /signers/certificate/start` — start an ICP-Brasil A1/A3 signature.
1438
+ * Returns `{ token }` for the signer's Web PKI client. This production route
1439
+ * is used by Assinafy's signing frontend but is absent from OpenAPI paths.
1440
+ */
1441
+ async startCertificate(signerAccessCode) {
1442
+ const code = this.requireId(signerAccessCode, "signer-access-code");
1443
+ return this.call(
1444
+ "Failed to start certificate signature",
1445
+ () => this.http.post(
1446
+ "/signers/certificate/start",
1447
+ { "signer-access-code": code },
1448
+ signerAccessConfig(code)
1449
+ )
1450
+ );
1451
+ }
1452
+ /**
1453
+ * `POST /signers/certificate/complete` — finish an ICP-Brasil A1/A3 signature.
1454
+ * Pass the same token returned by {@link startCertificate}, after Web PKI
1455
+ * successfully signs it. Returns `{ signerName }`; private keys stay local.
1456
+ * This production route is absent from OpenAPI paths.
1457
+ */
1458
+ async completeCertificate(signerAccessCode, token) {
1459
+ const code = this.requireId(signerAccessCode, "signer-access-code");
1460
+ if (typeof token !== "string" || !token.trim()) {
1461
+ throw new ValidationError("Certificate token is required");
1462
+ }
1463
+ return this.call(
1464
+ "Failed to complete certificate signature",
1465
+ () => this.http.post(
1466
+ "/signers/certificate/complete",
1467
+ { "signer-access-code": code, token },
1468
+ signerAccessConfig(code)
1469
+ )
1470
+ );
1471
+ }
1432
1472
  /**
1433
1473
  * `PUT /documents/{documentId}/signers/confirm-data?signer-access-code=…`
1434
1474
  *