@assinafy/sdk 2.5.1 → 2.5.2

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: 71 paths, 93 HTTP operations, and 39 component
5
+ contract to the public SDK API: 71 paths, 93 HTTP operations, and 41 component
6
6
  schemas.
7
7
 
8
8
  All paths below include the `/v1` prefix shown by the OpenAPI document, except
@@ -58,7 +58,7 @@ method counters. Notification counters are not mutually exclusive.
58
58
  are mutually exclusive and sum to `signature_requests`. Older unsuffixed email
59
59
  and WhatsApp counters remain optional.
60
60
 
61
- ## OAuth spans two hosts, and sandbox discovery is unreachable
61
+ ## OAuth uses separate API and authorization hosts
62
62
 
63
63
  The flow deliberately spans two hosts, which no other part of this SDK does:
64
64
 
@@ -77,32 +77,26 @@ base URL's **origin**, not from `baseUrl` itself, and
77
77
  credential-free transport.
78
78
 
79
79
  The sandbox has its own authorization server at
80
- `https://auth-sandbox.assinafy.com.br`, whose `/oauth/authorize` consent screen
81
- is live. Its discovery documents, however, cannot be fetched: nginx on the
82
- sandbox hosts rejects **any** path beginning with a dot — `/.anything` answers
83
- `403` while `/anything` answers `404` — so `/.well-known/…` never reaches the
84
- application. Skip discovery there by naming the endpoints explicitly; both
85
- `createAuthorizationUrl` options exist for exactly this case:
80
+ `https://auth-sandbox.assinafy.com.br`, with the consent screen at
81
+ `/oauth/authorize`. Both discovery documents are available, and its OpenAPI
82
+ contract includes the token, revocation and userinfo routes. Discover the
83
+ sandbox issuer from its API origin:
86
84
 
87
85
  ```ts
88
86
  const client = new AssinafyClient({ baseUrl: 'https://sandbox.assinafy.com.br/v1' });
89
-
87
+ const metadata = await client.oauth.getAuthorizationServerMetadata();
90
88
  const request = await client.oauth.createAuthorizationUrl({
91
89
  clientId: process.env.ASSINAFY_CLIENT_ID!,
92
90
  redirectUri: 'https://myapp.example.com/oauth/callback',
93
- scopes: ['documents:read'],
94
- issuer: 'https://auth-sandbox.assinafy.com.br',
95
- authorizationEndpoint: 'https://auth-sandbox.assinafy.com.br/oauth/authorize',
91
+ scopes: ['documents:read', 'account:read', 'offline_access'],
96
92
  });
97
93
  ```
98
94
 
99
- The token, revocation and userinfo endpoints are resolved against the
100
- configured `baseUrl`, so they follow whichever host the client points at.
101
- Confirm the sandbox deployment exposes them before running the exchange leg
102
- there: at the time of writing its OpenAPI document publishes 67 paths and does
103
- not list `/v1/oauth/…`, while production publishes 71 and does. A `404` from
104
- this API is byte-identical for a bad id and for a route that does not exist, so
105
- it is never on its own proof that a route is missing.
95
+ Register the application in the matching environment. Production and sandbox
96
+ use different issuers, clients, credentials and workspace IDs; keep the entire
97
+ connection in one environment. Token, revocation and userinfo requests use the
98
+ configured `baseUrl`. Use a temporary HTTPS tunnel for local callbacks and
99
+ register its exact callback URL before starting the connection.
106
100
 
107
101
  Response shapes diverge from the rest of the API on purpose:
108
102
 
@@ -113,9 +107,9 @@ Response shapes diverge from the rest of the API on purpose:
113
107
  | `GET /oauth/userinfo` | flat claims object (OIDC Core §5.3.2) | the usual `{ status, message, data }` envelope |
114
108
 
115
109
  Both JSON and `application/x-www-form-urlencoded` bodies are accepted by the
116
- token and revocation endpoints. The published `requestBody` lists only JSON,
117
- but the SDK sends `application/x-www-form-urlencoded`: the encoding RFC 6749
118
- and RFC 7009 define and the OAuth Integration Guide uses.
110
+ token and revocation endpoints, and the production OpenAPI document lists both.
111
+ The SDK sends `application/x-www-form-urlencoded`: the encoding RFC 6749 and
112
+ RFC 7009 define and the OAuth Integration Guide uses.
119
113
 
120
114
  The RFC 8707 `resource` indicator defaults to the configured API origin, and is
121
115
  omitted when that origin is a loopback `http://` host — the shape used by mock
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@assinafy/sdk",
3
- "version": "2.5.1",
3
+ "version": "2.5.2",
4
4
  "packageManager": "bun@1.4.0",
5
5
  "description": "TypeScript SDK for Assinafy API - Digital signature platform",
6
6
  "type": "commonjs",
@@ -81,7 +81,7 @@
81
81
  },
82
82
  "overrides": {
83
83
  "esbuild": "0.28.2",
84
- "brace-expansion": "5.0.9"
84
+ "brace-expansion": "5.0.12"
85
85
  },
86
86
  "files": [
87
87
  "dist",