@assinafy/sdk 2.7.1 → 2.8.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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  This ledger maps the official
4
4
  [`GET /v1/docs/openapi.json`](https://api.assinafy.com.br/v1/docs/openapi.json)
5
- contract to the public SDK API: 81 paths, 106 HTTP operations, and 44 component
5
+ contract to the public SDK API: 85 paths, 112 HTTP operations, and 45 component
6
6
  schemas.
7
7
 
8
8
  All paths below include the `/v1` prefix shown by the OpenAPI document, except
@@ -14,7 +14,7 @@ Status meanings:
14
14
 
15
15
  - **Covered** — a public, typed SDK method sends the operation.
16
16
  - **Compatibility extension** — route retained for existing integrations but
17
- absent from the current OpenAPI path set and excluded from the 106-operation
17
+ absent from the current OpenAPI path set and excluded from the 112-operation
18
18
  total.
19
19
 
20
20
  ## Accounts — 10/10
@@ -32,7 +32,7 @@ Status meanings:
32
32
  | `DELETE` | `/v1/accounts/{accountId}/logo` | `client.workspaces.deleteLogo(accountId)` | Covered |
33
33
  | `GET` | `/v1/accounts/{accountId}/stats` | `client.workspaces.getStats(accountId, params?)` | Covered |
34
34
 
35
- ## Assignments — 7/7
35
+ ## Assignments — 10/10
36
36
 
37
37
  | Method | Path | SDK method | Status |
38
38
  | --- | --- | --- | --- |
@@ -43,6 +43,9 @@ Status meanings:
43
43
  | `POST` | `/v1/documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/estimate-resend-cost` | `client.assignments.estimateResendCost(documentId, assignmentId, signerId)` | Covered |
44
44
  | `PUT` | `/v1/documents/{documentId}/assignments/{assignmentId}/reset-expiration` | `client.assignments.resetExpiration(documentId, assignmentId, expiresAt)` | Covered |
45
45
  | `GET` | `/v1/documents/{documentId}/assignments/{assignmentId}/whatsapp-notifications` | `client.assignments.listWhatsAppNotifications(documentId, assignmentId)` | Covered |
46
+ | `GET` | `/v1/documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/identity-verification` | `client.assignments.getIdentityVerification(documentId, assignmentId, signerId)` | Covered |
47
+ | `GET` | `/v1/documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/identity-verification/images/{name}` | `client.assignments.downloadIdentityVerificationImage(documentId, assignmentId, signerId, name)` | Covered |
48
+ | `POST` | `/v1/documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/identity-verification/review` | `client.assignments.reviewIdentityVerification(documentId, assignmentId, signerId, payload)` | Covered |
46
49
 
47
50
  ## Authentication — 10/10
48
51
 
@@ -122,7 +125,7 @@ ordinary OAuth applications use the two SDK methods listed below.
122
125
  | `PUT` | `/v1/accounts/{accountId}/signers/{signerId}` | `client.signers.update(signerId, payload, accountId?)` | Covered |
123
126
  | `DELETE` | `/v1/accounts/{accountId}/signers/{signerId}` | `client.signers.delete(signerId, accountId?)` | Covered |
124
127
 
125
- ## Signing and public flows — 17/17
128
+ ## Signing and public flows — 19/19
126
129
 
127
130
  All access-code methods in this section use the auth-free transport and reject
128
131
  a missing or blank code; they authenticate with the `signer-access-code` query
@@ -136,6 +139,8 @@ an optional fourth access-code argument only for legacy compatibility.
136
139
  | `GET` | `/v1/public/documents/{documentId}` | `client.documents.getPublic(documentId)` | Covered |
137
140
  | `PUT` | `/v1/public/documents/{documentId}/send-token` | `client.documents.sendToken(documentId, recipient, channel?)` | Covered |
138
141
  | `GET` | `/v1/signers/self` | `client.signerDocuments.self(accessCode)` | Covered |
142
+ | `GET` | `/v1/signers/identity-verification` | `client.signerDocuments.getIdentityVerification(accessCode)` | Covered |
143
+ | `POST` | `/v1/signers/identity-verification` | `client.signerDocuments.startIdentityVerification(accessCode, payload)` | Covered |
139
144
  | `GET` | `/v1/signers/{signerId}/document` | `client.signerDocuments.getCurrent(signerId, accessCode)` | Covered |
140
145
  | `GET` | `/v1/sign` | `client.signerDocuments.getAssignment(accessCode, hasAcceptedTerms?)` | Covered |
141
146
  | `POST` | `/v1/documents/{documentId}/assignments/{assignmentId}` | `client.signerDocuments.sign(documentId, assignmentId, accessCode, entries)` | Covered |
@@ -183,7 +188,7 @@ Five additional routes are documented separately under
183
188
  | `POST` | `/v1/users/self/mfa/recovery-codes` | `client.users.regenerateRecoveryCodes(proof)` | Covered |
184
189
  | `DELETE` | `/v1/users/self/mfa/{customId}` | `client.users.deleteMfaMethod(methodId, proof)` | Covered |
185
190
 
186
- ## Webhooks — 13/13
191
+ ## Webhooks — 14/14
187
192
 
188
193
  | Method | Path | SDK method | Status |
189
194
  | --- | --- | --- | --- |
@@ -193,8 +198,9 @@ Five additional routes are documented separately under
193
198
  | `GET` | `/v1/webhooks/event-types` | `client.webhooks.listEventTypes()` | Covered |
194
199
  | `GET` | `/v1/accounts/{accountId}/webhooks` | `client.webhooks.listDispatches(params?, accountId?)` | Covered |
195
200
  | `POST` | `/v1/accounts/{accountId}/webhooks/{historyId}/retry` | `client.webhooks.retryDispatch(historyId, accountId?)` | Covered |
196
- | `GET` | `/v1/accounts/{accountId}/webhooks/endpoints` | `client.webhooks.listEndpoints(accountId?)` | Covered |
201
+ | `GET` | `/v1/accounts/{accountId}/webhooks/endpoints` | `client.webhooks.listEndpoints(accountId?, params?)` | Covered |
197
202
  | `POST` | `/v1/accounts/{accountId}/webhooks/endpoints` | `client.webhooks.createEndpoint(payload, accountId?)` | Covered |
203
+ | `DELETE` | `/v1/accounts/{accountId}/webhooks/endpoints` | `client.webhooks.deleteEndpointByUrl(url, accountId?)` | Covered |
198
204
  | `GET` | `/v1/accounts/{accountId}/webhooks/endpoints/{endpointId}` | `client.webhooks.getEndpoint(endpointId, accountId?)` | Covered |
199
205
  | `PUT` | `/v1/accounts/{accountId}/webhooks/endpoints/{endpointId}` | `client.webhooks.updateEndpoint(endpointId, payload, accountId?)` | Covered |
200
206
  | `DELETE` | `/v1/accounts/{accountId}/webhooks/endpoints/{endpointId}` | `client.webhooks.deleteEndpoint(endpointId, accountId?)` | Covered |
@@ -204,7 +210,7 @@ Five additional routes are documented separately under
204
210
  ## Template compatibility routes
205
211
 
206
212
  These routes are available to existing integrations but do not appear in the
207
- current OpenAPI path set. They are excluded from the official 106-operation
213
+ current OpenAPI path set. They are excluded from the official 112-operation
208
214
  coverage count.
209
215
 
210
216
  | Method | Path | SDK method | Status |
@@ -219,7 +225,7 @@ coverage count.
219
225
 
220
226
  Two browser URL helpers used by older deployments are live but absent from the
221
227
  current OpenAPI path set, so they are likewise excluded from the official
222
- 106-operation coverage count.
228
+ 112-operation coverage count.
223
229
 
224
230
  | Method | Path | SDK method | Status |
225
231
  | --- | --- | --- | --- |
@@ -38,13 +38,14 @@ GET /v1/login-callback
38
38
 
39
39
  They map to `auth.getSocialLoginUrl()` and
40
40
  `auth.getSocialLoginCallbackUrl()` and are not part of the official
41
- 106-operation total.
41
+ 112-operation total.
42
42
 
43
43
  The SDK also includes the production contract additions for:
44
44
 
45
45
  - the `pades` document artifact;
46
- - `DigitalCertificate` verification on assignment and template-document
47
- creation and cost estimation;
46
+ - `DigitalCertificate` verification on virtual assignment creation and cost
47
+ estimation (template calls remain typed but are temporarily rejected because
48
+ the server derives their method);
48
49
  - typed `display_settings` for collect fields;
49
50
  - signer `government_id` updates;
50
51
  - signature-image `reuse`;
@@ -210,7 +211,7 @@ const { recipient } = await client.documents.sendToken(documentId, 'signer@examp
210
211
 
211
212
  ## Document tags
212
213
 
213
- Replace and attach requests require existing tag IDs:
214
+ The published contract specifies existing tag IDs for replace and attach:
214
215
 
215
216
  ```ts
216
217
  const tag = await client.tags.create({ name: 'Contracts', color: '#ff8800' });
@@ -225,6 +226,13 @@ stored six-character value without it. Unknown tag names are not the normal
225
226
  attachment input; create or list the tag first and send its ID. An empty array
226
227
  passed to `replaceTags` detaches every tag.
227
228
 
229
+ Older sandbox deployments interpret those same string arrays as **tag names**:
230
+ sending an ID creates a new tag whose name is that ID. On such a deployment,
231
+ pass the existing tag's `name` intentionally to attach it. `detachTag` still
232
+ takes an ID. The SDK sends the supplied strings unchanged; it does not retry a
233
+ successful mutation or infer an ID-to-name translation. Check the returned tag
234
+ IDs and names when selecting the deployment's input shape.
235
+
228
236
  ## Account branding fields
229
237
 
230
238
  The official account create/update request schemas define `name` and
@@ -273,8 +281,46 @@ responses do not return it.
273
281
 
274
282
  `DigitalCertificate` requires the account feature, a CPF or CNPJ stored in the
275
283
  signer's `government_id`, and exactly one certificate signer in that signing
276
- step. It costs two credits per signer in addition to the selected notification
277
- cost. Notification methods remain `Email` and `Whatsapp`.
284
+ step. It costs 0.5 credits per signer in addition to the selected notification
285
+ cost. Notification methods remain `Email` and `Whatsapp`. It also requires
286
+ `method: virtual`: certificate completion completes a virtual item, while the
287
+ ordinary field-signing endpoint refuses certificate signers. The SDK rejects a
288
+ certificate/`collect` combination before assignment creation or cost
289
+ estimation with `ValidationError.errors.code` set to
290
+ `digital_certificate_requires_virtual_method`.
291
+
292
+ Template role IDs do not reveal which entries are signers, editors or copy
293
+ receivers. The SDK validates each entry's channel and positive `step`, then
294
+ lets the API enforce role-aware signing order. The server also derives the
295
+ assignment method from placed template fields but does not yet reject an
296
+ unusable certificate/`collect` result. Until it does, the SDK refuses
297
+ `DigitalCertificate` on both template-document creation and cost estimation
298
+ with the same stable code; use a direct virtual assignment instead.
299
+
300
+ ## Identity document and face verification
301
+
302
+ `IdDocumentFaceMatchBasic` requires the **ID Document + Face Match** feature and
303
+ a valid CPF in the signer's `government_id` (a CNPJ is not sufficient). It
304
+ accepts either notification channel. Use assignment or template cost estimation
305
+ for its current per-signer fee before creating the assignment.
306
+
307
+ `signerDocuments.self()` exposes `verification_method` before verification.
308
+ For this method, obtain explicit biometric consent and call
309
+ `startIdentityVerification(accessCode, { consent: true })`; preserve the entire
310
+ returned bearer URL, including its fragment, and keep it out of logs and
311
+ browser storage. `getIdentityVerification()` returns `can_start`, `status`,
312
+ `url`, `expires_at`, and `completed_at`. Only no session or an `Expired` session
313
+ allows another start. `expires_at` is the capture-link expiry, not a processing
314
+ or review deadline. `Declined` and `Abandoned` require a new document/assignment.
315
+
316
+ `InReview` permits signing but holds certification. Once everyone has signed,
317
+ the document is `pending_identity_review`. Account reviewers use
318
+ `assignments.getIdentityVerification()`, `downloadIdentityVerificationImage()`
319
+ and `reviewIdentityVerification()`. Evidence images are available only while
320
+ the review is open and must not be cached. Approval permits certification after
321
+ all reviews are approved; rejection cancels the document and notifies signers
322
+ and copy receivers. The optional nullable note (2000 characters maximum) is
323
+ recorded in activity and sent to the provider, but hidden from signers.
278
324
 
279
325
  For a `collect` assignment, each field can include `display_settings`.
280
326
  `left`, `top`, `width`, `height`, and `fontSize` are required; `fontFamily` and
@@ -413,17 +459,30 @@ fields.
413
459
 
414
460
  An account has 1 webhook endpoint, or up to 3 on paid plans. The subscription
415
461
  routes (`webhooks.register()`, `get()`, `inactivate()`) act on the account's
416
- oldest endpoint; the endpoint routes address each one by ID.
462
+ oldest endpoint; the endpoint routes address each one by ID. Exact registered
463
+ URLs can also filter `listEndpoints(accountId?, { url })` and identify the
464
+ target of `deleteEndpointByUrl(url, accountId?)`.
465
+
466
+ `createEndpoint()` returns `IWebhookEndpointCreateResponse` with `secret` when
467
+ signing is enabled. Store that value securely at creation, including for OAuth
468
+ applications: they cannot read or rotate the secret afterward. If an OAuth
469
+ application loses it, delete and recreate its endpoint.
417
470
 
418
471
  Signing-enabled endpoints follow Standard Webhooks:
419
472
  `webhook-signature` holds space-separated `v1,<base64>` entries, each an
420
473
  HMAC-SHA256 of `{webhook-id}.{webhook-timestamp}.{raw body}` keyed with the
421
474
  base64-decoded part of the `whsec_` secret.
422
475
  `webhookVerifier.verifySignature()` implements this, with a 300-second
423
- timestamp tolerance by default. The signing-secret routes are not available to
476
+ timestamp tolerance by default; non-finite or negative windows fail closed.
477
+ The signing-secret routes are not available to
424
478
  OAuth applications. The earlier `webhookVerifier.verify()` (hex HMAC over the
425
479
  body alone) is deprecated; it never matched an Assinafy signature.
426
480
 
481
+ Older sandbox deployments can omit `secret` from the creation response and
482
+ return `404` for deletion by URL. API-key integrations can still use the secret
483
+ read/rotation and deletion-by-ID routes. OAuth integrations need a deployment
484
+ that returns the creation secret to configure signed endpoints.
485
+
427
486
  ## Authentication isolation
428
487
 
429
488
  Public documents, login and social login, password reset, OAuth URLs, and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@assinafy/sdk",
3
- "version": "2.7.1",
3
+ "version": "2.8.1",
4
4
  "packageManager": "bun@1.4.0",
5
5
  "description": "TypeScript SDK for Assinafy API - Digital signature platform",
6
6
  "type": "commonjs",