@assinafy/cli 2.6.0 → 2.6.1

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/cli.cjs CHANGED
@@ -21300,6 +21300,13 @@ function validateSignerOptions(input) {
21300
21300
  throw new ValidationError("step must be an integer");
21301
21301
  }
21302
21302
  }
21303
+ function validateDigitalCertificateMethod(method, signers) {
21304
+ if (method !== "virtual" && signers.some((signer) => signer.verification_method === "DigitalCertificate")) {
21305
+ throw new ValidationError("DigitalCertificate signers require method: virtual", {
21306
+ code: "digital_certificate_requires_virtual"
21307
+ });
21308
+ }
21309
+ }
21303
21310
  function validateSigningSteps(signers) {
21304
21311
  const withSteps = signers.filter((signer) => signer.step !== void 0);
21305
21312
  if (withSteps.length > 0) {
@@ -21476,15 +21483,17 @@ function buildAssignmentPayload(payload, options = {}) {
21476
21483
  signers: payload.signers ?? payload.signer_ids ?? payload.signerIds
21477
21484
  });
21478
21485
  }
21479
- if (payload.method === "collect" && !Array.isArray(payload.entries)) {
21486
+ const method = payload.method ?? "virtual";
21487
+ const normalisedSigners = signers.map((ref) => normaliseSignerRef(ref, options));
21488
+ validateDigitalCertificateMethod(method, normalisedSigners);
21489
+ if (method === "collect" && !Array.isArray(payload.entries)) {
21480
21490
  throw new ValidationError("entries are required for collect assignments");
21481
21491
  }
21482
- const normalisedSigners = signers.map((ref) => normaliseSignerRef(ref, options));
21483
21492
  if (!options.skipDigitalCertificateStepValidation) {
21484
21493
  validateSigningSteps(normalisedSigners);
21485
21494
  }
21486
21495
  return stripEmpty({
21487
- method: payload.method ?? "virtual",
21496
+ method,
21488
21497
  signers: normalisedSigners,
21489
21498
  message: payload.message,
21490
21499
  expires_at: payload.expires_at === void 0 ? void 0 : requireIso8601(payload.expires_at, "expires_at"),
@@ -22088,6 +22097,7 @@ var DocumentResource = class extends BaseResource {
22088
22097
  if (options.tags !== void 0 && (!Array.isArray(options.tags) || options.tags.some((tag) => typeof tag !== "string" || !tag))) {
22089
22098
  throw new ValidationError("tags must contain non-empty tag names");
22090
22099
  }
22100
+ await this.validateCertificateTemplateMethod(tmplId, accId, signers);
22091
22101
  const body = { ...options, signers };
22092
22102
  this.logger.info("Creating document from template", { templateId: tmplId, accountId: accId });
22093
22103
  return this.call(
@@ -22100,6 +22110,7 @@ var DocumentResource = class extends BaseResource {
22100
22110
  const tmplId = this.requireId(templateId, "Template ID");
22101
22111
  const accId = this.accountId(accountId);
22102
22112
  validateTemplateSigners(signers, { requireId: false });
22113
+ await this.validateCertificateTemplateMethod(tmplId, accId, signers);
22103
22114
  return this.call(
22104
22115
  "Failed to estimate cost from template",
22105
22116
  () => this.http.post(`/accounts/${accId}/templates/${tmplId}/documents/estimate-cost`, { signers })
@@ -22178,6 +22189,15 @@ var DocumentResource = class extends BaseResource {
22178
22189
  const percentage = total > 0 ? Math.round(signed / total * 1e4) / 100 : 0;
22179
22190
  return { signed, total, pending, percentage };
22180
22191
  }
22192
+ async validateCertificateTemplateMethod(templateId, accountId, signers) {
22193
+ if (!signers.some((signer) => signer.verification_method === "DigitalCertificate")) return;
22194
+ const template = await this.call(
22195
+ "Failed to fetch template",
22196
+ () => this.http.get(`/accounts/${accountId}/templates/${templateId}`)
22197
+ );
22198
+ const method = template.pages?.some((page) => page.fields.length > 0) ? "collect" : "virtual";
22199
+ validateDigitalCertificateMethod(method, signers);
22200
+ }
22181
22201
  };
22182
22202
  function validateTemplateSigners(signers, options) {
22183
22203
  if (!Array.isArray(signers)) throw new ValidationError("signers must be an array");
@@ -27998,7 +28018,7 @@ function handleStreamError(err, fallback, exit = process.exit) {
27998
28018
  // package.json
27999
28019
  var package_default = {
28000
28020
  name: "@assinafy/cli",
28001
- version: "2.6.0",
28021
+ version: "2.6.1",
28002
28022
  description: "The official command-line interface for the Assinafy digital-signature API",
28003
28023
  license: "MIT",
28004
28024
  type: "module",
@@ -1 +1 @@
1
- {"version":3,"file":"assignments.d.ts","sourceRoot":"","sources":["../../../../src/api/resources/assignments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AC,yBAAyB,CAAC,CAYpC;IAED,iEAAiE;IAC3D,YAAY,CACjB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,wBAAwB,GAC/B,OAAO,CAAC,qBAAqB,CAAC,CAWhC;IAED;;;;OAIG;IACG,eAAe,CACpB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,GAAG,IAAI,GACtB,OAAO,CAAC,WAAW,CAAC,CAUtB;IAED,0DAA0D;IACpD,kBAAkB,CACvB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,GACd,OAAO,CAAC,oBAAoB,CAAC,CAO/B;IAED,4DAA4D;IACtD,kBAAkB,CACvB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,GACd,OAAO,CAAC,mBAAmB,CAAC,CAS9B;IAED;;;OAGG;IACG,yBAAyB,CAC9B,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,GAClB,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAMlC;CACD"}
1
+ {"version":3,"file":"assignments.d.ts","sourceRoot":"","sources":["../../../../src/api/resources/assignments.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,WAAW,EACX,qBAAqB,EACrB,wBAAwB,EACxB,yBAAyB,EACzB,6BAA6B,EAC7B,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EAEf,MAAM,aAAa,CAAC;AAUrB,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC;;;GAGG;AACH,wBAAgB,sBAAsB,CACrC,OAAO,EAAE,wBAAwB,EACjC,OAAO,GAAE;IACR,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,oCAAoC,CAAC,EAAE,OAAO,CAAC;CAC1C,GACJ,MAAM,CAAC,MAAM,EAAE,OA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E,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,GACd,OAAO,CAAC,mBAAmB,CAAC,CAS9B;IAED;;;OAGG;IACG,yBAAyB,CAC9B,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,GAClB,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAMlC;CACD"}
@@ -121,5 +121,6 @@ export declare class DocumentResource extends BaseResource {
121
121
  isFullySigned(documentId: string): Promise<boolean>;
122
122
  /** Summarise signing progress for UI display. */
123
123
  getSigningProgress(documentId: string): Promise<ISigningProgress>;
124
+ private validateCertificateTemplateMethod;
124
125
  }
125
126
  //# sourceMappingURL=documents.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../../../src/api/resources/documents.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACX,oBAAoB,EAEpB,kCAAkC,EAClC,kBAAkB,EAClB,iBAAiB,EACjB,wBAAwB,EAExB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,YAAY,EACZ,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,IAAI,EACJ,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,MAAM,aAAa,CAAC;AAYrB,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAoBzC,qFAAqF;AACrF,MAAM,MAAM,oBAAoB,GAC7B;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GACvC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAExC,MAAM,WAAW,sBAAsB;IACtC,mEAAmE;IACnE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,E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uB,CAAC,CAK3D;IAED;;;OAGG;IACG,QAAQ,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAI/C;IAED;;;;OAIG;IACG,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAKhE;IAED;;;;;OAKG;IACG,SAAS,CACd,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,EACrC,OAAO,GAAE,gBAA0B,GACjC,OAAO,CAAC,kBAAkB,CAAC,CAY7B;IAED,gEAAgE;IAC1D,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQxD;IAED,iDAAiD;IAC3C,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAQtE;CACD"}
1
+ {"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../../../src/api/resources/documents.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACX,oBAAoB,EAEpB,kCAAkC,EAClC,kBAAkB,EAClB,iBAAiB,EACjB,wBAAwB,EAExB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,YAAY,EACZ,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,IAAI,EACJ,mBAAmB,EAEnB,eAAe,EACf,gBAAgB,EAChB,MAAM,aAAa,CAAC;AAarB,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAoBzC,qFAAqF;AACrF,MAAM,MAAM,oBAAoB,GAC7B;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GACvC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAExC,MAAM,WAAW,sBAAsB;IACtC,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AO,CAAC,qBAAqB,CAAC,CAQhC;IAED;;;OAGG;IACG,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAK3D;IAED;;;OAGG;IACG,QAAQ,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAI/C;IAED;;;;OAIG;IACG,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAKhE;IAED;;;;;OAKG;IACG,SAAS,CACd,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,EACrC,OAAO,GAAE,gBAA0B,GACjC,OAAO,CAAC,kBAAkB,CAAC,CAY7B;IAED,gEAAgE;IAC1D,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQxD;IAED,iDAAiD;IAC3C,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAQtE;YAEa,iCAAiC;CAY/C"}
@@ -1,6 +1,6 @@
1
1
  import { type AxiosRequestConfig } from 'axios';
2
2
  import { AssinafyError } from './errors.js';
3
- import type { DocumentArtifactName, IDocumentStatsParams, Logger } from './types.js';
3
+ import type { AssignmentMethod, DocumentArtifactName, IDocumentStatsParams, Logger } from './types.js';
4
4
  /**
5
5
  * Unwrap the Assinafy API envelope `{ status, message, data }`.
6
6
  * Throws {@link ApiError} when the envelope reports a non-success status.
@@ -33,6 +33,10 @@ export declare function validateSignerOptions(input: {
33
33
  notification_methods?: unknown;
34
34
  step?: unknown;
35
35
  }): void;
36
+ /** Certificate signing completes a virtual item and cannot complete placed fields. */
37
+ export declare function validateDigitalCertificateMethod(method: AssignmentMethod, signers: readonly {
38
+ verification_method?: unknown;
39
+ }[]): void;
36
40
  /** Validate the sequencing rules for assignments and template-document signers. */
37
41
  export declare function validateSigningSteps(signers: readonly {
38
42
  verification_method?: unknown;
@@ -1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,MAAM,EAC3C,KAAK,EAAE,CAAC,GAAG,SAAS,EACpB,OAAO,EAAE,SAAS,CAAC,EAAE,GACnB,CAAC,GAAG,SAAS,CAGf;AAMD,kGAAkG;AAClG,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEpD"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "specUrl": "https://api.assinafy.com.br/v1/docs/openapi.json",
3
- "hash": "da98836f863bccd621c104499c96621e67f12016538398c3496859db5f049b75",
3
+ "hash": "9bab4f24766a343c80c7176478c7b573ad1f1bf9ff83e82e105bf38b3d166df9",
4
4
  "operations": [
5
5
  {
6
6
  "method": "GET",
@@ -7,7 +7,7 @@ The renderer reuses a generic 400 envelope for several non-400 errors; top-level
7
7
  - OpenAPI: 3.1.0
8
8
  - API document version: 1.0.0
9
9
  - Operations: 112
10
- - Contract SHA-256: `da98836f863bccd621c104499c96621e67f12016538398c3496859db5f049b75`
10
+ - Contract SHA-256: `9bab4f24766a343c80c7176478c7b573ad1f1bf9ff83e82e105bf38b3d166df9`
11
11
 
12
12
  ## Accounts
13
13
 
@@ -2554,8 +2554,16 @@ Per-unit costs (in credits) used to build the estimate:
2554
2554
  | Email notification | 0 credits |
2555
2555
  | WhatsApp notification | 0.45 credits |
2556
2556
  | Digital certificate signature (per signer) | 0.5 credits |
2557
+ | Identity document verification (per signer) | depends on the plan, see the table below |
2557
2558
 
2558
- Verification methods are not priced separately — every line in the `breakdown` is a notification or a signature. A `Whatsapp`-verified signer therefore shows up as a WhatsApp notification, because that channel is mandatory for that verification method. A `DigitalCertificate` signer adds the digital-certificate signature cost **on top of** its notification cost; it appears in the `breakdown` under the `SignatureDigitalCertificate` code.
2559
+ | Plan | Price per signer |
2560
+ |------|------------------|
2561
+ | Free | 1.5 credits |
2562
+ | Standard | 1 credit |
2563
+ | Pro | 0.5 credits |
2564
+ | Other plans and enterprise contracts | 0.25 credits |
2565
+
2566
+ `Email` and `Whatsapp` verification are not priced separately — their only line in the `breakdown` is their notification. A `Whatsapp`-verified signer therefore shows up as a WhatsApp notification, because that channel is mandatory for that verification method. A `DigitalCertificate` signer adds the digital-certificate signature cost **on top of** its notification cost; it appears in the `breakdown` under the `SignatureDigitalCertificate` code. An `IdDocumentFaceMatchBasic` signer likewise adds your plan's verification price on top of its notification, under the `VerificationIdDocumentFaceMatchBasic` code.
2559
2567
 
2560
2568
  **Authentication:** Bearer access token (`Authorization: Bearer ...`) or API key (`X-Api-Key` header).
2561
2569
 
@@ -152,7 +152,7 @@ interface IDocumentUploadOptions {
152
152
 
153
153
  Uploads must be non-empty PDFs up to 25 MiB. `DocumentArtifactName` is `original | certificated | certificate-page | pades | bundle`; `bundle` is ZIP and the other document artifacts are PDF. `sendToken(documentId, 'signer@example.com')` emails a one-time access token to a signer who has not signed a pending document yet and sends `{ "channel": "email", "recipient": "signer@example.com" }`. Only the `email` channel is accepted; any other channel is rejected locally. The `{ email }` overload sends the same body.
154
154
 
155
- Template document creation sends `{ signers, name?, message?, expires_at?, editor_fields?, tags? }`. Each signer is `{ role_id, id, verification_method?, notification_methods?, step? }`; each editor field is `{ field_id, value: string }`. Template cost estimation publishes `{ signers: Array<{ role_id, verification_method?, notification_methods? }> }`. The optional cost-signer `id` and `step` properties remain compatibility extensions for existing integrations.
155
+ Template document creation sends `{ signers, name?, message?, expires_at?, editor_fields?, tags? }`. Each signer is `{ role_id, id, verification_method?, notification_methods?, step? }`; each editor field is `{ field_id, value: string }`. Template cost estimation publishes `{ signers: Array<{ role_id, verification_method?, notification_methods? }> }`. The optional cost-signer `id` and `step` properties remain compatibility extensions for existing integrations. A template with placed signer fields creates a `collect` assignment, so it cannot use a `DigitalCertificate` signer. For certificate-bearing template create and estimate calls, the SDK reads the template details first and rejects placed fields with `ValidationError.errors.code` set to `digital_certificate_requires_virtual`.
156
156
 
157
157
  Document list params are `{ page?, per_page?, status?, method?, tags?, search?, sort? }`; search params omit `method`/`tags`. Supported sort values are `name`, `-name`, `updated_at`, and `-updated_at`.
158
158
 
@@ -198,7 +198,7 @@ Assignment payload:
198
198
 
199
199
  Production defaults `notification_methods: []` to `['Email']` and sends an invitation. An empty array is not a way to disable delivery. Choose the intended supported channel explicitly before creating an assignment.
200
200
 
201
- `buildAssignmentPayload(payload, options?)` is exported for callers that need the same normalization. It resolves synchronously to the JSON assignment body above; no HTTP call occurs. Options are `{ allowSignersWithoutId?: boolean; skipDigitalCertificateStepValidation?: boolean }`, both false by default. Both support cost estimation: the first accepts signer descriptors without an `id`, and the second bypasses signing-order and certificate-step checks for estimates. An empty signer list always throws `ValidationError('At least one signer is required')`, in `virtual` and `collect` modes and in cost estimates alike. `create` enforces complete contiguous signing steps from 1 when supplied and requires each digital-certificate signer to be alone in its step. The estimate schema has no `step`, so `estimateCost` passes `skipDigitalCertificateStepValidation` to skip that create-only rule. Assignment list params are pagination plus the compatible `sort?: 'created_at' | '-created_at'`; the runtime endpoint requires the SDK's `accountId` query even though the published parameter table omits it. Assignment `search` is unsupported and rejected locally.
201
+ `buildAssignmentPayload(payload, options?)` is exported for callers that need the same normalization. It resolves synchronously to the JSON assignment body above; no HTTP call occurs. Options are `{ allowSignersWithoutId?: boolean; skipDigitalCertificateStepValidation?: boolean }`, both false by default. Both support cost estimation: the first accepts signer descriptors without an `id`, and the second bypasses signing-order and certificate-step checks for estimates. An empty signer list always throws `ValidationError('At least one signer is required')`, in `virtual` and `collect` modes and in cost estimates alike. `DigitalCertificate` signers require `method: 'virtual'`: `create` and `estimateCost` reject `collect` before sending a request with `ValidationError.errors.code` set to `digital_certificate_requires_virtual`. `create` also enforces complete contiguous signing steps from 1 when supplied and requires each digital-certificate signer to be alone in its step. The estimate schema has no `step`, so `estimateCost` passes `skipDigitalCertificateStepValidation` to skip that create-only rule. Assignment list params are pagination plus the compatible `sort?: 'created_at' | '-created_at'`; the runtime endpoint requires the SDK's `accountId` query even though the published parameter table omits it. Assignment `search` is unsupported and rejected locally.
202
202
 
203
203
  `estimateResendCost(documentId, assignmentId, signerId)` sends a POST without a body. Its production result is:
204
204
 
@@ -367,7 +367,7 @@ CLI: `signer identity-status`, `signer identity-start --consent`, `assignments i
367
367
 
368
368
  Both A1 and A3 use `verification_method: "DigitalCertificate"`; they are not separate API method names. Assinafy's [signing documentation](https://api.assinafy.com.br/v1/docs) directs these signers to the certificate handshake. The two routes below follow the deployed [Assinafy signing application](https://app.assinafy.com.br), which supplies their request and response shapes; they are not yet OpenAPI paths and availability on other deployments may differ.
369
369
 
370
- 1. Create or select the signer and set their CPF/CNPJ with `signers.update(signerId, { government_id })`. An existing signer returned by `create` is reused without updating their data. Configure an eligible workspace, estimate cost, then create the assignment with `DigitalCertificate` and one delivery channel. Use contiguous steps beginning at `1`, with each certificate signer alone in their step. The same descriptor works for template roles.
370
+ 1. Create or select the signer and set their CPF/CNPJ with `signers.update(signerId, { government_id })`. An existing signer returned by `create` is reused without updating their data. Configure an eligible workspace, estimate cost, then create a `virtual` assignment with `DigitalCertificate` and one delivery channel. Use contiguous steps beginning at `1`, with each certificate signer alone in their step. The same descriptor works for template roles only when the template has no placed signer fields.
371
371
  2. Obtain the private signer access code through the delivered link. Load `self` and `getAssignment` to confirm the identity and document. Present the document and terms; call `acceptTerms` only after the signer agrees.
372
372
  3. Call `startCertificate(accessCode)` and retain its operation token with that signer session.
373
373
  4. On the signer's device, use an initialized Web PKI browser client to select their A1 certificate or A3 device and execute `pki.signWithRestPki({ thumbprint, token })`. Wait for its success callback. The private key, PFX password, and device PIN stay with the local certificate provider.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@assinafy/cli",
3
- "version": "2.6.0",
3
+ "version": "2.6.1",
4
4
  "description": "The official command-line interface for the Assinafy digital-signature API",
5
5
  "license": "MIT",
6
6
  "type": "module",