@assinafy/sdk 3.0.2 → 4.0.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/CHANGELOG.md +155 -28
- package/README.en.md +16 -11
- package/README.md +16 -12
- package/SECURITY.md +14 -12
- package/dist/index.d.mts +1380 -1277
- package/dist/index.d.ts +1380 -1277
- package/dist/index.js +1595 -1524
- package/dist/index.mjs +1594 -1523
- package/docs/API_COVERAGE.md +48 -38
- package/docs/COMPATIBILITY.md +48 -251
- package/docs/README.en.md +225 -148
- package/docs/README.md +213 -145
- package/docs/RELEASING.md +28 -29
- package/package.json +14 -13
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,134 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [4.0.1] - 2026-12-01
|
|
11
|
+
|
|
12
|
+
### Breaking changes
|
|
13
|
+
|
|
14
|
+
- `client.auth` (`AuthenticationResource`) is removed: login, two-factor
|
|
15
|
+
login, social login, password change and reset, and API key reading,
|
|
16
|
+
creation and deletion belong to the Assinafy app. So are the two-factor
|
|
17
|
+
methods of `client.users` (`getMfa()`, `startTotpEnrollment()`,
|
|
18
|
+
`confirmTotpEnrollment()`, `regenerateRecoveryCodes()`, `deleteMfaMethod()`)
|
|
19
|
+
and their types (`ILoginResponse`, `IApiKeyResponse`,
|
|
20
|
+
`IMaskedApiKeyResponse`, `IMfaStatus`, `IMfaMethod`, `ITotpEnrollment`,
|
|
21
|
+
`IMfaRecoveryCodes`, `IMfaReauth`, `IConfirmTotpPayload`). Authenticate with
|
|
22
|
+
an API key, which the user creates in the app, or an OAuth access token from
|
|
23
|
+
`client.oauth`.
|
|
24
|
+
- `documents.sendToken()` takes no `channel` argument and `SendTokenChannel` is
|
|
25
|
+
removed: the API accepts only e-mail, which the SDK always sends.
|
|
26
|
+
- `webhooks.get()` returns `IWebhookSubscription` and never `null`: a workspace
|
|
27
|
+
without an endpoint answers a blank subscription with `url: null`, and a
|
|
28
|
+
`404` (an unknown workspace) is thrown as an `ApiError`.
|
|
29
|
+
- `IWebhookEndpoint.url` and `email` are `string | null`.
|
|
30
|
+
- The `metadata` option of `documents.upload()` and
|
|
31
|
+
`uploadAndRequestSignatures()`, and signer `metadata` on `signers.create()`,
|
|
32
|
+
`ICreateSignerPayload`, `ISigner` and `IUploadAndRequestSignaturesSigner`, are
|
|
33
|
+
removed: the API never stored them.
|
|
34
|
+
- `signerDocuments.uploadSignature()` accepts only `contentType: 'image/png'` or
|
|
35
|
+
`'image/jpeg'`; the free-form overload and `ILegacyUploadSignatureOptions` are
|
|
36
|
+
removed (the API refuses any other image with `400 SignatureImageInvalid`).
|
|
37
|
+
- `IResendCostEstimate` is the compact `{ total, breakdown, credit_balance,
|
|
38
|
+
has_sufficient_credits }` the API returns; `ILegacyResendCostEstimate` is
|
|
39
|
+
removed.
|
|
40
|
+
- The aliases `ILegacyConfirmSignerDataPayload` (use
|
|
41
|
+
`IConfirmSignerDataPayload`), `IPaginatedResponse` (use `PaginatedResult`)
|
|
42
|
+
and the `IFieldValidationResult` base (use `IFieldValidationResponse` /
|
|
43
|
+
`IFieldValidationMultipleResult`) are removed.
|
|
44
|
+
- `IScheduledSend.next_attempt_at` and `IOAuthAuthorizationCallback.issuer` are
|
|
45
|
+
required, as the API always returns them.
|
|
46
|
+
- `signers.create()` recovers a concurrent duplicate only from the API's `400`
|
|
47
|
+
(it never answers `409` for one).
|
|
48
|
+
- `workspaces.uploadLogo()` labels only PNG, JPEG and WebP files with their
|
|
49
|
+
media type; the API detects the format from the bytes.
|
|
50
|
+
- Several `ValidationError` messages changed wording.
|
|
51
|
+
- Only a `POST` opts into `429` replay with an `Idempotency-Key`; a `PUT` or
|
|
52
|
+
`PATCH` never is, and a
|
|
53
|
+
`429` whose `Retry-After` exceeds the 30-second retry cap is thrown at once
|
|
54
|
+
instead of retried early.
|
|
55
|
+
- `documents.createFromTemplate()` requires a non-blank `name` with each
|
|
56
|
+
`email` signer entry, and `documents.setWatchers()` counts duplicate entries
|
|
57
|
+
toward its limit of 10, as the API does.
|
|
58
|
+
|
|
59
|
+
### Added
|
|
60
|
+
|
|
61
|
+
- `documents.cancel()` (`PUT /v1/documents/{documentId}/cancel`) cancels a
|
|
62
|
+
document out for signature and keeps it, its files and its history.
|
|
63
|
+
- Document and template uploads accept DOC, DOCX and ODT besides PDF, checked
|
|
64
|
+
by extension and leading bytes; the file keeps its real extension.
|
|
65
|
+
- Webhook events `signature_reminder_sent`, `signature_request_delivery_failed`,
|
|
66
|
+
`document_expiring` and `document_expired`.
|
|
67
|
+
- `IScheduledSend.next_attempt_at`, set while the free plan's daily signer
|
|
68
|
+
e-mail limit postpones a pending send.
|
|
69
|
+
- `IAuthenticatedUser.is_mfa_enabled` and
|
|
70
|
+
`IDocumentUploadResponse.verification_code` / `verification_url`.
|
|
71
|
+
- `tags.list()` forwards `page` and `per-page`.
|
|
72
|
+
- Envelope and scheduled-envelope document `expires_at` accepts Unix seconds.
|
|
73
|
+
- `webhooks.updateEndpoint()` accepts `name: null` to clear the label.
|
|
74
|
+
- JSDoc lists the refusal codes `FreePlanSignerLimit`, `FreePlanEmailLimit`,
|
|
75
|
+
`FreeWorkspaceLimit`, `DocumentClosed`, `EmailVerificationRequired`,
|
|
76
|
+
`WhatsappVerificationRequired`, `IdentityVerificationRequired`,
|
|
77
|
+
`TermsNotAccepted`, `SignatureImageInvalid`, `SignatureImageBlank` and
|
|
78
|
+
`InvalidEmail` on the methods that return them.
|
|
79
|
+
|
|
80
|
+
### Fixed
|
|
81
|
+
|
|
82
|
+
- Assignment copy receivers (`copy_receivers`, `uploadAndRequestSignatures()`'s
|
|
83
|
+
`copyReceivers` and scheduled assignments) are sent as `copy_receiver_ids`,
|
|
84
|
+
the field the API reads, so they are no longer dropped.
|
|
85
|
+
- A redirect hook passed to the SDK's transports gets only plain values and a
|
|
86
|
+
copy of the headers, never a live routing object: only the path and ordinary
|
|
87
|
+
headers carry over, and a change to the next hop's destination is refused. A
|
|
88
|
+
per-request `beforeRedirect` (even `null`) or `sensitiveHeaders` can no longer
|
|
89
|
+
remove the redirect guard or the stripping of `Authorization` and `X-Api-Key`;
|
|
90
|
+
only axios's `http` adapter (resolved as axios resolves it) follows redirects
|
|
91
|
+
automatically, so the `fetch` adapter or any other adapter gets
|
|
92
|
+
`maxRedirects: 0`; and a request configured for axios's non-legacy
|
|
93
|
+
interceptor ordering is refused, so the SDK's checks always run after caller
|
|
94
|
+
interceptors.
|
|
95
|
+
- Credentialed requests refuse `socketPath`, `transport`, `lookup` and a `Host`
|
|
96
|
+
or `:authority` header, which would send them to another socket behind the
|
|
97
|
+
configured API origin.
|
|
98
|
+
- A file-path upload rechecks the 25 MB limit on the bytes actually read.
|
|
99
|
+
- `signerDocuments.sign()` accepts `[]` for a virtual assignment.
|
|
100
|
+
- WhatsApp numbers accept the Brazilian forms the API normalizes, such as
|
|
101
|
+
`(48) 99999-0000`, besides E.164.
|
|
102
|
+
- `users.updateNotificationPreferences()` leaves unknown keys to the API, so
|
|
103
|
+
keys the API adds later can be set.
|
|
104
|
+
- OAuth authorization requests refuse a `state` over 2048 or a `nonce` over 255
|
|
105
|
+
characters before the authorization server would strand the user.
|
|
106
|
+
- Scheduled sends, watchers, signer capacities, notification history and
|
|
107
|
+
envelope reminder estimates are documented as part of the published API.
|
|
108
|
+
- The build embeds only the package version for the `User-Agent`.
|
|
109
|
+
|
|
110
|
+
### Changed
|
|
111
|
+
|
|
112
|
+
- `@types/bun` 1.4.5, `@types/node` 22.20.7 and ESLint 10.16; the ESLint
|
|
113
|
+
config uses `defineConfig`. ESLint's `cross-spawn` is pinned to 7.1.2.
|
|
114
|
+
|
|
115
|
+
## [3.1.0] - 2026-11-24
|
|
116
|
+
|
|
117
|
+
### Added
|
|
118
|
+
|
|
119
|
+
- Scheduled assignments and envelopes through `client.scheduledSends`, including
|
|
120
|
+
listing, cancellation and immediate dispatch.
|
|
121
|
+
- Document watchers, signer capacities, notification delivery/open history and
|
|
122
|
+
envelope reminder cost estimates.
|
|
123
|
+
- Typed PNG/JPEG signature-image upload options.
|
|
124
|
+
|
|
125
|
+
### Fixed
|
|
126
|
+
|
|
127
|
+
- Preserve and validate assignment `sign_as` on creation and cost estimation.
|
|
128
|
+
- Use current cost estimates for certificate pricing in integration guidance.
|
|
129
|
+
- Require Axios 1.21.1, including its updated redirect dependency minimum.
|
|
130
|
+
- Reject malformed webhook signature entries with extra comma-separated data.
|
|
131
|
+
|
|
132
|
+
### Changed
|
|
133
|
+
|
|
134
|
+
- GitHub builds and releases use Node.js 26 LTS, retaining Node.js 22/24 support.
|
|
135
|
+
- Keep local maintenance utilities outside version control; CI uses tracked
|
|
136
|
+
contract and packed-consumer tests.
|
|
137
|
+
|
|
10
138
|
## [3.0.2] - 2026-11-12
|
|
11
139
|
|
|
12
140
|
### Fixed
|
|
@@ -49,7 +177,7 @@ These follow what the API now accepts and returns; code that compiled against
|
|
|
49
177
|
`assignment` has no `signers`, `signing_urls`, `copy_receivers` or `summary`,
|
|
50
178
|
which signer reads never return.
|
|
51
179
|
- `signerDocuments.acceptTerms()` returns `IAcceptTermsResult | null` instead of
|
|
52
|
-
`void` (`null` from
|
|
180
|
+
`void` (`null` from API versions that acknowledge without data).
|
|
53
181
|
- `ISigningUrl.url` is `string | null`: `null` for embedded and WhatsApp-only
|
|
54
182
|
signers.
|
|
55
183
|
- `IWhatsAppNotification.sent_at` is an ISO-8601 string instead of a number.
|
|
@@ -157,14 +285,14 @@ These follow what the API now accepts and returns; code that compiled against
|
|
|
157
285
|
|
|
158
286
|
- `documents.listActivities(documentId, params?)` returns activity entries
|
|
159
287
|
with pagination metadata from the response headers. Use it to read the full
|
|
160
|
-
|
|
288
|
+
history; an unpaged response has no metadata.
|
|
161
289
|
|
|
162
290
|
### Fixed
|
|
163
291
|
|
|
164
292
|
- `documents.activities(documentId, params?)` accepts `page`, `per-page`
|
|
165
|
-
(or `per_page`), and `sort`, allowing callers to fetch beyond
|
|
166
|
-
default 20 activity entries. Existing calls still return an array
|
|
167
|
-
|
|
293
|
+
(or `per_page`), and `sort`, allowing callers to fetch beyond the
|
|
294
|
+
default 20 activity entries. Existing calls still return an array, and an
|
|
295
|
+
unpaged activity log remains compatible.
|
|
168
296
|
|
|
169
297
|
## [2.9.1] - 2026-10-28
|
|
170
298
|
|
|
@@ -349,8 +477,8 @@ These follow what the API now accepts and returns; code that compiled against
|
|
|
349
477
|
- API errors preserve authentication challenges and decoded binary error bodies
|
|
350
478
|
when a custom transport resolves a non-success response. OAuth errors retain
|
|
351
479
|
the authentication challenge when converted to `OAuthError`.
|
|
352
|
-
-
|
|
353
|
-
|
|
480
|
+
- OAuth setup uses discovery and keeps client registration, issuer and API
|
|
481
|
+
requests in the same environment.
|
|
354
482
|
- Resource reference documentation includes JSON request payloads alongside
|
|
355
483
|
response examples; upload examples describe filename handling accurately.
|
|
356
484
|
|
|
@@ -369,14 +497,14 @@ These follow what the API now accepts and returns; code that compiled against
|
|
|
369
497
|
and stale `@throws` clauses corrected on `documents.details()` and
|
|
370
498
|
`signerDocuments.getCurrent()`. No behavior changes.
|
|
371
499
|
- `README.en.md` reaches parity with the pt-BR README: the Environments
|
|
372
|
-
section (
|
|
500
|
+
section (base URL and explicit `issuer`/`authorizationEndpoint`
|
|
373
501
|
configuration), the verification/notification channel table with per-signer
|
|
374
502
|
costs, and the A1/A3 certificate-media note.
|
|
375
503
|
- The two browser URL helpers (`auth.getSocialLoginUrl()`,
|
|
376
504
|
`auth.getSocialLoginCallbackUrl()`) are listed in the coverage ledger's
|
|
377
505
|
compatibility extensions.
|
|
378
506
|
- OAuth callback examples use reserved example domains, and the CONTRIBUTING
|
|
379
|
-
live-test examples point at
|
|
507
|
+
live-test examples point at a dedicated test workspace.
|
|
380
508
|
|
|
381
509
|
## [2.5.0] - 2026-09-25
|
|
382
510
|
|
|
@@ -394,7 +522,7 @@ These follow what the API now accepts and returns; code that compiled against
|
|
|
394
522
|
- `oauth.readAuthorizationCallback()` always checks `iss`. When the stored
|
|
395
523
|
request carries no `issuer`, the callback must come from
|
|
396
524
|
`https://auth.assinafy.com.br`; pass the stored request for any other
|
|
397
|
-
authorization server
|
|
525
|
+
authorization server.
|
|
398
526
|
|
|
399
527
|
### Security
|
|
400
528
|
|
|
@@ -418,7 +546,7 @@ These follow what the API now accepts and returns; code that compiled against
|
|
|
418
546
|
### Changed
|
|
419
547
|
|
|
420
548
|
- The manual live suite requires `--confirm-production` for `--all` on every configured host.
|
|
421
|
-
- Public examples use production URLs
|
|
549
|
+
- Public examples use production URLs.
|
|
422
550
|
|
|
423
551
|
## [2.4.1] - 2026-09-23
|
|
424
552
|
|
|
@@ -568,9 +696,9 @@ These follow what the API now accepts and returns; code that compiled against
|
|
|
568
696
|
- `decodeBinaryErrorBody()` returns a non-JSON binary body as a string instead
|
|
569
697
|
of wrapping it in `{ message }`, so both unstructured-body paths converge on
|
|
570
698
|
the single rule in `ApiError.fromResponse()`.
|
|
571
|
-
-
|
|
572
|
-
instead of repeating the literal,
|
|
573
|
-
|
|
699
|
+
- CI reads the Bun version from `package.json`'s `packageManager` field
|
|
700
|
+
instead of repeating the literal, so every CI workflow moves together when
|
|
701
|
+
that field is bumped.
|
|
574
702
|
- README gained a contents map linking the setup, end-to-end workflow, and
|
|
575
703
|
per-resource sections; list examples use the `per-page` spelling the API
|
|
576
704
|
reads and document the page-size clamp.
|
|
@@ -584,7 +712,7 @@ These follow what the API now accepts and returns; code that compiled against
|
|
|
584
712
|
- `scripts/node-consumer-smoke.mjs`, exercised by CI and the release workflow:
|
|
585
713
|
it installs the packed tarball into an isolated consumer and drives the real
|
|
586
714
|
Node HTTP, auth, and multipart paths through both CJS and ESM entrypoints.
|
|
587
|
-
- A manual
|
|
715
|
+
- A manual integration workflow with `read-only` and
|
|
588
716
|
`disposable-full` modes, gated on a protected environment.
|
|
589
717
|
|
|
590
718
|
### Security
|
|
@@ -647,9 +775,9 @@ type, or API surface changed.
|
|
|
647
775
|
- Strict test-source typechecking and enforced Bun coverage floors. The suite
|
|
648
776
|
now executes every public HTTP wrapper and covers the production source at
|
|
649
777
|
more than 95% of functions and 98% of lines.
|
|
650
|
-
-
|
|
651
|
-
|
|
652
|
-
|
|
778
|
+
- SHA-pinned CI workflows. Release tags now build one immutable tarball,
|
|
779
|
+
verify its checksum, and publish that same file to npm (OIDC trusted
|
|
780
|
+
publishing) and GitHub Packages.
|
|
653
781
|
|
|
654
782
|
### Fixed
|
|
655
783
|
|
|
@@ -672,9 +800,7 @@ type, or API surface changed.
|
|
|
672
800
|
request credentials or user payloads.
|
|
673
801
|
- Restored the official name-only signer request and account
|
|
674
802
|
`notification_sender_type` field. Both are now represented exactly as the
|
|
675
|
-
OpenAPI defines them
|
|
676
|
-
`notification_sender_type` is recorded as a known deployment divergence
|
|
677
|
-
without blocking unrelated endpoint tests.
|
|
803
|
+
OpenAPI defines them.
|
|
678
804
|
- Restored the official public, code-free signer artifact download while
|
|
679
805
|
retaining an optional access-code argument for legacy deployments, and made
|
|
680
806
|
owner-only assignment-signer fields optional in signer-context responses.
|
|
@@ -738,9 +864,8 @@ type, or API surface changed.
|
|
|
738
864
|
|
|
739
865
|
#### Compatibility notes
|
|
740
866
|
|
|
741
|
-
- The
|
|
742
|
-
|
|
743
|
-
that sandbox lag explicitly instead of deleting documented functionality.
|
|
867
|
+
- The SDK exposes the official `notification_sender_type` account field on
|
|
868
|
+
both creation and update.
|
|
744
869
|
- The live list API clamps `per-page` to **50**. `sendToken` uses the current
|
|
745
870
|
official `{ email }` body first and retains the older `{ recipient, channel }`
|
|
746
871
|
form as an explicit, narrowly scoped compatibility path.
|
|
@@ -863,7 +988,7 @@ type, or API surface changed.
|
|
|
863
988
|
not return either field, so the old type promised a required `pages` array
|
|
864
989
|
that was `undefined` at runtime.
|
|
865
990
|
- **`ICreateAssignmentPayload.copy_receivers` is documented as unreliable.** On
|
|
866
|
-
|
|
991
|
+
some plans the API accepts it and persists nothing — `[]` from
|
|
867
992
|
`create`, `list` and `details().assignment`, for both emails and signer IDs.
|
|
868
993
|
Kept (it may be plan-gated) but do not assume a CC was delivered.
|
|
869
994
|
|
|
@@ -922,8 +1047,8 @@ Adds template management, aligns types with response payloads, and updates the t
|
|
|
922
1047
|
- Multipart upload helpers (`loadSource` / `validateUpload` / `buildUploadForm`)
|
|
923
1048
|
were extracted into `src/resources/upload.ts` and shared by document and
|
|
924
1049
|
template uploads (DRY).
|
|
925
|
-
- `scripts/live-smoke.ts` honors `ASSINAFY_BASE_URL` (so it can target
|
|
926
|
-
|
|
1050
|
+
- `scripts/live-smoke.ts` honors `ASSINAFY_BASE_URL` (so it can target a
|
|
1051
|
+
configured API URL) and now exercises the template lifecycle in `--upload` mode.
|
|
927
1052
|
|
|
928
1053
|
### Tooling
|
|
929
1054
|
|
|
@@ -1039,7 +1164,9 @@ signer fields with `cpf` and `whatsapp_phone_number`.
|
|
|
1039
1164
|
- High-level `uploadAndRequestSignatures` helper on `AssinafyClient`.
|
|
1040
1165
|
- `PaginatedResult<T>` with parsed `X-Pagination-*` header meta.
|
|
1041
1166
|
|
|
1042
|
-
[Unreleased]: https://github.com/assinafy/typescript-sdk/compare/
|
|
1167
|
+
[Unreleased]: https://github.com/assinafy/typescript-sdk/compare/v4.0.1...HEAD
|
|
1168
|
+
[4.0.1]: https://github.com/assinafy/typescript-sdk/releases/tag/v4.0.1
|
|
1169
|
+
[3.1.0]: https://github.com/assinafy/typescript-sdk/releases/tag/v3.1.0
|
|
1043
1170
|
[3.0.2]: https://github.com/assinafy/typescript-sdk/compare/v3.0.1...v3.0.2
|
|
1044
1171
|
[3.0.1]: https://github.com/assinafy/typescript-sdk/compare/v3.0.0...v3.0.1
|
|
1045
1172
|
[3.0.0]: https://github.com/assinafy/typescript-sdk/compare/v2.11.0...v3.0.0
|
package/README.en.md
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
Official TypeScript SDK for the [Assinafy API](https://api.assinafy.com.br/v1/docs), with Node.js
|
|
6
6
|
and Bun support, complete types, and ESM/CJS builds.
|
|
7
7
|
|
|
8
|
-
The SDK maps all
|
|
9
|
-
session exchange
|
|
8
|
+
The SDK maps all 158 operations in the published OpenAPI document (142 with methods; the embed
|
|
9
|
+
session exchange and the login, password, two-factor and API key routes belong to the Assinafy
|
|
10
|
+
app), plus compatibility extensions
|
|
10
11
|
maintained by the API. The complete reference, including payloads, responses, errors, and examples
|
|
11
12
|
for every resource, is in the **[English manual](docs/README.en.md)**.
|
|
12
13
|
|
|
@@ -54,9 +55,9 @@ control each step independently, follow the [complete document flow](docs/README
|
|
|
54
55
|
|
|
55
56
|
| Credential | Use |
|
|
56
57
|
| --- | --- |
|
|
57
|
-
| `apiKey` | Server-to-server automation in your own workspace |
|
|
58
|
-
| `token` |
|
|
59
|
-
| No credential |
|
|
58
|
+
| `apiKey` | Server-to-server automation in your own workspace; the user creates it in the Assinafy app |
|
|
59
|
+
| `token` | OAuth access token for a workspace connected to your application |
|
|
60
|
+
| No credential | Public reads, signer access codes, and OAuth endpoints |
|
|
60
61
|
|
|
61
62
|
```ts
|
|
62
63
|
const withApiKey = new AssinafyClient({
|
|
@@ -81,7 +82,7 @@ validation, refresh-token rotation, and revocation.
|
|
|
81
82
|
| `apiKey` | — | `X-Api-Key` credential |
|
|
82
83
|
| `token` | — | `Authorization: Bearer` credential |
|
|
83
84
|
| `accountId` | — | Default workspace |
|
|
84
|
-
| `baseUrl` | `https://api.assinafy.com.br/v1` | API
|
|
85
|
+
| `baseUrl` | `https://api.assinafy.com.br/v1` | API URL |
|
|
85
86
|
| `webhookSecret` | — | Standard Webhooks signature verification |
|
|
86
87
|
| `timeout` | `30000` | Timeout in milliseconds |
|
|
87
88
|
| `maxRetries` | `2` | Safe retries for HTTP 429 |
|
|
@@ -92,7 +93,7 @@ factories.
|
|
|
92
93
|
|
|
93
94
|
## Integration flow
|
|
94
95
|
|
|
95
|
-
1. Configure the client with an API key or complete
|
|
96
|
+
1. Configure the client with an API key or complete the OAuth flow.
|
|
96
97
|
2. Create or find the signers.
|
|
97
98
|
3. Upload the PDF and wait for metadata processing.
|
|
98
99
|
4. Estimate the cost and create the assignment with the required verification and notification,
|
|
@@ -100,6 +101,9 @@ factories.
|
|
|
100
101
|
5. Deliver the signing URL, or show the signing screen inside your app with `client.embed`, and
|
|
101
102
|
authenticate webhooks before processing events.
|
|
102
103
|
6. Observe completion and download the signed document or certificate.
|
|
104
|
+
7. Track contract terms with `client.contracts`; defer a request with `client.scheduledSends`
|
|
105
|
+
and monitor its `pending`, `sent` or `failed` state; cancel a document and keep it with
|
|
106
|
+
`client.documents.cancel()`.
|
|
103
107
|
|
|
104
108
|
WhatsApp, ID-document and face biometrics, ICP-Brasil digital certificates, and per-account
|
|
105
109
|
`Bypass` verification have specific prerequisites; `workspaces.get(id, { expand:
|
|
@@ -110,15 +114,16 @@ in their browser. See the [signing branches](docs/README.en.md#paid-signing-bran
|
|
|
110
114
|
|
|
111
115
|
| Resource | Area |
|
|
112
116
|
| --- | --- |
|
|
113
|
-
| `client.documents` | Uploads, reads, artifacts, tags, and template creation |
|
|
117
|
+
| `client.documents` | Uploads, reads, artifacts, tags, watchers, cancellation, and template creation |
|
|
114
118
|
| `client.signers` | Signer registration, lookup, and updates |
|
|
115
119
|
| `client.assignments` | Requests, costs, notifications, and identity review |
|
|
116
120
|
| `client.envelopes` | Several documents to the same signers, one invitation and one charge |
|
|
117
121
|
| `client.embed` | Embed origins and single-use sessions for in-app signing |
|
|
122
|
+
| `client.scheduledSends` | Deferred assignments and envelopes |
|
|
118
123
|
| `client.contracts` | Terms, families, renewals, and contract termination |
|
|
119
124
|
| `client.templates`, `client.tags`, `client.fields` | Reusable content and fields |
|
|
120
|
-
| `client.workspaces`, `client.users` | Workspace, branding, usage, notification policy,
|
|
121
|
-
| `client.
|
|
125
|
+
| `client.workspaces`, `client.users` | Workspace, branding, usage, notification policy, and preferences |
|
|
126
|
+
| `client.oauth` | OAuth 2.1 authorization, tokens, and user info |
|
|
122
127
|
| `client.webhooks`, `client.webhookVerifier` | Endpoints, deliveries, and event authentication |
|
|
123
128
|
| `client.signerDocuments` | Public and authenticated signer flows |
|
|
124
129
|
|
|
@@ -131,7 +136,7 @@ with the package document the complete payloads.
|
|
|
131
136
|
- [Manual completo em português](docs/README.md)
|
|
132
137
|
- [Complete manual in English](docs/README.en.md)
|
|
133
138
|
- [API coverage](docs/API_COVERAGE.md)
|
|
134
|
-
- [
|
|
139
|
+
- [Compatibility notes](docs/COMPATIBILITY.md)
|
|
135
140
|
- [Release process](docs/RELEASING.md)
|
|
136
141
|
- [Official API documentation](https://api.assinafy.com.br/v1/docs)
|
|
137
142
|
|
package/README.md
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
SDK oficial em TypeScript para a [API Assinafy](https://api.assinafy.com.br/v1/docs), com suporte
|
|
6
6
|
a Node.js e Bun, tipos completos e builds ESM/CJS.
|
|
7
7
|
|
|
8
|
-
O SDK mapeia as
|
|
9
|
-
|
|
8
|
+
O SDK mapeia as 158 operações do OpenAPI publicado (142 com métodos; a troca da sessão incorporada
|
|
9
|
+
e as rotas de login, senha, dois fatores e chave de API pertencem ao app da Assinafy), além das
|
|
10
|
+
extensões de compatibilidade mantidas
|
|
10
11
|
pela API. A referência completa, com payloads, respostas, erros e exemplos de cada recurso, está no
|
|
11
12
|
**[manual em português](docs/README.md)**.
|
|
12
13
|
|
|
@@ -54,9 +55,9 @@ cada etapa separadamente, siga o [fluxo completo do documento](docs/README.md#ci
|
|
|
54
55
|
|
|
55
56
|
| Credencial | Uso |
|
|
56
57
|
| --- | --- |
|
|
57
|
-
| `apiKey` | Automação servidor a servidor no seu próprio workspace |
|
|
58
|
-
| `token` |
|
|
59
|
-
| Sem credencial |
|
|
58
|
+
| `apiKey` | Automação servidor a servidor no seu próprio workspace; o usuário a cria no app da Assinafy |
|
|
59
|
+
| `token` | Token de acesso OAuth de um workspace conectado ao seu aplicativo |
|
|
60
|
+
| Sem credencial | Leituras públicas, código do signatário e endpoints OAuth |
|
|
60
61
|
|
|
61
62
|
```ts
|
|
62
63
|
const comChave = new AssinafyClient({
|
|
@@ -81,7 +82,7 @@ refresh token e revogação.
|
|
|
81
82
|
| `apiKey` | — | Credencial `X-Api-Key` |
|
|
82
83
|
| `token` | — | Credencial `Authorization: Bearer` |
|
|
83
84
|
| `accountId` | — | Workspace padrão |
|
|
84
|
-
| `baseUrl` | `https://api.assinafy.com.br/v1` |
|
|
85
|
+
| `baseUrl` | `https://api.assinafy.com.br/v1` | URL da API |
|
|
85
86
|
| `webhookSecret` | — | Verificação de assinatura Standard Webhooks |
|
|
86
87
|
| `timeout` | `30000` | Timeout em milissegundos |
|
|
87
88
|
| `maxRetries` | `2` | Retentativas seguras para HTTP 429 |
|
|
@@ -91,8 +92,7 @@ O [manual de configuração](docs/README.md#configuração) explica retentativas
|
|
|
91
92
|
|
|
92
93
|
## Fluxo de integração
|
|
93
94
|
|
|
94
|
-
1. Configure o cliente com uma chave de API ou conclua o fluxo OAuth
|
|
95
|
-
workspace.
|
|
95
|
+
1. Configure o cliente com uma chave de API ou conclua o fluxo OAuth.
|
|
96
96
|
2. Crie ou localize os signatários.
|
|
97
97
|
3. Envie o PDF e aguarde o processamento dos metadados.
|
|
98
98
|
4. Estime o custo e crie o assignment com a verificação e a notificação desejadas, ou envie vários
|
|
@@ -100,6 +100,9 @@ O [manual de configuração](docs/README.md#configuração) explica retentativas
|
|
|
100
100
|
5. Entregue a URL de assinatura, ou exiba a tela de assinatura dentro do seu app com
|
|
101
101
|
`client.embed`, e valide os webhooks antes de processar eventos.
|
|
102
102
|
6. Acompanhe a conclusão e baixe o documento assinado ou o certificado.
|
|
103
|
+
7. Gerencie termos com `client.contracts`; agende com `client.scheduledSends` e acompanhe o
|
|
104
|
+
estado `pending`, `sent` ou `failed`; cancele um documento e mantenha-o com
|
|
105
|
+
`client.documents.cancel()`.
|
|
103
106
|
|
|
104
107
|
WhatsApp, biometria com documento e face, certificado digital ICP-Brasil e a verificação `Bypass`
|
|
105
108
|
(habilitada por conta) têm pré-requisitos específicos; `workspaces.get(id, { expand:
|
|
@@ -110,15 +113,16 @@ signatário no navegador. Consulte os [ramos de assinatura](docs/README.md#ramos
|
|
|
110
113
|
|
|
111
114
|
| Recurso | Área |
|
|
112
115
|
| --- | --- |
|
|
113
|
-
| `client.documents` | Upload, consulta, artefatos, tags e criação por template |
|
|
116
|
+
| `client.documents` | Upload, consulta, artefatos, tags, observadores, cancelamento e criação por template |
|
|
114
117
|
| `client.signers` | Cadastro, busca e atualização de signatários |
|
|
115
118
|
| `client.assignments` | Solicitações, custos, notificações e revisão de identidade |
|
|
116
119
|
| `client.envelopes` | Vários documentos aos mesmos signatários, um convite e uma cobrança |
|
|
117
120
|
| `client.embed` | Origens e sessões de uso único para assinar dentro do seu app |
|
|
121
|
+
| `client.scheduledSends` | Assignments e envelopes agendados |
|
|
118
122
|
| `client.contracts` | Termos, famílias, renovação e encerramento de contratos |
|
|
119
123
|
| `client.templates`, `client.tags`, `client.fields` | Conteúdo reutilizável e campos |
|
|
120
|
-
| `client.workspaces`, `client.users` | Workspace, tema, uso do plano, política de notificações
|
|
121
|
-
| `client.
|
|
124
|
+
| `client.workspaces`, `client.users` | Workspace, tema, uso do plano, política de notificações e preferências |
|
|
125
|
+
| `client.oauth` | Autorização OAuth 2.1, tokens e dados do usuário |
|
|
122
126
|
| `client.webhooks`, `client.webhookVerifier` | Endpoints, entregas e autenticação de eventos |
|
|
123
127
|
| `client.signerDocuments` | Fluxo público e autenticado do signatário |
|
|
124
128
|
|
|
@@ -131,7 +135,7 @@ com o pacote documentam os payloads completos.
|
|
|
131
135
|
- [Manual completo em português](docs/README.md)
|
|
132
136
|
- [Complete manual in English](docs/README.en.md)
|
|
133
137
|
- [Cobertura da API](docs/API_COVERAGE.md)
|
|
134
|
-
- [
|
|
138
|
+
- [Notas de compatibilidade](docs/COMPATIBILITY.md)
|
|
135
139
|
- [Processo de release](docs/RELEASING.md)
|
|
136
140
|
- [Documentação oficial da API](https://api.assinafy.com.br/v1/docs)
|
|
137
141
|
|
package/SECURITY.md
CHANGED
|
@@ -2,22 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
## Supported releases
|
|
4
4
|
|
|
5
|
-
Security fixes are developed on the
|
|
5
|
+
Security fixes are developed on the default branch and released on
|
|
6
6
|
the current supported major. Unless a separate support agreement states
|
|
7
7
|
otherwise, users should run the latest published patch. Older majors and
|
|
8
8
|
superseded minor releases may not receive fixes.
|
|
9
9
|
|
|
10
10
|
## Reporting a vulnerability
|
|
11
11
|
|
|
12
|
-
Do not disclose a suspected vulnerability in a public issue, discussion,
|
|
12
|
+
Do not disclose a suspected vulnerability in a public issue, discussion, pull
|
|
13
13
|
request, commit message, or CI log.
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
details.
|
|
15
|
+
Report it through the repository's private vulnerability reporting: on GitHub,
|
|
16
|
+
**Security → Report a vulnerability**. Verify that the report is private before
|
|
17
|
+
adding sensitive details. If private reporting is not available, open a public
|
|
18
|
+
issue that asks maintainers for a private contact method and include no
|
|
19
|
+
vulnerability details.
|
|
21
20
|
|
|
22
21
|
Provide:
|
|
23
22
|
|
|
@@ -69,12 +68,15 @@ opportunity to upgrade.
|
|
|
69
68
|
JSON only after verification. The default five-minute timestamp tolerance
|
|
70
69
|
blocks replayed deliveries; keep the receiver clock synchronized. Rotate the
|
|
71
70
|
secret with `webhooks.rotateEndpointSecret()` when it may have leaked —
|
|
72
|
-
rotation is immediate
|
|
73
|
-
|
|
71
|
+
rotation is immediate by default. Readback requires an API key; OAuth
|
|
72
|
+
applications with `webhooks:write` can rotate and receive the new secret.
|
|
73
|
+
For planned rotation, `{ keep_previous: true }` signs with both secrets for
|
|
74
|
+
24 hours; omit it when the previous secret may be compromised. See `docs/COMPATIBILITY.md`.
|
|
74
75
|
- Dependency changes must keep `bun.lock` synchronized and pass `bun run audit`.
|
|
75
76
|
GitHub Actions are pinned to immutable commit SHAs and updated through
|
|
76
77
|
Dependabot review.
|
|
77
|
-
-
|
|
78
|
-
mutation tests belong only in dedicated, disposable
|
|
78
|
+
- Test credentials and fixtures must never be reused for a customer workspace.
|
|
79
|
+
Live mutation tests belong only in a dedicated, disposable test workspace and
|
|
80
|
+
never use real customer data.
|
|
79
81
|
|
|
80
82
|
For general defects without a security impact, use the normal issue tracker.
|