@datacules/agent-identity-store-dynamic 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 +43 -57
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,10 @@
1
+ <p align="center">
2
+ <img src="../../../assets/logo.svg" alt="Agent Identity — by Datacules LLC" width="360"/>
3
+ </p>
4
+
1
5
  # `@datacules/agent-identity-store-dynamic`
2
6
 
3
- Just-in-time credential provisioning for [`@datacules/agent-identity`](../../core). Credentials don't exist until the agent requests them minted on demand with a short TTL, revoked automatically by the upstream system.
7
+ JIT (Just-in-Time) credential provisioning store for the agent-identity framework. Mints short-lived secrets on demand via Vault dynamic secrets, AWS IAM Roles Anywhere, or Azure Managed Identity. Zero static secrets at rest.
4
8
 
5
9
  ## Install
6
10
 
@@ -8,74 +12,56 @@ Just-in-time credential provisioning for [`@datacules/agent-identity`](../../cor
8
12
  npm install @datacules/agent-identity-store-dynamic
9
13
  ```
10
14
 
11
- ## Why JIT?
12
-
13
- With static credential stores, long-lived secrets sit at rest — if the store is compromised, every credential in it is exposed. With JIT provisioning, there are no stored secrets: the store calls your vault on every resolution and gets back a short-lived lease. After the TTL (15–60 minutes) the upstream system revokes the secret automatically. The blast radius of any store compromise collapses to a single active session at most.
14
-
15
15
  ## Usage
16
16
 
17
- ### Vault dynamic secrets
18
-
19
17
  ```typescript
20
- import { DynamicCredentialStore, VaultDynamicProvisioner } from '@datacules/agent-identity-store-dynamic';
21
- import { createRouterFromStore } from '@datacules/agent-identity';
18
+ import { DynamicCredentialStore } from '@datacules/agent-identity-store-dynamic';
19
+ import { createRouterFromStore } from '@datacules/agent-identity';
22
20
 
21
+ // Vault dynamic secrets
23
22
  const store = new DynamicCredentialStore({
24
- provisioner: new VaultDynamicProvisioner({
25
- vaultAddr: 'http://vault:8200',
26
- token: process.env.VAULT_TOKEN!,
27
- mount: 'database',
28
- role: 'crm-readonly',
29
- ttl: '30m',
30
- }),
23
+ provisioner: 'vault-dynamic',
24
+ vaultAddr: process.env.VAULT_ADDR!,
25
+ vaultToken: process.env.VAULT_TOKEN!,
26
+ roleName: 'agent-identity-db-role',
27
+ ttl: '1h',
31
28
  });
32
29
 
33
- const router = createRouterFromStore(store, rules, logger);
34
- const resolved = await router.resolveAsync(ctx);
35
- // resolved.ref → Vault lease ID — use this to fetch the actual secret server-side
36
- // resolved.expiresAt → when the lease expires
37
- ```
38
-
39
- ### AWS IAM Roles Anywhere
40
-
41
- ```typescript
42
- import { DynamicCredentialStore, AwsRolesAnywhereProvisioner } from '@datacules/agent-identity-store-dynamic';
30
+ // AWS IAM Roles Anywhere
31
+ const store = new DynamicCredentialStore({
32
+ provisioner: 'aws-iam-roles-anywhere',
33
+ profileArn: 'arn:aws:rolesanywhere:us-east-1:...',
34
+ roleArn: 'arn:aws:iam::...:role/AgentIdentityRole',
35
+ trustAnchorArn: 'arn:aws:rolesanywhere:us-east-1:...',
36
+ certificatePath: '/run/spire/svid.pem',
37
+ privateKeyPath: '/run/spire/svid-key.pem',
38
+ });
43
39
 
40
+ // Azure Managed Identity
44
41
  const store = new DynamicCredentialStore({
45
- provisioner: new AwsRolesAnywhereProvisioner({
46
- profileArn: 'arn:aws:rolesanywhere:us-east-1:...',
47
- roleArn: 'arn:aws:iam::...:role/agent-role',
48
- trustAnchorArn: 'arn:aws:rolesanywhere:us-east-1:...',
49
- region: 'us-east-1',
50
- durationSeconds: 3600,
51
- }),
42
+ provisioner: 'azure-managed-identity',
43
+ resource: 'https://management.azure.com/',
44
+ clientId: process.env.AZURE_CLIENT_ID, // optional for user-assigned MI
52
45
  });
46
+
47
+ const router = createRouterFromStore(store, rules, logger);
53
48
  ```
54
49
 
55
- ### Custom provisioner
50
+ ## How it works
56
51
 
57
- ```typescript
58
- import type { DynamicProvisioner, ProvisionedSecret } from '@datacules/agent-identity-store-dynamic';
59
-
60
- class MyProvisioner implements DynamicProvisioner {
61
- id = 'my-vault';
62
-
63
- async provision(ref: string): Promise<ProvisionedSecret> {
64
- // Call your secret management system here
65
- const { leaseId, ttlSeconds, secret } = await myVault.issue(ref);
66
- return {
67
- leaseId,
68
- expiresAt: new Date(Date.now() + ttlSeconds * 1000).toISOString(),
69
- secret,
70
- };
71
- }
72
-
73
- async revoke(leaseId: string): Promise<void> {
74
- await myVault.revoke(leaseId);
75
- }
76
- }
77
- ```
52
+ 1. On the first `findByRef(ref)` call for a slot, the provisioner mints a new secret (DB password, IAM session token, etc.) from the backend.
53
+ 2. The minted credential is cached in-memory until 60 seconds before its TTL expires.
54
+ 3. On expiry, the next `findByRef()` call provisions a fresh secret automatically.
55
+ 4. A full store compromise reveals only the cached in-flight secrets — no long-lived secrets exist anywhere.
56
+
57
+ ## TTL considerations
58
+
59
+ | Provisioner | Typical TTL | Backend revocation |
60
+ |-------------|-------------|--------------------|
61
+ | Vault dynamic secrets | 1 h (configurable) | Vault lease revocation API |
62
+ | AWS IAM Roles Anywhere | 1 h (max 12 h) | IAM session revocation |
63
+ | Azure Managed Identity | 24 h | Azure AD token revocation |
78
64
 
79
- ## Caching
65
+ ---
80
66
 
81
- By default, unexpired leases are cached in memory and reused until 60 seconds before expiry (configurable via `renewBeforeExpireSeconds`). Set `cache: false` to provision a fresh lease on every resolution.
67
+ 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-store-dynamic",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "private": false,
5
5
  "description": "Just-in-time credential provisioning store for @datacules/agent-identity — mints short-lived secrets on demand via Vault dynamic secrets or AWS IAM Roles Anywhere",
6
6
  "author": "Datacules LLC",