@assinafy/cli 2.4.1 → 2.4.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.
- package/README.en.md +13 -10
- package/README.md +11 -2
- package/dist/api.cjs +8 -1
- package/dist/api.cjs.map +1 -1
- package/dist/api.js +8 -1
- package/dist/api.js.map +1 -1
- package/dist/cli.cjs +50 -21
- package/dist/types/api/resources/oauth.d.ts.map +1 -1
- package/docs/api-operations.json +1 -1
- package/docs/api-reference.md +1 -5
- package/docs/migration-v2.md +4 -3
- package/docs/oauth-guide.md +4 -4
- package/docs/oauth.md +4 -4
- package/docs/sdk-reference.md +3 -3
- package/docs/signers.md +1 -1
- package/install.ps1 +10 -0
- package/install.sh +3 -0
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -9038,10 +9038,10 @@ var require_abort = __commonJS({
|
|
|
9038
9038
|
"use strict";
|
|
9039
9039
|
module2.exports = abort;
|
|
9040
9040
|
function abort(state) {
|
|
9041
|
-
Object.keys(state.jobs).forEach(
|
|
9041
|
+
Object.keys(state.jobs).forEach(clean.bind(state));
|
|
9042
9042
|
state.jobs = {};
|
|
9043
9043
|
}
|
|
9044
|
-
function
|
|
9044
|
+
function clean(key) {
|
|
9045
9045
|
if (typeof this.jobs[key] == "function") {
|
|
9046
9046
|
this.jobs[key]();
|
|
9047
9047
|
}
|
|
@@ -22220,7 +22220,11 @@ var FieldsResource = class extends BaseResource {
|
|
|
22220
22220
|
}
|
|
22221
22221
|
};
|
|
22222
22222
|
function validationConfig(signerAccessCode) {
|
|
22223
|
-
|
|
22223
|
+
if (signerAccessCode === void 0) return void 0;
|
|
22224
|
+
if (typeof signerAccessCode !== "string" || !signerAccessCode.trim()) {
|
|
22225
|
+
throw new ValidationError("signerAccessCode is required when supplied");
|
|
22226
|
+
}
|
|
22227
|
+
return signerAccessConfig(signerAccessCode);
|
|
22224
22228
|
}
|
|
22225
22229
|
|
|
22226
22230
|
// src/api/resources/oauth.ts
|
|
@@ -22328,6 +22332,9 @@ var OAuthResource = class extends BaseResource {
|
|
|
22328
22332
|
if (callback.searchParams.get("iss") !== request.issuer) {
|
|
22329
22333
|
throw new ValidationError("OAuth issuer mismatch");
|
|
22330
22334
|
}
|
|
22335
|
+
if (callback.searchParams.has("code") === callback.searchParams.has("error")) {
|
|
22336
|
+
throw new ValidationError("OAuth callback must contain exactly one of code or error");
|
|
22337
|
+
}
|
|
22331
22338
|
if (callback.searchParams.has("error")) {
|
|
22332
22339
|
const error = callback.searchParams.get("error");
|
|
22333
22340
|
const oauthError = error.length > 0 && error.length <= 64 && !/[^a-z_]/.test(error) ? error : "unknown_error";
|
|
@@ -23736,7 +23743,33 @@ function readConfigFile(options = {}) {
|
|
|
23736
23743
|
}
|
|
23737
23744
|
try {
|
|
23738
23745
|
const parsed = JSON.parse((0, import_node_fs3.readFileSync)(file, "utf8"));
|
|
23739
|
-
if (parsed && typeof parsed === "object" && !Array.isArray(parsed))
|
|
23746
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
23747
|
+
if (parsed.default_profile !== void 0 && typeof parsed.default_profile !== "string") {
|
|
23748
|
+
throw new Error("Invalid default_profile");
|
|
23749
|
+
}
|
|
23750
|
+
if (parsed.profiles !== void 0) {
|
|
23751
|
+
if (!parsed.profiles || typeof parsed.profiles !== "object" || Array.isArray(parsed.profiles)) {
|
|
23752
|
+
throw new Error("Invalid profiles");
|
|
23753
|
+
}
|
|
23754
|
+
for (const profile of Object.values(parsed.profiles)) {
|
|
23755
|
+
if (!profile || typeof profile !== "object" || Array.isArray(profile)) {
|
|
23756
|
+
throw new Error("Invalid profile");
|
|
23757
|
+
}
|
|
23758
|
+
for (const key of [
|
|
23759
|
+
"api_key",
|
|
23760
|
+
"token",
|
|
23761
|
+
"account_id",
|
|
23762
|
+
"base_url",
|
|
23763
|
+
"webhook_secret"
|
|
23764
|
+
]) {
|
|
23765
|
+
if (profile[key] !== void 0 && typeof profile[key] !== "string") {
|
|
23766
|
+
throw new Error("Invalid profile field");
|
|
23767
|
+
}
|
|
23768
|
+
}
|
|
23769
|
+
}
|
|
23770
|
+
}
|
|
23771
|
+
return parsed;
|
|
23772
|
+
}
|
|
23740
23773
|
if (options.strict) {
|
|
23741
23774
|
throw new CliError(`Config file at ${file} is not a JSON object; refusing to overwrite it.`);
|
|
23742
23775
|
}
|
|
@@ -23748,10 +23781,12 @@ function readConfigFile(options = {}) {
|
|
|
23748
23781
|
} catch (error) {
|
|
23749
23782
|
if (error instanceof CliError) throw error;
|
|
23750
23783
|
if (options.strict) {
|
|
23751
|
-
throw new CliError(
|
|
23784
|
+
throw new CliError(
|
|
23785
|
+
`Config file at ${file} has invalid JSON or field types; refusing to overwrite it.`
|
|
23786
|
+
);
|
|
23752
23787
|
}
|
|
23753
23788
|
process.stderr.write(
|
|
23754
|
-
`${import_picocolors3.default.yellow("!")} Config file at ${sanitizeTerminalText(file)}
|
|
23789
|
+
`${import_picocolors3.default.yellow("!")} Config file at ${sanitizeTerminalText(file)} has invalid JSON or field types; ignoring it.
|
|
23755
23790
|
`
|
|
23756
23791
|
);
|
|
23757
23792
|
return {};
|
|
@@ -23762,6 +23797,7 @@ function writeConfigFile(config) {
|
|
|
23762
23797
|
if (!(0, import_node_fs3.existsSync)(dir)) {
|
|
23763
23798
|
(0, import_node_fs3.mkdirSync)(dir, { recursive: true, mode: 448 });
|
|
23764
23799
|
}
|
|
23800
|
+
if (process.platform !== "win32") (0, import_node_fs3.chmodSync)(dir, 448);
|
|
23765
23801
|
const file = configPath();
|
|
23766
23802
|
const tmp = `${file}.${(0, import_node_crypto3.randomUUID)()}.tmp`;
|
|
23767
23803
|
try {
|
|
@@ -23784,13 +23820,13 @@ function resolveConfig2(globals) {
|
|
|
23784
23820
|
const file = readConfigFile();
|
|
23785
23821
|
const profileName = activeProfileName(globals, file);
|
|
23786
23822
|
const profile = file.profiles?.[profileName] ?? {};
|
|
23787
|
-
const pick = (flag, env, stored) => flag
|
|
23823
|
+
const pick = (flag, env, stored) => flag || env || stored || void 0;
|
|
23788
23824
|
const baseUrl = pick(globals.baseUrl, process.env.ASSINAFY_BASE_URL, profile.base_url) ?? DEFAULT_BASE_URL2;
|
|
23789
23825
|
const credentials = [
|
|
23790
23826
|
{ apiKey: globals.apiKey, token: globals.token },
|
|
23791
23827
|
{ apiKey: process.env.ASSINAFY_API_KEY, token: process.env.ASSINAFY_TOKEN },
|
|
23792
23828
|
{ apiKey: profile.api_key, token: profile.token }
|
|
23793
|
-
].find(({ apiKey, token }) => apiKey
|
|
23829
|
+
].find(({ apiKey, token }) => apiKey || token);
|
|
23794
23830
|
return {
|
|
23795
23831
|
apiKey: credentials?.apiKey,
|
|
23796
23832
|
token: credentials?.token,
|
|
@@ -25843,7 +25879,7 @@ var createFromTemplateCommand = new Command("create-from-template").description(
|
|
|
25843
25879
|
const accountId = requireAccountId(config);
|
|
25844
25880
|
const signers = parseJsonArray(opts.signers, "--signers");
|
|
25845
25881
|
const editorFields = parseJsonArray(opts.editorFields, "--editor-fields");
|
|
25846
|
-
const options =
|
|
25882
|
+
const options = stripEmpty({
|
|
25847
25883
|
name: opts.name,
|
|
25848
25884
|
message: opts.message,
|
|
25849
25885
|
expires_at: opts.expiresAt,
|
|
@@ -25972,13 +26008,6 @@ function parseSendTokenChannel(value) {
|
|
|
25972
26008
|
if (value === "email" || value === "whatsapp") return value;
|
|
25973
26009
|
throw new CliError("--channel must be email or whatsapp");
|
|
25974
26010
|
}
|
|
25975
|
-
function clean(obj) {
|
|
25976
|
-
const out = {};
|
|
25977
|
-
for (const [k, v] of Object.entries(obj)) {
|
|
25978
|
-
if (v !== void 0 && v !== null) out[k] = v;
|
|
25979
|
-
}
|
|
25980
|
-
return out;
|
|
25981
|
-
}
|
|
25982
26011
|
var documentsCommand = new Command("documents").description("Upload, list, download, and manage documents").addCommand(uploadCommand).addCommand(listCommand3).addCommand(searchCommand).addCommand(getCommand2).addCommand(renameCommand).addCommand(downloadCommand).addCommand(thumbnailCommand).addCommand(downloadPageCommand).addCommand(activitiesCommand).addCommand(deleteCommand).addCommand(tagsCommand).addCommand(tagsSetCommand).addCommand(tagsAddCommand).addCommand(tagsRemoveCommand).addCommand(createFromTemplateCommand).addCommand(estimateTemplateCostCommand).addCommand(verifyCommand).addCommand(statusesCommand).addCommand(publicCommand).addCommand(sendTokenCommand).addCommand(progressCommand).addCommand(waitCommand);
|
|
25983
26012
|
|
|
25984
26013
|
// src/commands/fields.ts
|
|
@@ -26172,8 +26201,8 @@ var connectCommand = new Command("connect").description(
|
|
|
26172
26201
|
"Open browser consent for a public OAuth app, receive its loopback return, and print tokens"
|
|
26173
26202
|
).addOption(clientIdOption()).option("--redirect-uri <uri>", "Exactly registered HTTPS relay URI", CLI_OAUTH_REDIRECT_URI).option(
|
|
26174
26203
|
"--scope <scopes>",
|
|
26175
|
-
"Space-separated scopes; the default requests
|
|
26176
|
-
"account:read documents:read documents:write templates:read templates:write webhooks:write
|
|
26204
|
+
"Space-separated scopes; the default requests the seven registered CLI scopes",
|
|
26205
|
+
"account:read documents:read documents:write templates:read templates:write webhooks:write offline_access"
|
|
26177
26206
|
).option("--timeout <seconds>", "Wait for browser consent (1\u2013600 seconds)", "180").option("--no-browser", "Print the authorization URL without opening the system browser").action(async (opts, command) => {
|
|
26178
26207
|
await runWithPublicClient(command, async ({ client, config }) => {
|
|
26179
26208
|
const timeout = parseInteger(opts.timeout, "--timeout", { min: 1 });
|
|
@@ -26207,7 +26236,7 @@ function withScopeHint(error) {
|
|
|
26207
26236
|
if (!(error instanceof ValidationError) || error.errors.oauthError !== "invalid_scope")
|
|
26208
26237
|
return error;
|
|
26209
26238
|
return new ValidationError(
|
|
26210
|
-
`${error.message}. The application is not registered for one of the requested scopes: the default requests
|
|
26239
|
+
`${error.message}. The application is not registered for one of the requested scopes: the CLI default requests seven registered scopes, including webhooks:write and offline_access. Ask the application owner to register them, or pass --scope with the scopes it permits.`,
|
|
26211
26240
|
error.errors
|
|
26212
26241
|
);
|
|
26213
26242
|
}
|
|
@@ -26673,7 +26702,7 @@ var getCommand4 = new Command("get").description("Show a signer by ID").argument
|
|
|
26673
26702
|
printData(signer, config, (s) => renderKeyValue(s));
|
|
26674
26703
|
});
|
|
26675
26704
|
});
|
|
26676
|
-
var updateCommand2 = new Command("update").description("Update a signer").argument("<id>", "Signer ID").option("--name <name>", "Signer full name").option("--email <email>", "Email address").option("--phone <number>", "WhatsApp phone number (E.164)").option("--cpf <cpf>", "Brazilian tax ID (CPF)").action(async (id, opts, command) => {
|
|
26705
|
+
var updateCommand2 = new Command("update").description("Update a signer").argument("<id>", "Signer ID").option("--name <name>", "Signer full name").option("--email <email>", "Email address").option("--phone <number>", "WhatsApp phone number (E.164)").option("--cpf <cpf>", "Brazilian tax ID (CPF/CNPJ), sent as government_id").action(async (id, opts, command) => {
|
|
26677
26706
|
await runWithClient(command, async ({ client, config }) => {
|
|
26678
26707
|
const accountId = requireAccountId(config);
|
|
26679
26708
|
const payload = {};
|
|
@@ -27246,7 +27275,7 @@ function handleStreamError(err, fallback, exit = process.exit) {
|
|
|
27246
27275
|
// package.json
|
|
27247
27276
|
var package_default = {
|
|
27248
27277
|
name: "@assinafy/cli",
|
|
27249
|
-
version: "2.4.
|
|
27278
|
+
version: "2.4.2",
|
|
27250
27279
|
description: "The official command-line interface for the Assinafy digital-signature API",
|
|
27251
27280
|
license: "MIT",
|
|
27252
27281
|
type: "module",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../../src/api/resources/oauth.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACX,0BAA0B,EAC1B,0BAA0B,EAC1B,yBAAyB,EACzB,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AASzC,2FAA2F;AAC3F,qBAAa,aAAc,SAAQ,YAAY;IAC9C,oFAAoF;IAC9E,QAAQ,IAAI,OAAO,CAAC,uBAAuB,CAAC,CAajD;IAED,kFAAkF;IAC5E,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAgBlE;IAED,yFAAyF;IACnF,SAAS,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,0BAA0B,CAAC,CA6CxF;IAED,oFAAoF;IAC9E,YAAY,CACjB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,0BAA0B,EACnC,YAAY,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,mBAAmB,CAAC,
|
|
1
|
+
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../../src/api/resources/oauth.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACX,0BAA0B,EAC1B,0BAA0B,EAC1B,yBAAyB,EACzB,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AASzC,2FAA2F;AAC3F,qBAAa,aAAc,SAAQ,YAAY;IAC9C,oFAAoF;IAC9E,QAAQ,IAAI,OAAO,CAAC,uBAAuB,CAAC,CAajD;IAED,kFAAkF;IAC5E,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAgBlE;IAED,yFAAyF;IACnF,SAAS,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,0BAA0B,CAAC,CA6CxF;IAED,oFAAoF;IAC9E,YAAY,CACjB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,0BAA0B,EACnC,YAAY,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,mBAAmB,CAAC,CAiD9B;IAED;;;OAGG;IACG,KAAK,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAoCrE;IAED,2FAA2F;IACrF,MAAM,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAaxD;IAED,uFAAuF;IACjF,QAAQ,IAAI,OAAO,CAAC,cAAc,CAAC,CAExC;CACD"}
|
package/docs/api-operations.json
CHANGED
package/docs/api-reference.md
CHANGED
|
@@ -7,7 +7,7 @@ The renderer reuses a generic 400 envelope for several non-400 errors; top-level
|
|
|
7
7
|
- OpenAPI: 3.0.0
|
|
8
8
|
- API document version: 1.0.0
|
|
9
9
|
- Operations: 93
|
|
10
|
-
- Contract SHA-256: `
|
|
10
|
+
- Contract SHA-256: `68e588d7c7b648f55e886e60d8cbfddc8ae640fbbfe1f680471b5bfaf6a1fec1`
|
|
11
11
|
|
|
12
12
|
## Accounts
|
|
13
13
|
|
|
@@ -4730,8 +4730,6 @@ Implements the RFC 6749 §5.1/§5.2 token-endpoint body contract in
|
|
|
4730
4730
|
|
|
4731
4731
|
#### Request Body (required)
|
|
4732
4732
|
|
|
4733
|
-
The [OAuth Integration Guide](https://api.assinafy.com.br/v1/docs) specifies form encoding, which the SDK and CLI send; the server also accepts JSON.
|
|
4734
|
-
|
|
4735
4733
|
Fields (`application/x-www-form-urlencoded`):
|
|
4736
4734
|
|
|
4737
4735
|
- `grant_type` (string, required) — `urn:ietf:params:oauth:grant-type:token-exchange` is for internal service clients only (Assinafy's own MCP server) — an ordinary confidential or public client authenticates with it and always gets `invalid_client`, exactly as an unrecognized client would. Everyday integrators use `authorization_code` and `refresh_token`.
|
|
@@ -4818,8 +4816,6 @@ Revokes an access or refresh token. Every token outcome always returns 200 — i
|
|
|
4818
4816
|
|
|
4819
4817
|
#### Request Body (required)
|
|
4820
4818
|
|
|
4821
|
-
The [OAuth Integration Guide](https://api.assinafy.com.br/v1/docs) specifies form encoding, which the SDK and CLI send; the server also accepts JSON.
|
|
4822
|
-
|
|
4823
4819
|
Fields (`application/x-www-form-urlencoded`):
|
|
4824
4820
|
|
|
4825
4821
|
- `token` (string, required)
|
package/docs/migration-v2.md
CHANGED
|
@@ -15,9 +15,10 @@ Version 2 publishes the Node.js SDK at `@assinafy/cli/api` and requires Node.js
|
|
|
15
15
|
verification and notification. Explicit signer controls still take precedence.
|
|
16
16
|
- `uploadAndRequestSignatures` rejects with `PartialWorkflowError` when it fails
|
|
17
17
|
after the upload, exposing the `documentId` and `signerIds` it already created
|
|
18
|
-
so callers can
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
so callers can inspect remote state and resume. Signer IDs may have been reused;
|
|
19
|
+
never delete those signers automatically after a failed workflow.
|
|
20
|
+
- Signer artifact downloads use the published public route. Supplying an optional
|
|
21
|
+
access code adds an identity preflight before downloading.
|
|
21
22
|
|
|
22
23
|
Legacy signer aliases (`phone`, `cpf`, and assignment `signer_ids`/`signerIds`),
|
|
23
24
|
both public `sendToken` request forms, and existing CLI functionality remain
|
package/docs/oauth-guide.md
CHANGED
|
@@ -40,7 +40,7 @@ The resource indicator is an origin, distinct from the SDK `baseUrl`, which incl
|
|
|
40
40
|
| `email` | Include permitted email claims. |
|
|
41
41
|
| `offline_access` | Request rotating refresh tokens for background work. |
|
|
42
42
|
|
|
43
|
-
`oauth connect` requests
|
|
43
|
+
`oauth connect` requests the seven scopes registered for the official CLI application by default: `account:read documents:read documents:write templates:read templates:write webhooks:write offline_access`. This supports documents, templates, the selected workspace, webhook settings, and rotating refresh tokens. The default does not request `openid`, `profile`, or `email`, so it does not issue an ID token or enable UserInfo. Those scopes remain available through `--scope` and the SDK for applications registered to use them. Existing connections need a new authorization with the larger scope set; refreshing an old token does not add permissions. Use `--scope` to explicitly select a different registered set when needed. For other applications, request only scopes they use. Resource metadata lists API scopes; authorization-server metadata also describes authentication features such as `offline_access`. The returned `scope` string is authoritative for the access token; do not infer granted scopes from what the browser requested. It never lists `offline_access`, even when granted: a `refresh_token` in the response is the only signal that refresh is available. A scope never bypasses a user's role or the token's workspace boundary. Billing, subscriptions, workspace membership, credential management, and administration remain unavailable to OAuth tokens; those CLI operations require the non-OAuth credential documented for each endpoint.
|
|
44
44
|
|
|
45
45
|
## Discover and start authorization
|
|
46
46
|
|
|
@@ -125,7 +125,7 @@ const tokens = await oauthClient.oauth.exchangeCode(
|
|
|
125
125
|
);
|
|
126
126
|
```
|
|
127
127
|
|
|
128
|
-
`exchangeCode(callbackUrl, request, clientSecret?)` checks the callback origin/path and registered query parameters, rejects duplicate protocol parameters, compares `state` in constant time, and requires the exact stored issuer. It rejects denied authorization before calling the token endpoint. Authorization codes expire after 60 seconds and can be used once. Exchange immediately and never retry a code blindly after a timeout.
|
|
128
|
+
`exchangeCode(callbackUrl, request, clientSecret?)` checks the callback origin/path and registered query parameters, rejects duplicate protocol parameters, requires exactly one of `code` or `error`, compares `state` in constant time, and requires the exact stored issuer. It rejects denied authorization before calling the token endpoint. Authorization codes expire after 60 seconds and can be used once. Exchange immediately and never retry a code blindly after a timeout.
|
|
129
129
|
|
|
130
130
|
An authorization error raises `ValidationError` with a bounded OAuth error code in `errors.oauthError` and the message, without retaining the callback URL. Unrecognized formats become `unknown_error`. For `invalid_scope`, check that the application registration permits every requested scope, including `offline_access`; do not treat the browser return as successful authorization.
|
|
131
131
|
|
|
@@ -261,7 +261,7 @@ await oauthClient.oauth.revoke({
|
|
|
261
261
|
|
|
262
262
|
### Automatic browser return
|
|
263
263
|
|
|
264
|
-
The distributed CLI includes the official **Public** application's client ID, `96BZZ0sZTb2NkEXt1GCaIRCTprI2YKHZr8JDHawuXUyCLC88`. This public identifier is not a secret. The CLI uses PKCE S256 and the scopes `account:read documents:read documents:write templates:read templates:write webhooks:write
|
|
264
|
+
The distributed CLI includes the official **Public** application's client ID, `96BZZ0sZTb2NkEXt1GCaIRCTprI2YKHZr8JDHawuXUyCLC88`. This public identifier is not a secret. The CLI uses PKCE S256 and the scopes `account:read documents:read documents:write templates:read templates:write webhooks:write offline_access`; keep the registered permissions consistent with the requested scopes. No client secret is used by `oauth connect`, including when `ASSINAFY_OAUTH_CLIENT_SECRET` is set for another application.
|
|
265
265
|
|
|
266
266
|
Application maintainers must deploy the callback from `integrations-generic-callback` and register this exact HTTPS URI, without an extension or trailing slash:
|
|
267
267
|
|
|
@@ -287,7 +287,7 @@ assinafy documents list --json
|
|
|
287
287
|
| --- | --- |
|
|
288
288
|
| `--client-id <id>` | Override the bundled public application ID; takes precedence over `ASSINAFY_OAUTH_CLIENT_ID`. |
|
|
289
289
|
| `--redirect-uri <uri>` | Registered HTTPS relay URI; defaults to the extensionless URL above. Query parameters and fragments are unsupported for this browser relay. |
|
|
290
|
-
| `--scope '<scopes>'` | Space-separated scopes; defaults to `account:read documents:read documents:write templates:read templates:write webhooks:write
|
|
290
|
+
| `--scope '<scopes>'` | Space-separated scopes; defaults to `account:read documents:read documents:write templates:read templates:write webhooks:write offline_access`. |
|
|
291
291
|
| `--timeout <seconds>` | Browser response deadline, 1–600 seconds; default 180. API calls use the SDK's network timeout. |
|
|
292
292
|
| `--no-browser` | Print the authorization URL for manual opening; the local listener still receives the return automatically. |
|
|
293
293
|
|
package/docs/oauth.md
CHANGED
|
@@ -41,10 +41,10 @@ Options:
|
|
|
41
41
|
ASSINAFY_OAUTH_CLIENT_ID)
|
|
42
42
|
--redirect-uri <uri> Exactly registered HTTPS relay URI (default:
|
|
43
43
|
"https://integrations.assinafy.com.br/assinafy-cli/oauth-callback")
|
|
44
|
-
--scope <scopes> Space-separated scopes; the default requests
|
|
45
|
-
|
|
46
|
-
documents:write templates:read
|
|
47
|
-
webhooks:write
|
|
44
|
+
--scope <scopes> Space-separated scopes; the default requests the seven
|
|
45
|
+
registered CLI scopes (default: "account:read
|
|
46
|
+
documents:read documents:write templates:read
|
|
47
|
+
templates:write webhooks:write offline_access")
|
|
48
48
|
--timeout <seconds> Wait for browser consent (1–600 seconds) (default:
|
|
49
49
|
"180")
|
|
50
50
|
--no-browser Print the authorization URL without opening the system
|
package/docs/sdk-reference.md
CHANGED
|
@@ -224,7 +224,7 @@ Create payload: `{ full_name: string; email?; whatsapp_phone_number?; phone?; cp
|
|
|
224
224
|
|
|
225
225
|
## Signer-side flows (`client.signerDocuments`)
|
|
226
226
|
|
|
227
|
-
These methods use the private `signer-access-code`, not the workspace API key, except for the artifact download that the API publishes as a public route. For email verification, obtain the access code from the verification link and the OTP from the same
|
|
227
|
+
These methods use the private `signer-access-code`, not the workspace API key, except for the artifact download that the API publishes as a public route. For email or WhatsApp verification, obtain the access code from the verification link and the OTP from the same message. An invitation containing only a document ID and recipient is not an access code. Call `self` and `getAssignment` to confirm the signer and document before submitting a decision; keep each document's verification credentials together.
|
|
228
228
|
|
|
229
229
|
| SDK method | HTTP operation | Resolves to |
|
|
230
230
|
| --- | --- | --- |
|
|
@@ -444,7 +444,7 @@ Metadata, discovery, token, and revoke calls remove owner headers. UserInfo uses
|
|
|
444
444
|
| `validateMultiple(entries, options?)` | [`POST …/fields/validate-multiple`](./api-reference.md#validate-multiple-field-values) | `IFieldValidationResult[]` |
|
|
445
445
|
| `listTypes()` | [`GET /field-types`](./api-reference.md#list-field-types) | `IFieldType[]` |
|
|
446
446
|
|
|
447
|
-
Published create payload: `{ type: string; name: string; regex?; is_required? }`. Published update payload: `{ name?; regex?: string | null; is_active? }`. The SDK retains create-time `is_active` and update-time `type`/`is_required` as compatibility extensions. List params are `{ include_inactive?, include_standard? }`. Validation options are `{ signerAccessCode?, accountId? }`; multiple entries are `{ field_id, value }[]`. When a signer code is supplied, the SDK removes any configured owner API-key/bearer headers from that request.
|
|
447
|
+
Published create payload: `{ type: string; name: string; regex?; is_required? }`. Published update payload: `{ name?; regex?: string | null; is_active? }`. The SDK retains create-time `is_active` and update-time `type`/`is_required` as compatibility extensions. List params are `{ include_inactive?, include_standard? }`. Validation options are `{ signerAccessCode?, accountId? }`; multiple entries are `{ field_id, value }[]`. When a signer code is supplied, the SDK removes any configured owner API-key/bearer headers from that request. An explicitly empty or blank code raises `ValidationError` before any request; omit the option for owner-authenticated validation.
|
|
448
448
|
|
|
449
449
|
## Tags (`client.tags`)
|
|
450
450
|
|
|
@@ -541,7 +541,7 @@ try {
|
|
|
541
541
|
| API | Result |
|
|
542
542
|
| --- | --- |
|
|
543
543
|
| `new WebhookVerifier(secret?, { algorithm?, encoding? }?)` | Compatibility verifier; defaults to `sha256` and `hex`. |
|
|
544
|
-
| `verify(rawBody, signature)` | `boolean`; HMAC
|
|
544
|
+
| `verify(rawBody, signature)` | `boolean`; HMAC verification under the configured, assumed scheme. |
|
|
545
545
|
| `extractEvent(rawBody)` | Parsed `IWebhookPayload`, or `null` for invalid JSON/non-object data. |
|
|
546
546
|
| `getEventType(event)` | `event`/`type` string, or `null`. |
|
|
547
547
|
| `getEventData(event)` | First object found at `payload`, `data`, or `object`; otherwise `{}`. |
|
package/docs/signers.md
CHANGED
|
@@ -80,7 +80,7 @@ Options:
|
|
|
80
80
|
--name <name> Signer full name
|
|
81
81
|
--email <email> Email address
|
|
82
82
|
--phone <number> WhatsApp phone number (E.164)
|
|
83
|
-
--cpf <cpf> Brazilian tax ID (CPF)
|
|
83
|
+
--cpf <cpf> Brazilian tax ID (CPF/CNPJ), sent as government_id
|
|
84
84
|
-h, --help display help for command
|
|
85
85
|
```
|
|
86
86
|
|
package/install.ps1
CHANGED
|
@@ -41,6 +41,13 @@ function Add-UserPath([string]$Directory) {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
function Test-ArchiveLayout([string]$Archive, [string]$Target) {
|
|
44
|
+
$details = @(& tar -tvzf $Archive)
|
|
45
|
+
if ($LASTEXITCODE -ne 0) {
|
|
46
|
+
Fail "Unable to read release archive"
|
|
47
|
+
}
|
|
48
|
+
if (@($details | Where-Object { -not $_.StartsWith("-") }).Count -gt 0) {
|
|
49
|
+
Fail "Release archive contained a link or special file"
|
|
50
|
+
}
|
|
44
51
|
$entries = @(& tar -tzf $Archive)
|
|
45
52
|
if ($LASTEXITCODE -ne 0) {
|
|
46
53
|
Fail "Unable to read release archive"
|
|
@@ -163,6 +170,9 @@ try {
|
|
|
163
170
|
Test-ArchiveLayout $archive $target
|
|
164
171
|
|
|
165
172
|
tar -xzf $archive -C $extractDir
|
|
173
|
+
if ($LASTEXITCODE -ne 0) {
|
|
174
|
+
Fail "Unable to extract release archive"
|
|
175
|
+
}
|
|
166
176
|
$unsafeEntry = Get-ChildItem $extractDir -Recurse -Force | Where-Object {
|
|
167
177
|
($_.Attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0
|
|
168
178
|
} | Select-Object -First 1
|
package/install.sh
CHANGED
|
@@ -243,6 +243,9 @@ validate_archive() {
|
|
|
243
243
|
local archive="$1"
|
|
244
244
|
local target="$2"
|
|
245
245
|
local entry expected executable_count=0 version_count=0
|
|
246
|
+
if ! tar -tvzf "$archive" | awk 'substr($0, 1, 1) != "-" { invalid = 1 } END { exit invalid }'; then
|
|
247
|
+
fail "Release archive contained a link or special file"
|
|
248
|
+
fi
|
|
246
249
|
if [[ "$target" == windows-* ]]; then
|
|
247
250
|
expected='assinafy.cmd|assinafy.cjs'
|
|
248
251
|
else
|