@assinafy/cli 2.2.0 → 2.4.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/README.en.md +2 -1
- package/README.md +2 -2
- package/dist/api.cjs +19 -6
- package/dist/api.cjs.map +1 -1
- package/dist/api.js +19 -6
- package/dist/api.js.map +1 -1
- package/dist/cli.cjs +55 -20
- package/dist/types/api/resources/assignments.d.ts +0 -1
- package/dist/types/api/resources/assignments.d.ts.map +1 -1
- package/dist/types/api/resources/oauth.d.ts +4 -1
- package/dist/types/api/resources/oauth.d.ts.map +1 -1
- package/dist/types/api/types.d.ts +9 -3
- package/dist/types/api/types.d.ts.map +1 -1
- package/docs/api-operations.json +2 -2
- package/docs/api-reference.md +40 -18
- package/docs/oauth-guide.md +23 -14
- package/docs/oauth.md +4 -4
- package/docs/sdk-reference.md +2 -2
- package/package.json +1 -1
package/dist/api.js
CHANGED
|
@@ -359,7 +359,7 @@ function buildAssignmentPayload(payload, options = {}) {
|
|
|
359
359
|
throw new ValidationError("method must be virtual or collect");
|
|
360
360
|
}
|
|
361
361
|
const signers = extractSignerRefs(payload);
|
|
362
|
-
if (signers.length === 0
|
|
362
|
+
if (signers.length === 0) {
|
|
363
363
|
throw new ValidationError("At least one signer is required", {
|
|
364
364
|
signers: payload.signers ?? payload.signer_ids ?? payload.signerIds
|
|
365
365
|
});
|
|
@@ -459,7 +459,6 @@ var AssignmentResource = class extends BaseResource {
|
|
|
459
459
|
`/documents/${docId}/assignments/estimate-cost`,
|
|
460
460
|
buildAssignmentPayload(payload, {
|
|
461
461
|
allowSignersWithoutId: true,
|
|
462
|
-
allowEmptySigners: true,
|
|
463
462
|
skipDigitalCertificateStepValidation: true
|
|
464
463
|
})
|
|
465
464
|
)
|
|
@@ -1138,6 +1137,9 @@ function validationConfig(signerAccessCode) {
|
|
|
1138
1137
|
|
|
1139
1138
|
// src/api/resources/oauth.ts
|
|
1140
1139
|
import { createHash, randomBytes, timingSafeEqual } from "crypto";
|
|
1140
|
+
var formRequestConfig = publicRequestConfig({
|
|
1141
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" }
|
|
1142
|
+
});
|
|
1141
1143
|
var OAuthResource = class extends BaseResource {
|
|
1142
1144
|
/** `GET /.well-known/oauth-protected-resource` at the API origin, outside `/v1`. */
|
|
1143
1145
|
async metadata() {
|
|
@@ -1250,7 +1252,10 @@ var OAuthResource = class extends BaseResource {
|
|
|
1250
1252
|
resource: request.resource
|
|
1251
1253
|
});
|
|
1252
1254
|
}
|
|
1253
|
-
/**
|
|
1255
|
+
/**
|
|
1256
|
+
* `POST /oauth/token` — code exchange or refresh; returns the flat OAuth JSON body.
|
|
1257
|
+
* A refresh must return a new `refresh_token`; otherwise this throws `ValidationError`.
|
|
1258
|
+
*/
|
|
1254
1259
|
async token(payload) {
|
|
1255
1260
|
required(payload.client_id, "client_id");
|
|
1256
1261
|
if (payload.client_secret !== void 0) required(payload.client_secret, "client_secret");
|
|
@@ -1268,10 +1273,18 @@ var OAuthResource = class extends BaseResource {
|
|
|
1268
1273
|
} else {
|
|
1269
1274
|
throw new ValidationError("grant_type must be authorization_code or refresh_token");
|
|
1270
1275
|
}
|
|
1271
|
-
|
|
1276
|
+
const tokens = await this.call(
|
|
1272
1277
|
"OAuth token request failed",
|
|
1273
|
-
() => this.http.post("/oauth/token", payload,
|
|
1278
|
+
() => this.http.post("/oauth/token", payload, formRequestConfig)
|
|
1274
1279
|
);
|
|
1280
|
+
const next = tokens?.refresh_token;
|
|
1281
|
+
if (payload.grant_type === "refresh_token" && (typeof next !== "string" || !next.trim() || next === payload.refresh_token)) {
|
|
1282
|
+
throw new ValidationError(
|
|
1283
|
+
"OAuth refresh response has no new refresh_token; the submitted refresh token may already be retired, so do not reuse it: reconnect instead",
|
|
1284
|
+
{ field: "refresh_token" }
|
|
1285
|
+
);
|
|
1286
|
+
}
|
|
1287
|
+
return tokens;
|
|
1275
1288
|
}
|
|
1276
1289
|
/** `POST /oauth/revoke` — revoke an access/refresh token; success has no required body. */
|
|
1277
1290
|
async revoke(payload) {
|
|
@@ -1283,7 +1296,7 @@ var OAuthResource = class extends BaseResource {
|
|
|
1283
1296
|
}
|
|
1284
1297
|
await this.call(
|
|
1285
1298
|
"OAuth revocation failed",
|
|
1286
|
-
() => this.http.post("/oauth/revoke", payload,
|
|
1299
|
+
() => this.http.post("/oauth/revoke", payload, formRequestConfig)
|
|
1287
1300
|
);
|
|
1288
1301
|
}
|
|
1289
1302
|
/** `GET /oauth/userinfo` — flat OIDC claims; requires a bearer token with `openid`. */
|