@assinafy/sdk 2.7.1 → 2.8.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/CHANGELOG.md +38 -1
- package/README.en.md +71 -11
- package/README.md +72 -11
- package/dist/index.d.mts +355 -26
- package/dist/index.d.ts +355 -26
- package/dist/index.js +340 -30
- package/dist/index.mjs +340 -30
- package/docs/API_COVERAGE.md +14 -8
- package/docs/COMPATIBILITY.md +54 -5
- package/package.json +1 -1
package/docs/API_COVERAGE.md
CHANGED
|
@@ -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:
|
|
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
|
|
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 —
|
|
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 —
|
|
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 —
|
|
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
|
|
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
|
-
|
|
228
|
+
112-operation coverage count.
|
|
223
229
|
|
|
224
230
|
| Method | Path | SDK method | Status |
|
|
225
231
|
| --- | --- | --- | --- |
|
package/docs/COMPATIBILITY.md
CHANGED
|
@@ -38,7 +38,7 @@ 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
|
-
|
|
41
|
+
112-operation total.
|
|
42
42
|
|
|
43
43
|
The SDK also includes the production contract additions for:
|
|
44
44
|
|
|
@@ -210,7 +210,7 @@ const { recipient } = await client.documents.sendToken(documentId, 'signer@examp
|
|
|
210
210
|
|
|
211
211
|
## Document tags
|
|
212
212
|
|
|
213
|
-
|
|
213
|
+
The published contract specifies existing tag IDs for replace and attach:
|
|
214
214
|
|
|
215
215
|
```ts
|
|
216
216
|
const tag = await client.tags.create({ name: 'Contracts', color: '#ff8800' });
|
|
@@ -225,6 +225,13 @@ stored six-character value without it. Unknown tag names are not the normal
|
|
|
225
225
|
attachment input; create or list the tag first and send its ID. An empty array
|
|
226
226
|
passed to `replaceTags` detaches every tag.
|
|
227
227
|
|
|
228
|
+
Older sandbox deployments interpret those same string arrays as **tag names**:
|
|
229
|
+
sending an ID creates a new tag whose name is that ID. On such a deployment,
|
|
230
|
+
pass the existing tag's `name` intentionally to attach it. `detachTag` still
|
|
231
|
+
takes an ID. The SDK sends the supplied strings unchanged; it does not retry a
|
|
232
|
+
successful mutation or infer an ID-to-name translation. Check the returned tag
|
|
233
|
+
IDs and names when selecting the deployment's input shape.
|
|
234
|
+
|
|
228
235
|
## Account branding fields
|
|
229
236
|
|
|
230
237
|
The official account create/update request schemas define `name` and
|
|
@@ -273,9 +280,38 @@ responses do not return it.
|
|
|
273
280
|
|
|
274
281
|
`DigitalCertificate` requires the account feature, a CPF or CNPJ stored in the
|
|
275
282
|
signer's `government_id`, and exactly one certificate signer in that signing
|
|
276
|
-
step. It costs
|
|
283
|
+
step. It costs 0.5 credits per signer in addition to the selected notification
|
|
277
284
|
cost. Notification methods remain `Email` and `Whatsapp`.
|
|
278
285
|
|
|
286
|
+
Template role IDs do not reveal which entries are signers, editors or copy
|
|
287
|
+
receivers. The SDK validates each entry's channel and positive `step`, then
|
|
288
|
+
lets the API enforce role-aware signing order and certificate isolation.
|
|
289
|
+
|
|
290
|
+
## Identity document and face verification
|
|
291
|
+
|
|
292
|
+
`IdDocumentFaceMatchBasic` requires the **ID Document + Face Match** feature and
|
|
293
|
+
a valid CPF in the signer's `government_id` (a CNPJ is not sufficient). It
|
|
294
|
+
accepts either notification channel. Use assignment or template cost estimation
|
|
295
|
+
for its current per-signer fee before creating the assignment.
|
|
296
|
+
|
|
297
|
+
`signerDocuments.self()` exposes `verification_method` before verification.
|
|
298
|
+
For this method, obtain explicit biometric consent and call
|
|
299
|
+
`startIdentityVerification(accessCode, { consent: true })`; preserve the entire
|
|
300
|
+
returned bearer URL, including its fragment, and keep it out of logs and
|
|
301
|
+
browser storage. `getIdentityVerification()` returns `can_start`, `status`,
|
|
302
|
+
`url`, `expires_at`, and `completed_at`. Only no session or an `Expired` session
|
|
303
|
+
allows another start. `expires_at` is the capture-link expiry, not a processing
|
|
304
|
+
or review deadline. `Declined` and `Abandoned` require a new document/assignment.
|
|
305
|
+
|
|
306
|
+
`InReview` permits signing but holds certification. Once everyone has signed,
|
|
307
|
+
the document is `pending_identity_review`. Account reviewers use
|
|
308
|
+
`assignments.getIdentityVerification()`, `downloadIdentityVerificationImage()`
|
|
309
|
+
and `reviewIdentityVerification()`. Evidence images are available only while
|
|
310
|
+
the review is open and must not be cached. Approval permits certification after
|
|
311
|
+
all reviews are approved; rejection cancels the document and notifies signers
|
|
312
|
+
and copy receivers. The optional nullable note (2000 characters maximum) is
|
|
313
|
+
recorded in activity and sent to the provider, but hidden from signers.
|
|
314
|
+
|
|
279
315
|
For a `collect` assignment, each field can include `display_settings`.
|
|
280
316
|
`left`, `top`, `width`, `height`, and `fontSize` are required; `fontFamily` and
|
|
281
317
|
`backgroundColor` are optional. Values use Assinafy's 150-DPI page-image pixels
|
|
@@ -413,17 +449,30 @@ fields.
|
|
|
413
449
|
|
|
414
450
|
An account has 1 webhook endpoint, or up to 3 on paid plans. The subscription
|
|
415
451
|
routes (`webhooks.register()`, `get()`, `inactivate()`) act on the account's
|
|
416
|
-
oldest endpoint; the endpoint routes address each one by ID.
|
|
452
|
+
oldest endpoint; the endpoint routes address each one by ID. Exact registered
|
|
453
|
+
URLs can also filter `listEndpoints(accountId?, { url })` and identify the
|
|
454
|
+
target of `deleteEndpointByUrl(url, accountId?)`.
|
|
455
|
+
|
|
456
|
+
`createEndpoint()` returns `IWebhookEndpointCreateResponse` with `secret` when
|
|
457
|
+
signing is enabled. Store that value securely at creation, including for OAuth
|
|
458
|
+
applications: they cannot read or rotate the secret afterward. If an OAuth
|
|
459
|
+
application loses it, delete and recreate its endpoint.
|
|
417
460
|
|
|
418
461
|
Signing-enabled endpoints follow Standard Webhooks:
|
|
419
462
|
`webhook-signature` holds space-separated `v1,<base64>` entries, each an
|
|
420
463
|
HMAC-SHA256 of `{webhook-id}.{webhook-timestamp}.{raw body}` keyed with the
|
|
421
464
|
base64-decoded part of the `whsec_` secret.
|
|
422
465
|
`webhookVerifier.verifySignature()` implements this, with a 300-second
|
|
423
|
-
timestamp tolerance by default
|
|
466
|
+
timestamp tolerance by default; non-finite or negative windows fail closed.
|
|
467
|
+
The signing-secret routes are not available to
|
|
424
468
|
OAuth applications. The earlier `webhookVerifier.verify()` (hex HMAC over the
|
|
425
469
|
body alone) is deprecated; it never matched an Assinafy signature.
|
|
426
470
|
|
|
471
|
+
Older sandbox deployments can omit `secret` from the creation response and
|
|
472
|
+
return `404` for deletion by URL. API-key integrations can still use the secret
|
|
473
|
+
read/rotation and deletion-by-ID routes. OAuth integrations need a deployment
|
|
474
|
+
that returns the creation secret to configure signed endpoints.
|
|
475
|
+
|
|
427
476
|
## Authentication isolation
|
|
428
477
|
|
|
429
478
|
Public documents, login and social login, password reset, OAuth URLs, and
|