@datacules/agent-identity-fastify 0.8.0 → 0.10.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.
Files changed (2) hide show
  1. package/README.md +53 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,53 @@
1
+ <p align="center">
2
+ <img src="../../../assets/logo.svg" alt="Agent Identity — by Datacules LLC" width="360"/>
3
+ </p>
4
+
5
+ # `@datacules/agent-identity-fastify`
6
+
7
+ Fastify plugin for the agent-identity framework. Resolves credentials server-side and decorates each request with `request.resolvedCredential`.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install @datacules/agent-identity-fastify @datacules/agent-identity
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```typescript
18
+ import Fastify from 'fastify';
19
+ import { agentIdentityPlugin } from '@datacules/agent-identity-fastify';
20
+ import { credentials, rules, logger } from './config';
21
+
22
+ const app = Fastify();
23
+
24
+ await app.register(agentIdentityPlugin, { credentials, rules, logger });
25
+
26
+ app.post('/ai/complete', async (request, reply) => {
27
+ const { ref, resolvedFor, credentialId } = request.resolvedCredential!;
28
+ // ref → fetch the raw secret from your vault server-side
29
+ return { resolvedFor };
30
+ });
31
+
32
+ await app.listen({ port: 3000 });
33
+ ```
34
+
35
+ ## Plugin options
36
+
37
+ ```typescript
38
+ await app.register(agentIdentityPlugin, {
39
+ credentials, // Credential[]
40
+ rules, // RoutingRule[]
41
+ logger, // AuditLogger (optional)
42
+ store, // CredentialStore (alternative to credentials[])
43
+ contextKey: 'body.agentContext', // default path in request body
44
+ });
45
+ ```
46
+
47
+ ## TypeScript decoration
48
+
49
+ The plugin augments `FastifyRequest` with `resolvedCredential?: ResolvedCredential` via Fastify's decoration system — no manual augmentation needed.
50
+
51
+ ---
52
+
53
+ Part of the [agent-identity monorepo](https://github.com/hvrcharon1/agent-identity) by [Datacules LLC](https://datacules.com).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datacules/agent-identity-fastify",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "private": false,
5
5
  "description": "Fastify plugin for @datacules/agent-identity",
6
6
  "main": "./dist/cjs/index.js",