@assinafy/sdk 2.1.1 → 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/CHANGELOG.md +99 -1
- package/README.md +601 -117
- package/SECURITY.md +4 -2
- package/dist/index.d.mts +697 -316
- package/dist/index.d.ts +697 -316
- package/dist/index.js +3102 -1938
- package/dist/index.mjs +3100 -1938
- package/docs/API_COVERAGE.md +28 -30
- package/docs/COMPATIBILITY.md +279 -179
- package/docs/RELEASING.md +42 -11
- package/package.json +10 -9
package/docs/COMPATIBILITY.md
CHANGED
|
@@ -1,27 +1,113 @@
|
|
|
1
1
|
# API compatibility
|
|
2
2
|
|
|
3
3
|
The SDK targets the official Assinafy contract at
|
|
4
|
-
[`/v1/docs/openapi.json`](https://api.assinafy.com.br/v1/docs/openapi.json)
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
artifacts. The audited OpenAPI response's SHA-256 digest is
|
|
9
|
-
`7e5957082002e8e96c5abc2cadf7b4b463eaa5bd61b76e26f64b90a8b922088c`.
|
|
4
|
+
[`/v1/docs/openapi.json`](https://api.assinafy.com.br/v1/docs/openapi.json).
|
|
5
|
+
New integrations should send the published request shape. Compatibility paths
|
|
6
|
+
are narrow, typed, and used only when a caller selects one or when a validation
|
|
7
|
+
response unambiguously requests an older shape.
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
contract. A compatibility path is used only when the caller selects it
|
|
13
|
-
explicitly or the server returns a validation error that unambiguously requests
|
|
14
|
-
the older shape.
|
|
9
|
+
## Host availability
|
|
15
10
|
|
|
16
|
-
|
|
11
|
+
The production contract includes these account and authenticated-user routes:
|
|
17
12
|
|
|
18
|
-
|
|
13
|
+
```text
|
|
14
|
+
GET, POST /v1/accounts
|
|
15
|
+
GET, PUT, DELETE /v1/accounts/{accountId}
|
|
16
|
+
GET, POST, DELETE /v1/accounts/{accountId}/logo
|
|
17
|
+
GET /v1/accounts/{accountId}/theme
|
|
18
|
+
GET /v1/accounts/{accountId}/stats
|
|
19
|
+
GET /v1/users/self
|
|
20
|
+
GET, PUT /v1/users/self/notification-preferences
|
|
21
|
+
GET /v1/users/self/stats
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Sandbox deployments can return `404` for user statistics, account statistics,
|
|
25
|
+
or notification preferences while still accepting the production methods on
|
|
26
|
+
the production host. The SDK keeps the official paths and response types. A
|
|
27
|
+
sandbox `404` does not cause the client to route a request elsewhere.
|
|
28
|
+
|
|
29
|
+
Two browser URL helpers used by older deployments remain available:
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
GET /v1/auth/authenticate
|
|
33
|
+
GET /v1/login-callback
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
They map to `auth.getSocialLoginUrl()` and
|
|
37
|
+
`auth.getSocialLoginCallbackUrl()` and are not part of the official
|
|
38
|
+
89-operation total.
|
|
39
|
+
|
|
40
|
+
The SDK also includes the production contract additions for:
|
|
41
|
+
|
|
42
|
+
- the `pades` document artifact;
|
|
43
|
+
- `DigitalCertificate` verification on assignment and template-document
|
|
44
|
+
creation and cost estimation;
|
|
45
|
+
- typed `display_settings` for collect fields;
|
|
46
|
+
- signer `government_id` updates;
|
|
47
|
+
- signature-image `reuse`;
|
|
48
|
+
- the documented `400` response from `GET /sign`; and
|
|
49
|
+
- the dedicated `SignerSelf` response fields.
|
|
50
|
+
|
|
51
|
+
Older signer-self responses can omit `has_signature`, `has_initial`, and
|
|
52
|
+
`is_signature_reusable`; assignment signers can omit `notification_history`.
|
|
53
|
+
Those fields are optional in the SDK response types.
|
|
54
|
+
|
|
55
|
+
`DocumentStatsRow` separates notification-channel counters from verification
|
|
56
|
+
method counters. Notification counters are not mutually exclusive.
|
|
57
|
+
`signature_requests_verification_{email,whatsapp,bypass,digital_certificate}`
|
|
58
|
+
are mutually exclusive and sum to `signature_requests`. Older unsuffixed email
|
|
59
|
+
and WhatsApp counters remain optional.
|
|
60
|
+
|
|
61
|
+
## List pagination
|
|
62
|
+
|
|
63
|
+
Two behaviours of the list endpoints are silent rather than loud, so neither
|
|
64
|
+
surfaces as an error a caller could react to:
|
|
65
|
+
|
|
66
|
+
- Only the hyphenated `per-page` is read. `per_page` is accepted and discarded,
|
|
67
|
+
and the response falls back to the default of 20 rows. The SDK normalizes
|
|
68
|
+
`per_page` to `per-page` on every list method, and an explicit `per-page`
|
|
69
|
+
wins if both are supplied.
|
|
70
|
+
- `per-page` is clamped to **50**. A request for 100 returns 50 rows with a
|
|
71
|
+
`200`, so page-size arithmetic based on the requested value is wrong by half.
|
|
72
|
+
That maximum is exported as `MAX_LIST_PAGE_SIZE`.
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
import { MAX_LIST_PAGE_SIZE } from '@assinafy/sdk';
|
|
76
|
+
|
|
77
|
+
const { data, meta } = await client.documents.list({ 'per-page': MAX_LIST_PAGE_SIZE });
|
|
78
|
+
// meta is read from the X-Pagination-* response headers, so it reports the
|
|
79
|
+
// page size the server actually applied — prefer it over the requested value.
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
`signers.findByEmail()` pins this maximum for its single lookup request.
|
|
83
|
+
|
|
84
|
+
## Assignment list account context
|
|
85
|
+
|
|
86
|
+
`GET /v1/assignments` requires the workspace in the camel-case `accountId`
|
|
87
|
+
query parameter even though most account-scoped routes place it in the path.
|
|
88
|
+
The SDK obtains it from the optional method argument or the client default:
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
const page = await client.assignments.list(
|
|
92
|
+
{ page: 1, 'per-page': 20 },
|
|
93
|
+
'account-id',
|
|
94
|
+
);
|
|
95
|
+
// Request query: ?page=1&per-page=20&accountId=account-id
|
|
96
|
+
// Response: { data: IAssignment[], meta?: PaginationMeta }
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
If neither source supplies an account ID, the SDK throws `ValidationError`
|
|
100
|
+
before making the request.
|
|
101
|
+
|
|
102
|
+
## Template management extensions
|
|
103
|
+
|
|
104
|
+
The official OpenAPI document contains only:
|
|
19
105
|
|
|
20
106
|
```text
|
|
21
107
|
GET /v1/accounts/{accountId}/templates
|
|
22
108
|
```
|
|
23
109
|
|
|
24
|
-
|
|
110
|
+
Existing integrations can also use these routes:
|
|
25
111
|
|
|
26
112
|
```text
|
|
27
113
|
POST /v1/accounts/{accountId}/templates
|
|
@@ -31,16 +117,9 @@ DELETE /v1/accounts/{accountId}/templates/{templateId}
|
|
|
31
117
|
GET /v1/accounts/{accountId}/templates/{templateId}/pages/{pageId}/download
|
|
32
118
|
```
|
|
33
119
|
|
|
34
|
-
They map to `
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
future schema is not by itself grounds for removal; removal requires a live
|
|
38
|
-
regression test, a deprecation period, and a major-version decision.
|
|
39
|
-
|
|
40
|
-
Template status examples have also differed in casing (`Uploaded`/`Ready` in
|
|
41
|
-
live extension responses versus `uploaded`/`ready` in the published schema).
|
|
42
|
-
The exported type intentionally remains `string`. Applications should normalize
|
|
43
|
-
before comparing:
|
|
120
|
+
They map to `templates.create`, `get`, `update`, `delete`, and `downloadPage`
|
|
121
|
+
and are excluded from the official operation count. Template status casing can
|
|
122
|
+
vary, so normalize before branching:
|
|
44
123
|
|
|
45
124
|
```ts
|
|
46
125
|
if (template.status.toLowerCase() === 'ready') {
|
|
@@ -48,9 +127,13 @@ if (template.status.toLowerCase() === 'ready') {
|
|
|
48
127
|
}
|
|
49
128
|
```
|
|
50
129
|
|
|
130
|
+
A page object's `download_url` is protected by account authentication. Prefer
|
|
131
|
+
`templates.downloadPage(templateId, pageId)` so the SDK attaches credentials
|
|
132
|
+
and returns the JPEG bytes as a `Buffer`.
|
|
133
|
+
|
|
51
134
|
## Public send-token request
|
|
52
135
|
|
|
53
|
-
The official operation
|
|
136
|
+
The official operation sends an email body:
|
|
54
137
|
|
|
55
138
|
```http
|
|
56
139
|
PUT /v1/public/documents/{documentId}/send-token
|
|
@@ -59,13 +142,11 @@ Content-Type: application/json
|
|
|
59
142
|
{ "email": "signer@example.com" }
|
|
60
143
|
```
|
|
61
144
|
|
|
62
|
-
That is the default SDK call:
|
|
63
|
-
|
|
64
145
|
```ts
|
|
65
146
|
await client.documents.sendToken(documentId, 'signer@example.com');
|
|
66
147
|
```
|
|
67
148
|
|
|
68
|
-
|
|
149
|
+
Older environments can require `{ recipient, channel }`. The explicit
|
|
69
150
|
three-argument overload sends that shape:
|
|
70
151
|
|
|
71
152
|
```ts
|
|
@@ -73,121 +154,142 @@ await client.documents.sendToken(documentId, '+5511999990000', 'whatsapp');
|
|
|
73
154
|
```
|
|
74
155
|
|
|
75
156
|
For a two-argument call, the SDK starts with `{ email }` and retries the older
|
|
76
|
-
email shape only when the
|
|
77
|
-
|
|
78
|
-
retried under this compatibility rule.
|
|
157
|
+
email shape only when the validation response names `recipient` or `channel` as
|
|
158
|
+
required. Other errors are returned unchanged.
|
|
79
159
|
|
|
80
|
-
## Document
|
|
160
|
+
## Document tags
|
|
81
161
|
|
|
82
|
-
|
|
83
|
-
define `tags` as an array of existing **tag IDs**. The SDK follows that contract:
|
|
162
|
+
Replace and attach requests require existing tag IDs:
|
|
84
163
|
|
|
85
164
|
```ts
|
|
86
|
-
const tag = await client.tags.create({ name: 'Contracts' });
|
|
165
|
+
const tag = await client.tags.create({ name: 'Contracts', color: '#ff8800' });
|
|
87
166
|
await client.documents.addTags(documentId, [tag.id]);
|
|
88
167
|
await client.documents.replaceTags(documentId, [tag.id]);
|
|
168
|
+
const result = await client.documents.detachTag(documentId, tag.id);
|
|
169
|
+
// result → { detached: true }
|
|
89
170
|
```
|
|
90
171
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
attachment
|
|
94
|
-
|
|
172
|
+
The API accepts a tag color with or without a leading `#` and returns the
|
|
173
|
+
stored six-character value without it. Unknown tag names are not the normal
|
|
174
|
+
attachment input; create or list the tag first and send its ID. An empty array
|
|
175
|
+
passed to `replaceTags` detaches every tag.
|
|
95
176
|
|
|
96
|
-
## Account branding fields
|
|
177
|
+
## Account branding fields
|
|
97
178
|
|
|
98
|
-
The official
|
|
99
|
-
`
|
|
100
|
-
`
|
|
101
|
-
|
|
102
|
-
|
|
179
|
+
The official account create/update request schemas define `name` and
|
|
180
|
+
`notification_sender_type`. The response includes `primary_color` and
|
|
181
|
+
`secondary_color`. Some deployments also accept those two color fields on
|
|
182
|
+
create/update, so the SDK retains them as optional inputs. Account colors must
|
|
183
|
+
be six hexadecimal characters without a leading `#`.
|
|
103
184
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
the
|
|
107
|
-
|
|
108
|
-
workspace with a name only, then tests the field independently via update so
|
|
109
|
-
the create-side deployment lag cannot prevent the rest of the suite.
|
|
185
|
+
Some sandbox plans reject `notification_sender_type` during account creation
|
|
186
|
+
while accepting it on update. If that occurs, create with `{ name }` and apply
|
|
187
|
+
the sender type in a separate update. `getTheme`, `downloadLogo`, `uploadLogo`,
|
|
188
|
+
and `deleteLogo` are official operations.
|
|
110
189
|
|
|
111
|
-
|
|
112
|
-
|
|
190
|
+
`workspaces.delete(accountId, { force: true })` requests cancellation of an
|
|
191
|
+
active paid subscription as part of account deletion. It is not a general
|
|
192
|
+
override for unrelated deletion restrictions.
|
|
113
193
|
|
|
114
|
-
## Field-definition
|
|
194
|
+
## Field-definition extensions
|
|
115
195
|
|
|
116
196
|
The official field-create body defines `type`, `name`, nullable `regex`, and
|
|
117
|
-
`is_required`;
|
|
118
|
-
`is_active
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
the operation-specific official fields.
|
|
197
|
+
`is_required`; update defines `name`, nullable `regex`, and `is_active`. The SDK
|
|
198
|
+
also retains `is_active` on create and `type` or `is_required` on update for
|
|
199
|
+
deployments that accept them. New code should prefer the operation-specific
|
|
200
|
+
official fields.
|
|
122
201
|
|
|
123
|
-
The field-validation schemas
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
full audit exercised account-authenticated validation; it did not have the
|
|
127
|
-
signer-code fixture needed to re-certify this compatibility query.
|
|
202
|
+
The field-validation schemas omit the `signer-access-code` query parameter used
|
|
203
|
+
by some signer portals. `fields.validate()` and `validateMultiple()` retain the
|
|
204
|
+
typed `signerAccessCode` option for those environments.
|
|
128
205
|
|
|
129
|
-
##
|
|
206
|
+
## Signer request extensions
|
|
130
207
|
|
|
131
|
-
The
|
|
132
|
-
`whatsapp_phone_number`.
|
|
208
|
+
The official signer-create schema uses `full_name`, `email`, and
|
|
209
|
+
`whatsapp_phone_number`. Signer update adds `government_id`, which the SDK
|
|
210
|
+
normalizes to digits. Three older integration inputs remain accepted:
|
|
133
211
|
|
|
134
|
-
- `phone` is
|
|
135
|
-
transmission;
|
|
212
|
+
- `phone` is normalized to `whatsapp_phone_number` before transmission;
|
|
136
213
|
- `cpf` is normalized to digits and forwarded; and
|
|
137
214
|
- create-time `metadata` is forwarded unchanged.
|
|
138
215
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
`
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
216
|
+
New integrations should use the official create fields and `government_id` on
|
|
217
|
+
update. `cpf` is not an alias for the official update field, and signer
|
|
218
|
+
responses do not return it.
|
|
219
|
+
|
|
220
|
+
## Digital certificate and collect placement
|
|
221
|
+
|
|
222
|
+
`DigitalCertificate` requires the account feature, a CPF or CNPJ stored in the
|
|
223
|
+
signer's `government_id`, and exactly one certificate signer in that signing
|
|
224
|
+
step. It costs two credits per signer in addition to the selected notification
|
|
225
|
+
cost. Notification methods remain `Email` and `Whatsapp`.
|
|
226
|
+
|
|
227
|
+
For a `collect` assignment, each field can include `display_settings`.
|
|
228
|
+
`left`, `top`, `width`, `height`, and `fontSize` are required; `fontFamily` and
|
|
229
|
+
`backgroundColor` are optional. Values use Assinafy's 150-DPI page-image pixels
|
|
230
|
+
from the upper-left corner and must stay within the page.
|
|
231
|
+
|
|
232
|
+
## Document responses and artifacts
|
|
233
|
+
|
|
234
|
+
`documents.rename()` can return a document without `pages` or `assignment`.
|
|
235
|
+
`IRenameDocumentResponse` therefore keeps those two properties optional while
|
|
236
|
+
retaining the other document fields.
|
|
237
|
+
|
|
238
|
+
`documents.details()` returns `decline_reason` only when the access token
|
|
239
|
+
belongs to the document creator. Do not infer the absence of a decline merely
|
|
240
|
+
because that field is missing for another authenticated user.
|
|
241
|
+
|
|
242
|
+
Owner and signer downloads accept `original`, `certificated`,
|
|
243
|
+
`certificate-page`, `pades`, and `bundle`:
|
|
244
|
+
|
|
245
|
+
- `pades` exists only when the document had an ICP-Brasil certificate signer;
|
|
246
|
+
- `bundle` is a ZIP containing `original`, `certificated`, and
|
|
247
|
+
`certificate-page`, plus `pades` when it exists; and
|
|
248
|
+
- a generated artifact can return `404` until processing or certification is
|
|
249
|
+
complete.
|
|
250
|
+
|
|
251
|
+
Document and page download URLs in JSON responses are protected. Prefer the
|
|
252
|
+
typed download methods so credentials are applied and binary data is returned
|
|
253
|
+
as a `Buffer`.
|
|
254
|
+
|
|
255
|
+
## Signer-side preconditions
|
|
256
|
+
|
|
257
|
+
The signer `confirm-data` body contains `full_name`, `email`,
|
|
258
|
+
`government_id`, and `has_accepted_terms`. A certificate signer must confirm
|
|
259
|
+
data and accept terms before `getAssignment()`; either send
|
|
260
|
+
`has_accepted_terms: true` with `confirmData()` or call `acceptTerms()` first.
|
|
261
|
+
The `has_accepted_terms` query on `getAssignment()` is too late to open that
|
|
262
|
+
gate for a certificate signer.
|
|
263
|
+
|
|
264
|
+
`getAssignment()` uses `GET /sign`, but the API records the signer as having
|
|
265
|
+
viewed the assignment. The SDK therefore excludes this request from automatic
|
|
266
|
+
HTTP 429 replay.
|
|
267
|
+
|
|
268
|
+
`sign()` sends a non-empty array of `{ itemId, fieldId, pageId, value }` and is
|
|
269
|
+
intended for collect assignments. A virtual signer must confirm their data
|
|
270
|
+
before signing and should use `signMultiple()`, which accepts only virtual
|
|
271
|
+
documents. Certificate signers cannot use `sign()`; they complete the
|
|
272
|
+
certificate-start and certificate-complete browser flow.
|
|
273
|
+
|
|
274
|
+
Signature image upload sends raw PNG bytes with `Content-Type: image/png`.
|
|
275
|
+
`reuse: true` persists the image for later documents. A deprecated
|
|
276
|
+
`contentType` option remains for older integrations, but the official contract
|
|
277
|
+
supports PNG only.
|
|
278
|
+
|
|
279
|
+
## Upload metadata and expiration reset
|
|
280
|
+
|
|
281
|
+
Document upload accepts a PDF of at most 25 MB and 2,000 pages. The multipart
|
|
282
|
+
schema documents the file; the SDK's optional `metadata` JSON part is retained
|
|
283
|
+
for deployments that accept application-owned opaque metadata.
|
|
284
|
+
|
|
285
|
+
The reset-expiration schema requires an ISO-8601 date-time string. The SDK also
|
|
286
|
+
accepts `null` for older integrations that clear an expiration this way. Confirm
|
|
287
|
+
support in the target deployment before sending `null`.
|
|
183
288
|
|
|
184
289
|
## Resend-cost response variants
|
|
185
290
|
|
|
186
|
-
The
|
|
187
|
-
|
|
188
|
-
response references the full `CostEstimate` schema. A smaller resend-specific
|
|
189
|
-
shape has also been observed live. The SDK therefore returns the honest union
|
|
190
|
-
`IResendCostEstimate`:
|
|
291
|
+
The official resend-cost response is `ICostEstimate`. Older deployments can
|
|
292
|
+
return a compact branch, so the SDK exposes `IResendCostEstimate`:
|
|
191
293
|
|
|
192
294
|
```ts
|
|
193
295
|
const estimate = await client.assignments.estimateResendCost(
|
|
@@ -203,83 +305,81 @@ if ('total_credits' in estimate) {
|
|
|
203
305
|
}
|
|
204
306
|
```
|
|
205
307
|
|
|
206
|
-
The SDK does not
|
|
207
|
-
zeroes for server-provided balances.
|
|
308
|
+
The SDK does not add absent balance fields.
|
|
208
309
|
|
|
209
|
-
## Public
|
|
310
|
+
## Public document and signer download
|
|
210
311
|
|
|
211
|
-
The official
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
and retains the compact fields. Check optional fields before using them:
|
|
312
|
+
The official public-document response is the full `Document` schema. Compact
|
|
313
|
+
responses can contain only `id`, `name`, `page_count`, and `created_by`.
|
|
314
|
+
`IPublicDocumentInfo` requires `id` and `name`, keeps expanded fields optional,
|
|
315
|
+
and retains the compact fields:
|
|
216
316
|
|
|
217
317
|
```ts
|
|
218
318
|
const document = await client.documents.getPublic(documentId);
|
|
219
|
-
|
|
220
|
-
console.log(document.pages.length);
|
|
221
|
-
} else {
|
|
222
|
-
console.log(Number(document.page_count ?? 0));
|
|
223
|
-
}
|
|
319
|
+
const pages = document.pages?.length ?? Number(document.page_count ?? 0);
|
|
224
320
|
```
|
|
225
321
|
|
|
322
|
+
Signer artifact download is public in the OpenAPI document and requires no
|
|
323
|
+
access-code query in the official three-argument call. An optional fourth code
|
|
324
|
+
is available only for older deployments that require it.
|
|
325
|
+
|
|
226
326
|
## Empty acknowledgements
|
|
227
327
|
|
|
228
|
-
Several write operations return a
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
328
|
+
Several write operations return a success envelope without `data`; older
|
|
329
|
+
responses can use an empty array or object. Methods with no meaningful result
|
|
330
|
+
resolve to `Promise<void>` after validating the HTTP and envelope status. This
|
|
331
|
+
applies to token dispatch, signer OTP and terms, signature-image upload, bulk
|
|
332
|
+
signer actions, and deletions without a documented result. Tag deletion and
|
|
333
|
+
document-tag detachment preserve `{ deleted: boolean }` and
|
|
334
|
+
`{ detached: boolean }`.
|
|
335
|
+
|
|
336
|
+
## WhatsApp notification buttons
|
|
337
|
+
|
|
338
|
+
The published notification button schema requires `text`. Some deployments
|
|
339
|
+
also return `url`, so the SDK types it as optional. A button URL can contain a
|
|
340
|
+
signer access or verification value; treat it as a credential and never log it.
|
|
341
|
+
|
|
342
|
+
## Webhook delivery
|
|
343
|
+
|
|
344
|
+
Assinafy sends webhook events as HTTP `POST` JSON requests with
|
|
345
|
+
`Connection: close`. Any `2xx` is successful. There are at most two automatic
|
|
346
|
+
attempts per event with a three-second wait. After ten consecutive failed
|
|
347
|
+
events, ordinary delivery pauses and about 5% of later events are attempted
|
|
348
|
+
until one succeeds. `webhooks.retryDispatch()` requests immediate redelivery.
|
|
349
|
+
Only the first 2,000 characters of the receiver response body are retained in
|
|
350
|
+
dispatch history.
|
|
351
|
+
|
|
352
|
+
The common body contains `id`, `event`, nullable `message`, nullable `payload`,
|
|
353
|
+
nullable `origin`, Unix-second `created_at`, polymorphic `subject` and `object`,
|
|
354
|
+
and `account_id`. Use `id` for idempotent handling and accept unknown fields.
|
|
234
355
|
|
|
235
356
|
## Webhook signature verification is not in the OpenAPI contract
|
|
236
357
|
|
|
237
358
|
The official webhook operations define subscription management, event types,
|
|
238
|
-
delivery history, and retry.
|
|
239
|
-
|
|
240
|
-
for incoming deliveries.
|
|
359
|
+
delivery history, and retry. They do not define a shared-secret field,
|
|
360
|
+
signature algorithm, digest encoding, or signature header for incoming events.
|
|
241
361
|
|
|
242
|
-
`client.webhookVerifier` is
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
`X-Assinafy-Signature` header solely from this SDK.
|
|
362
|
+
`client.webhookVerifier` is an opt-in HMAC-SHA256 utility for environments whose
|
|
363
|
+
separate Assinafy agreement provides a shared secret and hex digest. Confirm the
|
|
364
|
+
header name and signing procedure for the target environment before enforcing
|
|
365
|
+
it. Do not assume an `X-Assinafy-Signature` header solely from this SDK.
|
|
247
366
|
|
|
248
367
|
## Authentication isolation
|
|
249
368
|
|
|
250
|
-
Public documents, login
|
|
369
|
+
Public documents, login and social login, password reset, OAuth URLs, and
|
|
251
370
|
signer-access-code flows use a separate HTTP transport without `X-Api-Key` or
|
|
252
|
-
`Authorization` defaults.
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
`{ user, accounts }` and
|
|
265
|
-
normalizes both forms to `IAuthenticatedUser
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
The same sandbox returns `404` for the official `GET /users/self/stats` and
|
|
269
|
-
`GET /accounts/{accountId}/stats` routes. The production host recognizes both
|
|
270
|
-
routes (an unauthenticated probe receives `401`), so the SDK retains the exact
|
|
271
|
-
published paths and types. The live audit reports those sandbox-only `404`s as
|
|
272
|
-
explicit `SKIP`s rather than claiming they passed or rewriting calls to an
|
|
273
|
-
undocumented route.
|
|
274
|
-
|
|
275
|
-
## Updating this record
|
|
276
|
-
|
|
277
|
-
When the upstream API changes:
|
|
278
|
-
|
|
279
|
-
1. Diff the new official OpenAPI paths and schemas against the snapshot date
|
|
280
|
-
above.
|
|
281
|
-
2. Add or update typed methods and request/response tests.
|
|
282
|
-
3. Verify live-only behavior in the sandbox without logging secrets or tokens.
|
|
283
|
-
4. Update [API_COVERAGE.md](API_COVERAGE.md) and this file in the same change.
|
|
284
|
-
5. Keep compatibility behavior isolated and feature-detectable; do not silently
|
|
285
|
-
broaden retries or coerce malformed success payloads.
|
|
371
|
+
`Authorization` defaults. A credentialless `new AssinafyClient()` can drive
|
|
372
|
+
those flows, and credentials configured for protected resources are not sent.
|
|
373
|
+
|
|
374
|
+
Protected methods use the authenticated transport and receive the API's normal
|
|
375
|
+
`401` response when credentials are absent or invalid. The authenticated
|
|
376
|
+
transport accepts same-origin absolute URLs, rejects cross-origin requests
|
|
377
|
+
before dispatch, and treats credentials as redirect-sensitive. Use a separate
|
|
378
|
+
HTTP client for unrelated origins.
|
|
379
|
+
|
|
380
|
+
## Authenticated-user response variants
|
|
381
|
+
|
|
382
|
+
`GET /users/self` officially returns `AuthUser` directly. Some sandbox
|
|
383
|
+
deployments return `{ user, accounts }` and add `user.is_password_set`.
|
|
384
|
+
`users.getCurrent()` normalizes both forms to `IAuthenticatedUser`, where
|
|
385
|
+
`is_password_set` is optional.
|