@kya-brasil/agent-tools 0.5.0 → 0.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.
- package/README.md +2 -2
- package/dist/auth.d.ts +1 -1
- package/dist/auth.js +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -105,7 +105,7 @@ import { createKyaClient, signChallengeWithEvmKey, signWithECnpj } from "@kya-br
|
|
|
105
105
|
import { readFileSync } from "node:fs";
|
|
106
106
|
|
|
107
107
|
const kya = createKyaClient({ privateKey: payerPk });
|
|
108
|
-
const reg = await kya.register({ // $0.
|
|
108
|
+
const reg = await kya.register({ // $0.25
|
|
109
109
|
agent: { kind: "evm", id: agentAddress },
|
|
110
110
|
cnpj: "11.222.333/0001-81",
|
|
111
111
|
mandate: {
|
|
@@ -141,7 +141,7 @@ Renew every 90 days (`kya.renew` then `kya.renewProve`), revoke at once (`kya.re
|
|
|
141
141
|
| verify, verifyByKey, prove, renewProve, revoke, revocations, companyAgents, setCompanyWebhook | free |
|
|
142
142
|
| verified (signed receipt, no limit), allowed (signed verdict) | 0.01 |
|
|
143
143
|
| renew | 0.10 |
|
|
144
|
-
| register | 0.
|
|
144
|
+
| register | 0.25 |
|
|
145
145
|
|
|
146
146
|
Schemas and keys: `/.well-known/kya-mandate.schema.json`, `/.well-known/kya.json`, `/openapi.json`, `/llms.txt`.
|
|
147
147
|
Legal entities only: no CPF is stored; the e-CNPJ signer is recorded by certificate hash.
|
package/dist/auth.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ActionQuery, type AgentKey, type CredentialStatus, type KyaClient, type Mandate, type Verdict, type Verification, type KyaOptions } from "./index";
|
|
1
|
+
import { type ActionQuery, type AgentKey, type CredentialStatus, type KyaClient, type Mandate, type Verdict, type Verification, type KyaOptions } from "./index.js";
|
|
2
2
|
export declare const KYA_HEADERS: {
|
|
3
3
|
readonly credential: "kya-credential";
|
|
4
4
|
readonly created: "kya-created";
|
package/dist/auth.js
CHANGED
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
*/
|
|
28
28
|
import { verifyMessage } from "viem";
|
|
29
29
|
import { privateKeyToAccount } from "viem/accounts";
|
|
30
|
-
import { createKyaClient } from "./index";
|
|
31
|
-
import { fromBase64Url, toBase64Url } from "./base64url";
|
|
30
|
+
import { createKyaClient } from "./index.js";
|
|
31
|
+
import { fromBase64Url, toBase64Url } from "./base64url.js";
|
|
32
32
|
export const KYA_HEADERS = { credential: "kya-credential", created: "kya-created", expires: "kya-expires", signature: "kya-signature", content: "kya-content-sha256" };
|
|
33
33
|
const enc = new TextEncoder();
|
|
34
34
|
const hex = (buf) => [...new Uint8Array(buf)].map((b) => b.toString(16).padStart(2, "0")).join("");
|
package/dist/index.d.ts
CHANGED
|
@@ -177,7 +177,7 @@ export interface KyaClient {
|
|
|
177
177
|
}>;
|
|
178
178
|
/** $0.01: signed verdict, is this action inside the mandate and is the credential active? */
|
|
179
179
|
allowed(credentialId: string, q: ActionQuery): Promise<Verdict>;
|
|
180
|
-
/** $0.
|
|
180
|
+
/** $0.25: register an agent for a company; returns the challenge both parties sign. */
|
|
181
181
|
register(input: {
|
|
182
182
|
agent: AgentKey;
|
|
183
183
|
cnpj: string;
|
|
@@ -343,4 +343,4 @@ export declare function verifyCredentialOffline(credential: Credential, opts?: {
|
|
|
343
343
|
fetch?: typeof fetch;
|
|
344
344
|
now?: Date;
|
|
345
345
|
}): Promise<OfflineCheck>;
|
|
346
|
-
export * from "./auth";
|
|
346
|
+
export * from "./auth.js";
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* tools for your agent framework: toOpenAI(kya), toVercelAI(kya, { tool, jsonSchema }), toLangChain(kya, tool), toAnthropic(kya)
|
|
11
11
|
*
|
|
12
12
|
* Company (you give your own agent a credential):
|
|
13
|
-
* const reg = await kya.register({ agent: { kind: "evm", id: address }, cnpj, mandate }); // $0.
|
|
13
|
+
* const reg = await kya.register({ agent: { kind: "evm", id: address }, cnpj, mandate }); // $0.25, returns a challenge
|
|
14
14
|
* const agent_signature = await signChallengeWithEvmKey(agentPrivateKey, reg.challenge.text);
|
|
15
15
|
* const ecnpj_signature = await signWithECnpj({ certificatePem, privateKeyPem, chainPem }, reg.challenge.text);
|
|
16
16
|
* const issued = await kya.prove(reg.credential_id, { challenge_id: reg.challenge.id, agent_signature, ecnpj_signature });
|
|
@@ -21,7 +21,7 @@ import { toClientEvmSigner } from "@x402/evm";
|
|
|
21
21
|
import { wrapFetchWithPayment } from "@x402/fetch";
|
|
22
22
|
import { privateKeyToAccount } from "viem/accounts";
|
|
23
23
|
import * as pkijs from "pkijs";
|
|
24
|
-
import { toBase64Url } from "./base64url";
|
|
24
|
+
import { toBase64Url } from "./base64url.js";
|
|
25
25
|
export const DEFAULT_BASE_URL = "https://kya-br-agents.marcelfons.workers.dev";
|
|
26
26
|
export class KyaError extends Error {
|
|
27
27
|
code;
|
|
@@ -75,7 +75,7 @@ export function createKyaClient(opts = {}) {
|
|
|
75
75
|
verifyByKey: (agent) => call("GET", `/v1/agents/by-key${q({ kind: agent.kind, id: agent.id })}`),
|
|
76
76
|
verified: (id) => call("GET", `/v1/agents/${encodeURIComponent(id)}/verified`, undefined, true, 0.01),
|
|
77
77
|
allowed: (id, a) => call("GET", `/v1/agents/${encodeURIComponent(id)}/allowed${q(a)}`, undefined, true, 0.01),
|
|
78
|
-
register: (input) => call("POST", "/v1/agents", input, true, 0.
|
|
78
|
+
register: (input) => call("POST", "/v1/agents", input, true, 0.25),
|
|
79
79
|
prove: (id, proof) => call("POST", `/v1/agents/${encodeURIComponent(id)}/prove`, proof),
|
|
80
80
|
renew: (id) => call("POST", `/v1/agents/${encodeURIComponent(id)}/renew`, {}, true, 0.1),
|
|
81
81
|
renewProve: (id, proof) => call("POST", `/v1/agents/${encodeURIComponent(id)}/renew/prove`, proof),
|
|
@@ -238,4 +238,4 @@ export async function verifyCredentialOffline(credential, opts = {}) {
|
|
|
238
238
|
const within_validity = Date.parse(credential.expires_at) > (opts.now ?? new Date()).getTime();
|
|
239
239
|
return { signature, within_validity, live_status: "unknown", usable_offline: signature.valid && within_validity && credential.status === "active" };
|
|
240
240
|
}
|
|
241
|
-
export * from "./auth";
|
|
241
|
+
export * from "./auth.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kya-brasil/agent-tools",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "KYA Brasil for AI agents: verify that an agent acts for a Brazilian company (e-CNPJ-signed credential, revocation and company registration checked daily), check an action against its mandate, or give your own agent a credential. Sign in with KYA middleware (Hono, Express, Workers) and request signing. x402 payments (USDC on Base) handled for you. Adapters for Vercel AI SDK, LangChain, OpenAI and Anthropic.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|