@absolutejs/auth 0.75.2 → 0.75.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 CHANGED
@@ -300,8 +300,9 @@ const authPlugin = await auth({
300
300
 
301
301
  With `registerDynamicClients` enabled, an RFC 7591 client becomes an agent
302
302
  registration. Approval through the existing RFC 8628 device flow creates the
303
- user-to-agent delegation. The agent can then use RFC 8693 token exchange to get
304
- a narrowed, audience-bound access token for the protected API.
303
+ user-to-agent delegation. Send the RFC 8707 `resource` value with device
304
+ authorization to bind the resulting token directly to the protected API, or
305
+ use RFC 8693 token exchange when narrowing an existing user token.
305
306
 
306
307
  When `requireDpop` is enabled, the adapter accepts only an RFC 9449-bound
307
308
  access token using the `DPoP` authorization scheme, verifies its per-request
@@ -313,6 +314,24 @@ claims containing query or fragment components fail closed. Resource servers
313
314
  that require RFC 9449 nonces can use the nonce helpers exported by
314
315
  `@absolutejs/auth/oidc` to issue a separate resource nonce challenge.
315
316
 
317
+ Client applications can use `createDpopClient` from `@absolutejs/auth/client`.
318
+ It creates a non-exportable P-256 private key, signs a fresh proof for every
319
+ request, adds `ath` and the case-sensitive `DPoP` authorization scheme when an
320
+ access token is supplied, and retries one authorization- or resource-server
321
+ nonce challenge. Give the two servers distinct `nonceScope` values when they
322
+ share an origin. Redirects remain manual so credentials and proofs are never
323
+ forwarded to an unverified location.
324
+
325
+ ```ts
326
+ import { createDpopClient } from '@absolutejs/auth/client';
327
+
328
+ const dpop = await createDpopClient();
329
+ const response = await dpop.fetch(resourceUrl, {
330
+ dpop: { accessToken, nonceScope: protectedResource },
331
+ method: 'POST'
332
+ });
333
+ ```
334
+
316
335
  ```ts
317
336
  app.get('/documents', ({ protectAgent }) =>
318
337
  protectAgent(['documents:read'], (agent) => ({
@@ -2827,6 +2827,7 @@ var oauthCodesTable = pgTable10("auth_oauth_codes", {
2827
2827
  user_id: varchar10("user_id", { length: ID_LENGTH8 }).notNull()
2828
2828
  });
2829
2829
  var oauthDeviceAuthorizationsTable = pgTable10("auth_oauth_device_authorizations", {
2830
+ audience: varchar10("audience", { length: 2048 }),
2830
2831
  client_id: varchar10("client_id", { length: ID_LENGTH8 }).notNull(),
2831
2832
  created_at_ms: bigint8("created_at_ms", { mode: "number" }).notNull(),
2832
2833
  device_code_hash: varchar10("device_code_hash", {
@@ -3341,6 +3342,10 @@ var oidcSocketTicketsMigration = {
3341
3342
  id: "0004_socket_tickets",
3342
3343
  sql: tablesToInitSql([oauthSocketTicketsTable])
3343
3344
  };
3345
+ var oidcDeviceAudienceMigration = {
3346
+ id: "0005_device_resource_audience",
3347
+ sql: 'ALTER TABLE "auth_oauth_device_authorizations" ADD COLUMN IF NOT EXISTS "audience" varchar(2048);'
3348
+ };
3344
3349
  var sessionOAuthSubjectMigration = {
3345
3350
  id: "0002_oauth_subject",
3346
3351
  sql: [
@@ -3416,7 +3421,8 @@ var blockMigrations = {
3416
3421
  ]).migrations,
3417
3422
  oidcResourceAudienceMigration,
3418
3423
  oidcRefreshTokenFamiliesMigration,
3419
- oidcSocketTicketsMigration
3424
+ oidcSocketTicketsMigration,
3425
+ oidcDeviceAudienceMigration
3420
3426
  ]
3421
3427
  },
3422
3428
  organizations: initMigration("organizations", [
@@ -3635,5 +3641,5 @@ var main = async () => {
3635
3641
  };
3636
3642
  await main();
3637
3643
 
3638
- //# debugId=3B381D4CCB9C631A64756E2164756E21
3644
+ //# debugId=A94ED948A86827BA64756E2164756E21
3639
3645
  //# sourceMappingURL=migrate.js.map