@absolutejs/auth 0.54.9 → 0.55.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 (44) hide show
  1. package/README.md +19 -5
  2. package/dist/agents/config.d.ts +16 -0
  3. package/dist/agents/idJag.d.ts +49 -0
  4. package/dist/agents/inMemoryStores.d.ts +2 -1
  5. package/dist/agents/index.d.ts +5 -2
  6. package/dist/agents/index.js +1391 -66
  7. package/dist/agents/index.js.map +12 -8
  8. package/dist/agents/postgresStores.d.ts +280 -1
  9. package/dist/agents/registration.d.ts +162 -0
  10. package/dist/agents/registrationClient.d.ts +50 -0
  11. package/dist/agents/routes.d.ts +112 -1
  12. package/dist/agents/types.d.ts +59 -0
  13. package/dist/apikeys/routes.d.ts +2 -2
  14. package/dist/cli/migrate.js +57 -8
  15. package/dist/cli/migrate.js.map +4 -4
  16. package/dist/credentials/login.d.ts +4 -4
  17. package/dist/credentials/routes.d.ts +4 -4
  18. package/dist/index.d.ts +185 -2
  19. package/dist/index.js +1388 -102
  20. package/dist/index.js.map +15 -12
  21. package/dist/manifest.js +12 -6
  22. package/dist/manifest.js.map +4 -4
  23. package/dist/manifest.json +2 -2
  24. package/dist/mfa/routes.d.ts +2 -2
  25. package/dist/mfa/sms.d.ts +2 -2
  26. package/dist/oidc/clientAuth.d.ts +6 -2
  27. package/dist/oidc/config.d.ts +19 -5
  28. package/dist/oidc/keys.d.ts +7 -3
  29. package/dist/oidc/logout.d.ts +2 -2
  30. package/dist/oidc/routes.d.ts +13 -11
  31. package/dist/organizations/routes.d.ts +1 -1
  32. package/dist/portal/routes.d.ts +3 -3
  33. package/dist/roles/routes.d.ts +1 -1
  34. package/dist/routes/refresh.d.ts +1 -1
  35. package/dist/routes/revoke.d.ts +1 -1
  36. package/dist/routes/sessions.d.ts +3 -3
  37. package/dist/sso/discoveryRoute.d.ts +1 -1
  38. package/dist/sso/oidcRoutes.d.ts +2 -2
  39. package/dist/sso/samlRoutes.d.ts +4 -4
  40. package/docs/AGENT-AUTH.md +54 -0
  41. package/docs/MIGRATE-FROM-LUCIA.md +235 -0
  42. package/docs/OAUTH-PROVIDER-QUIRKS.md +150 -0
  43. package/docs/UI-COMPONENTS.md +226 -0
  44. package/package.json +6 -3
package/README.md CHANGED
@@ -77,11 +77,13 @@ import { createSimpleWebAuthnAdapter } from '@absolutejs/auth/webauthn';
77
77
 
78
78
  ### Delegated AI agents
79
79
 
80
- The `agentAuth` block provides a standards-first agent identity layer without
81
- depending on a vendor registration protocol. It publishes RFC 9728 protected
82
- resource metadata, records agent registrations and user delegations, and adds a
83
- scoped `protectAgent` guard. Protocol-specific credentials are normalized by a
84
- verifier adapter:
80
+ The `agentAuth` block provides a standards-first agent identity layer. It
81
+ publishes RFC 9728 metadata, records registrations and user delegations, and
82
+ adds a scoped `protectAgent` guard. It can also serve a generated `/auth.md`
83
+ registration guide and matching structured OAuth metadata. This is native to
84
+ `@absolutejs/auth`; no WorkOS service or separate package is required.
85
+
86
+ Protocol-specific credentials are normalized by verifier adapters:
85
87
 
86
88
  ```ts
87
89
  import {
@@ -133,6 +135,18 @@ app.get('/documents', ({ protectAgent }) =>
133
135
  Postgres and Neon registration/delegation stores are exported alongside the
134
136
  in-memory stores. Include the `agents` migration block in production.
135
137
 
138
+ For agents that need to create or link an account, configure
139
+ `agentAuth.agentRegistration` with an identity-registration store, access-token
140
+ store, signing key, authenticated-user resolver, and post-claim scopes. Enable
141
+ `service_auth` or anonymous registration explicitly; anonymous registration
142
+ also requires an idempotent callback that revokes every pre-claim token before
143
+ ownership changes. Absolute exposes provider and consumer helpers from
144
+ `@absolutejs/auth/agents`, including ID-JAG issuance and verification, secure
145
+ RFC 9728/RFC 8414 discovery, claim polling, and assertion exchange.
146
+
147
+ See [the agent-auth interoperability and deployment guide](docs/AGENT-AUTH.md)
148
+ for supported standards, security invariants, and the production checklist.
149
+
136
150
  ### Features
137
151
 
138
152
  - **Authorization**: Handles the authorization process by generating the authorization URL and redirecting the user to the authentication provider.
@@ -1,14 +1,30 @@
1
1
  import type { RouteString } from '../types';
2
2
  import type { AgentCredentialVerifier, AgentDelegationStore, AgentRegistrationStore } from './types';
3
+ import type { AgentRegistrationProtocolConfig } from './registration';
3
4
  export declare const DEFAULT_AGENT_RESOURCE_METADATA_ROUTE: RouteString;
5
+ export type AgentRegistrationDiscoveryMetadata = {
6
+ claim_endpoint: string;
7
+ identity_assertion: {
8
+ assertion_types_supported: string[];
9
+ };
10
+ identity_endpoint: string;
11
+ identity_types_supported: string[];
12
+ skill: string;
13
+ };
4
14
  export type AgentAuthConfig = {
5
15
  /** Permit registered agents to authenticate without a user delegation. Secure
6
16
  * default is false; enable for machine-only resources. */
7
17
  allowUndelegated?: boolean;
18
+ /** Open auth.md agent-registration support. Implemented natively by Absolute
19
+ * Auth and projected through OAuth discovery; no WorkOS service is required. */
20
+ agentRegistration?: AgentRegistrationProtocolConfig;
8
21
  authorizationServer: string;
9
22
  delegationStore: AgentDelegationStore;
10
23
  logoUri?: string;
11
24
  metadataRoute?: RouteString;
25
+ /** Authorization-server route prefix. Defaults to `/oauth2`; used to derive
26
+ * the authoritative token endpoint advertised by the generated guide. */
27
+ oidcRoute?: RouteString;
12
28
  registrationStore: AgentRegistrationStore;
13
29
  /** Treat clients created through RFC 7591 DCR as agent registrations. Explicitly
14
30
  * opt-in because a deployment may also use DCR for ordinary relying parties. */
@@ -0,0 +1,49 @@
1
+ import { type SigningKey } from '../oidc/keys';
2
+ import type { VerifiedAgentIdentityAssertion } from './types';
3
+ export type AgentIdentityAssertionJtiStore = {
4
+ /** Atomically records an issuer+jti pair. Returns false for a replay. */
5
+ recordIfFresh: (issuer: string, jti: string, expiresAt: number) => Promise<boolean>;
6
+ };
7
+ export declare const createInMemoryAgentIdentityAssertionJtiStore: () => AgentIdentityAssertionJtiStore;
8
+ export type AgentIdentityAssertionUser = {
9
+ authenticatedAt: number;
10
+ email?: string;
11
+ emailVerified?: boolean;
12
+ methods?: string[];
13
+ name?: string;
14
+ phoneNumber?: string;
15
+ phoneNumberVerified?: boolean;
16
+ subject: string;
17
+ };
18
+ /** Native provider-side ID-JAG issuance. The caller owns the user consent UI
19
+ * and must authorize the requested audience before invoking this helper. */
20
+ export declare const issueAgentIdentityAssertion: ({ agentContextId, agentPlatform, audience, clientId, issuer, now, resource, signingKey, ttlMs, user }: {
21
+ agentContextId?: string;
22
+ agentPlatform?: string;
23
+ audience: string;
24
+ clientId: string;
25
+ issuer: string;
26
+ now?: number;
27
+ resource?: string;
28
+ signingKey: SigningKey;
29
+ ttlMs?: number;
30
+ user: AgentIdentityAssertionUser;
31
+ }) => Promise<{
32
+ assertion: string;
33
+ assertionType: "urn:ietf:params:oauth:token-type:id-jag";
34
+ expiresAt: number;
35
+ }>;
36
+ /** Builds a fail-closed service-side verifier. Issuer resolution is injected so
37
+ * the application can use pinned configuration, CIMD, or an egress-guarded
38
+ * JWKS resolver without this package performing ambient network access. */
39
+ export declare const createAgentIdentityAssertionVerifier: ({ audience, clockSkewMs, jtiStore, maxAssertionLifetimeMs, maxAuthenticationAgeMs, resolveIssuer }: {
40
+ audience: string;
41
+ clockSkewMs?: number;
42
+ jtiStore: AgentIdentityAssertionJtiStore;
43
+ maxAssertionLifetimeMs?: number;
44
+ maxAuthenticationAgeMs?: number;
45
+ resolveIssuer: (issuer: string) => Promise<{
46
+ allowedClientIds?: string[];
47
+ publicJwk: JsonWebKey;
48
+ } | undefined>;
49
+ }) => (assertion: string, now?: number) => Promise<VerifiedAgentIdentityAssertion | undefined>;
@@ -1,3 +1,4 @@
1
- import type { AgentDelegationStore, AgentRegistrationStore } from './types';
1
+ import type { AgentDelegationStore, AgentIdentityRegistrationStore, AgentRegistrationStore } from './types';
2
2
  export declare const createInMemoryAgentDelegationStore: () => AgentDelegationStore;
3
+ export declare const createInMemoryAgentIdentityRegistrationStore: () => AgentIdentityRegistrationStore;
3
4
  export declare const createInMemoryAgentRegistrationStore: () => AgentRegistrationStore;
@@ -1,8 +1,11 @@
1
1
  export * from './config';
2
2
  export * from './types';
3
+ export * from './registration';
4
+ export * from './registrationClient';
5
+ export * from './idJag';
3
6
  export * from '../oidc/clientIdMetadata';
4
7
  export { createOidcAgentCredentialVerifier } from './oidcAdapter';
5
8
  export { agentHasScopes, resolveAgentPrincipal } from './principal';
6
9
  export { agentAuthChallenge, agentAuthPlugin } from './routes';
7
- export { createInMemoryAgentDelegationStore, createInMemoryAgentRegistrationStore } from './inMemoryStores';
8
- export { agentDelegationsTable, agentRegistrationsTable, createNeonAgentDelegationStore, createNeonAgentRegistrationStore, createPostgresAgentDelegationStore, createPostgresAgentRegistrationStore } from './postgresStores';
10
+ export { createInMemoryAgentDelegationStore, createInMemoryAgentIdentityRegistrationStore, createInMemoryAgentRegistrationStore } from './inMemoryStores';
11
+ export { agentDelegationsTable, agentIdentityRegistrationsTable, agentRegistrationsTable, createNeonAgentDelegationStore, createNeonAgentIdentityRegistrationStore, createNeonAgentRegistrationStore, createPostgresAgentDelegationStore, createPostgresAgentIdentityRegistrationStore, createPostgresAgentRegistrationStore } from './postgresStores';