auth-agents 0.1.1 → 0.1.3

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 ADDED
@@ -0,0 +1,137 @@
1
+ # auth-agents
2
+
3
+ Verify AI agent identities with [Agent Auth](https://getagentauth.com). DID-based authentication using Ed25519 and Verifiable Credentials.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install auth-agents
9
+ ```
10
+
11
+ ## Quick Start — Verify a Credential
12
+
13
+ ```typescript
14
+ import { AuthAgents } from "auth-agents"
15
+
16
+ const client = new AuthAgents()
17
+
18
+ const result = await client.verify("eyJhbGciOiJFZERTQSJ9...")
19
+
20
+ if (result.valid) {
21
+ console.log(result.did) // "did:key:z6Mk..."
22
+ console.log(result.agent_name) // "Claude"
23
+ console.log(result.agent_model) // "claude-opus-4-6"
24
+ console.log(result.agent_provider) // "Anthropic"
25
+ console.log(result.agent_purpose) // "Research assistant"
26
+ console.log(result.expires_at) // "2026-02-27T01:58:15.000Z"
27
+ }
28
+ ```
29
+
30
+ ## Website Integration (Next.js)
31
+
32
+ ```typescript
33
+ // app/api/auth/agent/route.ts
34
+ import { AuthAgents } from "auth-agents"
35
+
36
+ const authAgents = new AuthAgents()
37
+
38
+ export async function POST(request: Request) {
39
+ const { credential } = await request.json()
40
+
41
+ const result = await authAgents.verify(credential)
42
+
43
+ if (!result.valid) {
44
+ return Response.json({ error: result.message }, { status: 401 })
45
+ }
46
+
47
+ // Create a session with the verified agent identity
48
+ const sessionId = crypto.randomUUID()
49
+ await db.insert("sessions", {
50
+ session_id: sessionId,
51
+ did: result.did,
52
+ agent_name: result.agent_name,
53
+ agent_model: result.agent_model,
54
+ expires_at: result.expires_at,
55
+ })
56
+
57
+ return Response.json({ authenticated: true, session_id: sessionId })
58
+ }
59
+ ```
60
+
61
+ ## Website Integration (Express.js)
62
+
63
+ ```typescript
64
+ import express from "express"
65
+ import { AuthAgents } from "auth-agents"
66
+
67
+ const app = express()
68
+ const authAgents = new AuthAgents()
69
+
70
+ app.post("/auth/agent", express.json(), async (req, res) => {
71
+ const { credential } = req.body
72
+ const result = await authAgents.verify(credential)
73
+
74
+ if (!result.valid) {
75
+ return res.status(401).json({ error: result.message })
76
+ }
77
+
78
+ // Agent verified — create session
79
+ req.session.agent = {
80
+ did: result.did,
81
+ name: result.agent_name,
82
+ model: result.agent_model,
83
+ }
84
+
85
+ res.json({ authenticated: true, agent_name: result.agent_name })
86
+ })
87
+ ```
88
+
89
+ ## Full Agent Auth Flow
90
+
91
+ ```typescript
92
+ import { AuthAgents } from "auth-agents"
93
+
94
+ const client = new AuthAgents()
95
+
96
+ // 1. Register
97
+ const identity = await client.register({
98
+ agent_name: "Claude",
99
+ agent_model: "claude-opus-4-6",
100
+ agent_provider: "Anthropic",
101
+ agent_purpose: "Research assistant",
102
+ })
103
+
104
+ // 2. Request challenge
105
+ const challenge = await client.challenge(identity.did)
106
+
107
+ // 3. Sign nonce and authenticate
108
+ const auth = await client.authenticate({
109
+ challenge_id: challenge.challenge_id,
110
+ did: identity.did,
111
+ signature: signedNonce, // base64url Ed25519 signature of challenge.nonce
112
+ })
113
+ // auth.credential — fresh VC-JWT
114
+ // auth.session_token — session ID
115
+ ```
116
+
117
+ ## API
118
+
119
+ ### `new AuthAgents(config?)`
120
+
121
+ - `config.baseUrl` — API base URL (default: `https://auth.getagentauth.com`)
122
+
123
+ ### `client.verify(credential)` — Verify a VC-JWT credential
124
+
125
+ ### `client.register(input)` — Register a new agent identity
126
+
127
+ ### `client.challenge(did)` — Request an auth challenge
128
+
129
+ ### `client.authenticate(input)` — Submit signed challenge
130
+
131
+ ## Documentation
132
+
133
+ Full API reference at [getagentauth.com/docs](https://getagentauth.com/docs/)
134
+
135
+ ## License
136
+
137
+ MIT - Agent Auth
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  interface AuthAgentsConfig {
2
- /** Base URL of the Auth-Agents API. Defaults to https://auth.auth-agents.com */
2
+ /** Base URL of the Agent Auth API. Defaults to https://auth.getagentauth.com */
3
3
  baseUrl?: string;
4
4
  }
5
5
  interface VerifyResult {
@@ -76,7 +76,7 @@ declare class AuthAgents {
76
76
  private baseUrl;
77
77
  constructor(config?: AuthAgentsConfig);
78
78
  /**
79
- * Verify a VC-JWT credential issued by Auth-Agents.
79
+ * Verify a VC-JWT credential issued by Agent Auth.
80
80
  *
81
81
  * @param credential - The VC-JWT string from the agent
82
82
  * @returns Verified agent identity or error details
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  interface AuthAgentsConfig {
2
- /** Base URL of the Auth-Agents API. Defaults to https://auth.auth-agents.com */
2
+ /** Base URL of the Agent Auth API. Defaults to https://auth.getagentauth.com */
3
3
  baseUrl?: string;
4
4
  }
5
5
  interface VerifyResult {
@@ -76,7 +76,7 @@ declare class AuthAgents {
76
76
  private baseUrl;
77
77
  constructor(config?: AuthAgentsConfig);
78
78
  /**
79
- * Verify a VC-JWT credential issued by Auth-Agents.
79
+ * Verify a VC-JWT credential issued by Agent Auth.
80
80
  *
81
81
  * @param credential - The VC-JWT string from the agent
82
82
  * @returns Verified agent identity or error details
package/dist/index.js CHANGED
@@ -24,14 +24,14 @@ __export(index_exports, {
24
24
  verify: () => verify
25
25
  });
26
26
  module.exports = __toCommonJS(index_exports);
27
- var DEFAULT_BASE_URL = "https://auth.auth-agents.com";
27
+ var DEFAULT_BASE_URL = "https://auth.getagentauth.com";
28
28
  var AuthAgents = class {
29
29
  constructor(config) {
30
30
  this.baseUrl = (config?.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
31
31
  }
32
32
  // ---- Credential Verification (for websites) ----------------------------
33
33
  /**
34
- * Verify a VC-JWT credential issued by Auth-Agents.
34
+ * Verify a VC-JWT credential issued by Agent Auth.
35
35
  *
36
36
  * @param credential - The VC-JWT string from the agent
37
37
  * @returns Verified agent identity or error details
package/dist/index.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  // src/index.ts
2
- var DEFAULT_BASE_URL = "https://auth.auth-agents.com";
2
+ var DEFAULT_BASE_URL = "https://auth.getagentauth.com";
3
3
  var AuthAgents = class {
4
4
  constructor(config) {
5
5
  this.baseUrl = (config?.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
6
6
  }
7
7
  // ---- Credential Verification (for websites) ----------------------------
8
8
  /**
9
- * Verify a VC-JWT credential issued by Auth-Agents.
9
+ * Verify a VC-JWT credential issued by Agent Auth.
10
10
  *
11
11
  * @param credential - The VC-JWT string from the agent
12
12
  * @returns Verified agent identity or error details
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "auth-agents",
3
- "version": "0.1.1",
4
- "description": "Verify AI agent identities with Auth-Agents. DID-based authentication using Ed25519 and Verifiable Credentials.",
3
+ "version": "0.1.3",
4
+ "description": "Verify AI agent identities with Agent Auth. DID-based authentication using Ed25519 and Verifiable Credentials.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -12,13 +12,17 @@
12
12
  }
13
13
  },
14
14
  "files": [
15
- "dist"
15
+ "dist",
16
+ "README.md",
17
+ "LICENSE"
16
18
  ],
17
19
  "scripts": {
18
20
  "build": "tsup src/index.ts --format cjs,esm --dts --clean",
19
21
  "prepublishOnly": "npm run build"
20
22
  },
21
23
  "keywords": [
24
+ "agent-auth",
25
+ "getagentauth",
22
26
  "auth-agents",
23
27
  "ai-agent",
24
28
  "did",
@@ -34,7 +38,7 @@
34
38
  "type": "git",
35
39
  "url": "https://github.com/AgenthAgent/auth-agents-sdk-node"
36
40
  },
37
- "homepage": "https://auth-agents.com",
41
+ "homepage": "https://getagentauth.com",
38
42
  "devDependencies": {
39
43
  "tsup": "^8.0.0",
40
44
  "typescript": "^5.0.0"