@gauts/auth 0.5.1 → 0.6.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.
- package/README.md +140 -98
- package/SECURITY.md +1 -1
- package/dist/adapters/hono/index.d.ts +15 -16
- package/dist/adapters/hono/index.d.ts.map +1 -1
- package/dist/adapters/hono/index.js +1 -3
- package/dist/adapters/hono/index.js.map +1 -1
- package/dist/adapters/prisma/config.d.ts +7 -0
- package/dist/adapters/prisma/config.d.ts.map +1 -0
- package/dist/adapters/prisma/config.js +151 -0
- package/dist/adapters/prisma/config.js.map +1 -0
- package/dist/adapters/prisma/index.d.ts +3 -48
- package/dist/adapters/prisma/index.d.ts.map +1 -1
- package/dist/adapters/prisma/index.js +12 -221
- package/dist/adapters/prisma/index.js.map +1 -1
- package/dist/adapters/prisma/model.d.ts +33 -0
- package/dist/adapters/prisma/model.d.ts.map +1 -0
- package/dist/adapters/prisma/model.js +110 -0
- package/dist/adapters/prisma/model.js.map +1 -0
- package/dist/adapters/prisma/types.d.ts +125 -0
- package/dist/adapters/prisma/types.d.ts.map +1 -0
- package/dist/adapters/prisma/types.js +2 -0
- package/dist/adapters/prisma/types.js.map +1 -0
- package/dist/auth.d.ts +6 -6
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +1 -1
- package/dist/auth.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/session/cache.d.ts +7 -7
- package/dist/session/cache.d.ts.map +1 -1
- package/dist/session/cache.js +4 -33
- package/dist/session/cache.js.map +1 -1
- package/dist/session/guards.d.ts +2 -2
- package/dist/session/guards.d.ts.map +1 -1
- package/dist/session/guards.js +12 -13
- package/dist/session/guards.js.map +1 -1
- package/dist/session/service.d.ts +4 -4
- package/dist/session/service.d.ts.map +1 -1
- package/dist/session/service.js +0 -4
- package/dist/session/service.js.map +1 -1
- package/dist/session/types.d.ts +20 -25
- package/dist/session/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -77,16 +77,6 @@ import { prisma } from "./db.js";
|
|
|
77
77
|
export const auth = createHonoAuth({
|
|
78
78
|
db: createPrismaAdapter({
|
|
79
79
|
client: prisma,
|
|
80
|
-
config: {
|
|
81
|
-
access: {
|
|
82
|
-
account: {
|
|
83
|
-
allowedStatuses: ["ACTIVE"],
|
|
84
|
-
},
|
|
85
|
-
user: {
|
|
86
|
-
allowedStatuses: ["ACTIVE"],
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
80
|
}),
|
|
91
81
|
});
|
|
92
82
|
```
|
|
@@ -107,12 +97,15 @@ cookies __ses, __cac, __ren
|
|
|
107
97
|
|
|
108
98
|
```ts
|
|
109
99
|
import { Hono } from "hono";
|
|
100
|
+
import type { AuthAccountOf } from "@gauts/auth";
|
|
110
101
|
import type { HonoAuthEnv } from "@gauts/auth/hono";
|
|
111
102
|
|
|
112
103
|
import { auth } from "./auth.js";
|
|
113
104
|
import { DUMMY_PASSWORD_HASH } from "./password.js";
|
|
114
105
|
|
|
115
|
-
|
|
106
|
+
type Account = AuthAccountOf<typeof auth>;
|
|
107
|
+
|
|
108
|
+
const app = new Hono<HonoAuthEnv<Account>>();
|
|
116
109
|
|
|
117
110
|
app.post("/auth/login", async (c) => {
|
|
118
111
|
const body = await c.req.json<{
|
|
@@ -153,7 +146,6 @@ app.get("/account", auth.requireSession, (c) => {
|
|
|
153
146
|
return c.json({
|
|
154
147
|
account: c.get("account"),
|
|
155
148
|
session: c.get("session"),
|
|
156
|
-
user: c.get("user"),
|
|
157
149
|
});
|
|
158
150
|
});
|
|
159
151
|
```
|
|
@@ -340,7 +332,7 @@ The cache is signed but not encrypted. Do not place passwords, password hashes,
|
|
|
340
332
|
role,
|
|
341
333
|
status,
|
|
342
334
|
timezone,
|
|
343
|
-
|
|
335
|
+
user: { id, role, status },
|
|
344
336
|
},
|
|
345
337
|
ses: {
|
|
346
338
|
id,
|
|
@@ -358,45 +350,122 @@ The cache is signed but not encrypted. Do not place passwords, password hashes,
|
|
|
358
350
|
|
|
359
351
|
### Prisma adapter
|
|
360
352
|
|
|
353
|
+
The default adapter requires the Prisma models `sessions` and `account`. The session model must expose an `account` relation. The account model must contain string `id`, `email`, and `password_hash` fields. Only `account.id` and `account.email` enter the payload by default.
|
|
354
|
+
|
|
355
|
+
#### Default models
|
|
356
|
+
|
|
357
|
+
```ts
|
|
358
|
+
const db = createPrismaAdapter({
|
|
359
|
+
client: prisma,
|
|
360
|
+
});
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
The resolved account payload is:
|
|
364
|
+
|
|
365
|
+
```ts
|
|
366
|
+
{
|
|
367
|
+
email: "owner@example.com",
|
|
368
|
+
id: "account-id",
|
|
369
|
+
}
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
#### Selected fields and access rules
|
|
373
|
+
|
|
374
|
+
`select` defines the public account payload. `access` defines the values required to authenticate:
|
|
375
|
+
|
|
376
|
+
```ts
|
|
377
|
+
const db = createPrismaAdapter({
|
|
378
|
+
client: prisma,
|
|
379
|
+
models: {
|
|
380
|
+
account: {
|
|
381
|
+
select: ["id", "email", "name", "role"],
|
|
382
|
+
access: {
|
|
383
|
+
role: ["OWNER", "ADMIN"],
|
|
384
|
+
status: ["ACTIVE"],
|
|
385
|
+
},
|
|
386
|
+
},
|
|
387
|
+
},
|
|
388
|
+
});
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
`status` is selected internally for validation but is not exposed because it is absent from `select`.
|
|
392
|
+
|
|
393
|
+
#### Custom models and nested relations
|
|
394
|
+
|
|
395
|
+
Use `name` when the Prisma delegate differs from the default. Nested relation keys must match the relation fields on the parent model:
|
|
396
|
+
|
|
361
397
|
```ts
|
|
362
398
|
const db = createPrismaAdapter({
|
|
363
399
|
client: prisma,
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
400
|
+
models: {
|
|
401
|
+
sessions: {
|
|
402
|
+
name: "admin_sessions",
|
|
403
|
+
},
|
|
404
|
+
account: {
|
|
405
|
+
name: "user_accounts",
|
|
406
|
+
select: ["id", "email", "name", "role", "status", "timezone"],
|
|
407
|
+
access: {
|
|
408
|
+
role: ["OWNER", "ADMIN"],
|
|
409
|
+
status: ["ACTIVE"],
|
|
410
|
+
},
|
|
411
|
+
relations: {
|
|
412
|
+
user: {
|
|
413
|
+
name: "users",
|
|
414
|
+
select: ["id", "role", "status"],
|
|
415
|
+
access: {
|
|
416
|
+
status: ["ACTIVE"],
|
|
417
|
+
},
|
|
418
|
+
},
|
|
419
|
+
},
|
|
420
|
+
},
|
|
421
|
+
},
|
|
383
422
|
});
|
|
384
423
|
```
|
|
385
424
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
425
|
+
This configuration uses `prisma.admin_sessions`, `prisma.user_accounts`, and `prisma.users`. The root relation on `admin_sessions` must still be named `account`.
|
|
426
|
+
|
|
427
|
+
When a relation name differs from its target model, the object key identifies the relation and `name` identifies the delegate:
|
|
428
|
+
|
|
429
|
+
```ts
|
|
430
|
+
relations: {
|
|
431
|
+
owner: {
|
|
432
|
+
name: "users",
|
|
433
|
+
select: ["id", "email", "status"],
|
|
434
|
+
access: {
|
|
435
|
+
status: ["ACTIVE"],
|
|
436
|
+
},
|
|
437
|
+
},
|
|
438
|
+
}
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
This loads the `account.owner` relation using the `prisma.users` model metadata.
|
|
442
|
+
|
|
443
|
+
| Property | Type / allowed values | Required | Default | Description |
|
|
444
|
+
| ------------------------------------- | ----------------------------------------- | :------: | -------------------- | --------------------------------------------------------------------------- |
|
|
445
|
+
| `client` | Generated Prisma client | ✅ | — | Prisma client containing every configured model. |
|
|
446
|
+
| `models.sessions.name` | Compatible session delegate name | ❌ | `"sessions"` | Overrides the Prisma model used to persist sessions. |
|
|
447
|
+
| `models.account.name` | Compatible account delegate name | ❌ | `"account"` | Identifies the account model and types its configuration. |
|
|
448
|
+
| `models.account.select` | Unique scalar field array | ❌ | `["id", "email"]` | Fields exposed in `account` and the signed cache. `id` is always included. |
|
|
449
|
+
| `models.account.access` | Scalar equality or allowed-value arrays | ❌ | `{}` | Conditions required for authentication. |
|
|
450
|
+
| `models.account.relations` | Relation configuration object | ❌ | `{}` | Additional required to-one relations loaded inside `account`. |
|
|
451
|
+
| `models.account.relations[key].name` | Compatible related-model delegate name | ❌ | Relation key | Identifies the related model and types its `select` and `access`. |
|
|
452
|
+
| `models.account.relations[key].select`| Unique scalar field array | ❌ | `["id"]` | Fields exposed under that relation. `id` is always included. |
|
|
453
|
+
| `models.account.relations[key].access`| Scalar equality or allowed-value arrays | ❌ | `{}` | Conditions required on the related record. |
|
|
454
|
+
|
|
455
|
+
The root Prisma relation on the session model is always named `account`. Keys inside `relations` are the actual Prisma relation field names. `name` identifies the target Prisma model/delegate; it does not rename a relation or a physical SQL table.
|
|
456
|
+
|
|
457
|
+
`select` accepts only JSON-safe scalar fields. It controls the public account payload and receives autocomplete from the generated Prisma client. Treat it as an explicit allowlist: never select passwords, password hashes, tokens, or other secrets because the cache is signed, not encrypted. Fields used only by `access` are selected for validation and removed before the account is exposed or cached.
|
|
458
|
+
|
|
459
|
+
Each `access` condition is either an exact scalar value or an array of accepted values:
|
|
460
|
+
|
|
461
|
+
```ts
|
|
462
|
+
access: {
|
|
463
|
+
active: true,
|
|
464
|
+
role: ["OWNER", "ADMIN"],
|
|
465
|
+
}
|
|
466
|
+
```
|
|
397
467
|
|
|
398
|
-
|
|
399
|
-
Every configured account and user condition must match. Omitting `allowedRoles` accepts every role, but both `allowedStatuses` lists remain required.
|
|
468
|
+
All configured conditions and nested relations must match. Omitting `access` applies no application-specific account restriction.
|
|
400
469
|
|
|
401
470
|
### Next.js adapter
|
|
402
471
|
|
|
@@ -422,7 +491,7 @@ export const nextAuth = createNextAuth({
|
|
|
422
491
|
credentials accepted
|
|
423
492
|
-> generate 256-bit opaque token
|
|
424
493
|
-> store SHA-256 token hash in DB
|
|
425
|
-
-> load current account and
|
|
494
|
+
-> load selected current account data and configured relations
|
|
426
495
|
-> apply configured access rules
|
|
427
496
|
-> write __ses
|
|
428
497
|
-> write __ren
|
|
@@ -436,7 +505,7 @@ Only the raw browser token authenticates. The database stores only its SHA-256 h
|
|
|
436
505
|
```text
|
|
437
506
|
session token
|
|
438
507
|
-> valid signed cache?
|
|
439
|
-
-> yes: expose cached account
|
|
508
|
+
-> yes: expose cached account and session
|
|
440
509
|
-> no: validate through DB and create a fresh cache
|
|
441
510
|
```
|
|
442
511
|
|
|
@@ -446,7 +515,7 @@ session token
|
|
|
446
515
|
session token
|
|
447
516
|
-> SHA-256 hash
|
|
448
517
|
-> indexed DB lookup
|
|
449
|
-
-> validate expiry, revocation, account,
|
|
518
|
+
-> validate expiry, revocation, account access, configured relations, and client
|
|
450
519
|
-> clear short cache
|
|
451
520
|
-> continue
|
|
452
521
|
```
|
|
@@ -466,39 +535,24 @@ Next reads __ren
|
|
|
466
535
|
|
|
467
536
|
## Prisma schema
|
|
468
537
|
|
|
469
|
-
The Prisma adapter resolves:
|
|
538
|
+
The default Prisma adapter resolves:
|
|
470
539
|
|
|
471
540
|
```text
|
|
472
|
-
|
|
541
|
+
sessions -> account
|
|
473
542
|
```
|
|
474
543
|
|
|
475
|
-
The following is a complete MySQL/MariaDB example.
|
|
544
|
+
The following is a complete MySQL/MariaDB example for email/password authentication. The account model requires `id`, `email`, and `password_hash`; the password hash is used only by the application's login query and never enters the session payload.
|
|
476
545
|
|
|
477
546
|
```prisma
|
|
478
|
-
model
|
|
479
|
-
id
|
|
480
|
-
|
|
481
|
-
|
|
547
|
+
model account {
|
|
548
|
+
id String @id @default(uuid()) @db.VarChar(255)
|
|
549
|
+
email String @unique @db.VarChar(255)
|
|
550
|
+
password_hash String @db.VarChar(255)
|
|
482
551
|
|
|
483
|
-
|
|
552
|
+
sessions sessions[]
|
|
484
553
|
}
|
|
485
554
|
|
|
486
|
-
model
|
|
487
|
-
id String @id @default(uuid()) @db.VarChar(255)
|
|
488
|
-
user_id String @db.VarChar(255)
|
|
489
|
-
email String @db.VarChar(255)
|
|
490
|
-
name String @db.VarChar(255)
|
|
491
|
-
role String @db.VarChar(255)
|
|
492
|
-
status String @db.VarChar(255)
|
|
493
|
-
timezone String? @db.VarChar(255)
|
|
494
|
-
|
|
495
|
-
user users @relation(fields: [user_id], references: [id], onDelete: Cascade)
|
|
496
|
-
sessions account_sessions[]
|
|
497
|
-
|
|
498
|
-
@@index([user_id])
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
model account_sessions {
|
|
555
|
+
model sessions {
|
|
502
556
|
id String @id @default(uuid()) @db.VarChar(255)
|
|
503
557
|
account_id String @db.VarChar(255)
|
|
504
558
|
token_hash String @unique @db.VarChar(64)
|
|
@@ -510,7 +564,7 @@ model account_sessions {
|
|
|
510
564
|
created_at DateTime @default(now()) @db.Timestamp(0)
|
|
511
565
|
updated_at DateTime? @db.Timestamp(0)
|
|
512
566
|
|
|
513
|
-
account
|
|
567
|
+
account account @relation(fields: [account_id], references: [id], onDelete: Cascade)
|
|
514
568
|
|
|
515
569
|
@@index([account_id])
|
|
516
570
|
@@index([expires_at])
|
|
@@ -520,17 +574,16 @@ model account_sessions {
|
|
|
520
574
|
|
|
521
575
|
Required fields and relation names:
|
|
522
576
|
|
|
523
|
-
| Path
|
|
524
|
-
|
|
|
525
|
-
| Session model
|
|
526
|
-
| `account` relation
|
|
527
|
-
| `account.user` relation | `id`, `role`, `status` |
|
|
577
|
+
| Path | Required fields |
|
|
578
|
+
| ------------------ | ------------------------------------------------------------------------------------------------------------------- |
|
|
579
|
+
| Session model | `id`, `account_id`, `token_hash`, `ip`, `platform`, `agent`, `expires_at`, `revoked_at`, `created_at`, `updated_at` |
|
|
580
|
+
| `account` relation | String `id`, `email`, and `password_hash` |
|
|
528
581
|
|
|
529
|
-
The relation
|
|
582
|
+
The session relation must be named `account`. Additional account fields and nested relations are selected through `models.account`. Application models may add fields, indexes, defaults, mappings, and relations. Access fields may use Prisma enums, strings, booleans, numbers, or null.
|
|
530
583
|
|
|
531
584
|
Keep `agent` large enough for the complete User-Agent. Use provider-compatible native annotations when the database is not MySQL/MariaDB.
|
|
532
585
|
|
|
533
|
-
`
|
|
586
|
+
`models.sessions.name` and every model `name` are Prisma client delegate names. Physical SQL table names remain an application concern and can use Prisma `@@map` without changing the adapter configuration.
|
|
534
587
|
|
|
535
588
|
Create and run migrations through the application's Prisma workflow. The package never manages migrations.
|
|
536
589
|
|
|
@@ -543,24 +596,11 @@ Create and run migrations through the application's Prisma workflow. The package
|
|
|
543
596
|
```ts
|
|
544
597
|
const account = c.get("account");
|
|
545
598
|
const session = c.get("session");
|
|
546
|
-
const user = c.get("user");
|
|
547
599
|
```
|
|
548
600
|
|
|
549
601
|
```ts
|
|
550
602
|
type AuthAccount = {
|
|
551
|
-
email: string;
|
|
552
603
|
id: string;
|
|
553
|
-
name: string;
|
|
554
|
-
role: string;
|
|
555
|
-
status: string;
|
|
556
|
-
timezone: string | null;
|
|
557
|
-
user: AuthUser;
|
|
558
|
-
};
|
|
559
|
-
|
|
560
|
-
type AuthUser = {
|
|
561
|
-
id: string;
|
|
562
|
-
role: string;
|
|
563
|
-
status: string;
|
|
564
604
|
};
|
|
565
605
|
|
|
566
606
|
type Session = {
|
|
@@ -577,14 +617,16 @@ type Session = {
|
|
|
577
617
|
};
|
|
578
618
|
```
|
|
579
619
|
|
|
580
|
-
|
|
620
|
+
The Prisma adapter refines `AuthAccount` with the exact fields and nested relations declared in `select`.
|
|
621
|
+
|
|
622
|
+
Only `account_id` is persisted in the session row. Current selected account data and configured relations are loaded through the database relation and never copied into the table.
|
|
581
623
|
|
|
582
624
|
### Methods
|
|
583
625
|
|
|
584
626
|
| Method | Purpose |
|
|
585
627
|
| --------------------------------------------- | -------------------------------------------------------------------------- |
|
|
586
628
|
| `auth.createSession({ account_id, context })` | Creates the DB session and writes the browser cookies. |
|
|
587
|
-
| `auth.resolveSession(context)` | Resolves a request and returns account
|
|
629
|
+
| `auth.resolveSession(context)` | Resolves a request and returns the selected account and session. |
|
|
588
630
|
| `auth.renewSession(context)` | Performs DB validation, renews when due, and writes authoritative cookies. |
|
|
589
631
|
| `auth.revokeSession(context)` | Revokes the current DB session and clears cookies. |
|
|
590
632
|
| `auth.clearSession(context)` | Clears browser cookies without revoking the DB session. |
|
|
@@ -699,17 +741,17 @@ const db = {
|
|
|
699
741
|
} satisfies DbAdapter;
|
|
700
742
|
```
|
|
701
743
|
|
|
702
|
-
`findToken` receives only the SHA-256 token hash. It must return the current
|
|
744
|
+
`findToken` receives only the SHA-256 token hash. It must return the current selected account plus an `allowed` result. Raw tokens must never be persisted.
|
|
703
745
|
|
|
704
746
|
## Performance
|
|
705
747
|
|
|
706
748
|
The package contains no Redis or in-process cache.
|
|
707
749
|
|
|
708
|
-
Without the optional browser cache, each `requireSession` performs an indexed database lookup through `
|
|
750
|
+
Without the optional browser cache, each `requireSession` performs an indexed database lookup through `sessions.token_hash`.
|
|
709
751
|
|
|
710
752
|
With a valid cache, `GET` and `HEAD` skip the lookup until `cache.ttl` expires. Unsafe methods always use current database state.
|
|
711
753
|
|
|
712
|
-
The tradeoff is explicit: revocation and account
|
|
754
|
+
The tradeoff is explicit: revocation and selected account or relation changes made elsewhere may remain visible to safe cached requests until the short TTL expires. A 60-second TTL limits this stale-read window to one minute. Disable cache when immediate read revocation is required.
|
|
713
755
|
|
|
714
756
|
## Errors
|
|
715
757
|
|
package/SECURITY.md
CHANGED
|
@@ -35,7 +35,7 @@ The optional browser cache is disabled when omitted. When configured, it is acce
|
|
|
35
35
|
|
|
36
36
|
The cache is bound to the opaque session token, its own expiry, the authoritative session expiry, and the configured client fields. Invalid cache data never authenticates a request; it causes normal database validation.
|
|
37
37
|
|
|
38
|
-
Cookie caching introduces a bounded consistency window. A session revoked on another device, or account
|
|
38
|
+
Cookie caching introduces a bounded consistency window. A session revoked on another device, or selected account or relation access changed in the database, may remain readable until the cache TTL expires. Unsafe methods, renewal, logout, WebSockets, and direct core calls always validate through the database. Applications requiring immediate cross-device read revocation must leave the cache disabled or provide shared server-side enforcement outside this package.
|
|
39
39
|
|
|
40
40
|
Keep `AUTH_SECRET` in the API environment. Do not expose it to browser code or share it with a frontend merely to inspect the renewal timestamp. The timestamp is intentionally untrusted and never authenticates or renews a session by itself.
|
|
41
41
|
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import type { Context, Env, MiddlewareHandler } from "hono";
|
|
2
2
|
import { type Auth, type AuthDeps } from "../../auth.js";
|
|
3
3
|
import { type SessionCacheConfig } from "../../session/cache.js";
|
|
4
|
-
import type { AuthAccount,
|
|
4
|
+
import type { AuthAccount, ResolvedSession, Session } from "../../session/types.js";
|
|
5
5
|
export type { SessionCacheConfig } from "../../session/cache.js";
|
|
6
6
|
import { type SessionCookieNames } from "../../session/cookie.js";
|
|
7
|
-
export type HonoAuthVariables = {
|
|
8
|
-
account:
|
|
7
|
+
export type HonoAuthVariables<TAccount extends AuthAccount = AuthAccount> = {
|
|
8
|
+
account: TAccount;
|
|
9
9
|
session: Session;
|
|
10
|
-
user: AuthUser;
|
|
11
10
|
};
|
|
12
|
-
export type HonoAuthEnv = Env & {
|
|
13
|
-
Variables: HonoAuthVariables
|
|
11
|
+
export type HonoAuthEnv<TAccount extends AuthAccount = AuthAccount> = Env & {
|
|
12
|
+
Variables: HonoAuthVariables<TAccount>;
|
|
14
13
|
};
|
|
15
14
|
export type HonoCookieConfig = {
|
|
16
15
|
cacheName?: string;
|
|
@@ -29,33 +28,33 @@ type HonoCacheOptions = {
|
|
|
29
28
|
cache?: undefined;
|
|
30
29
|
secret?: string;
|
|
31
30
|
};
|
|
32
|
-
export type HonoAdapterConfig = {
|
|
33
|
-
auth: Auth
|
|
31
|
+
export type HonoAdapterConfig<TAccount extends AuthAccount = AuthAccount> = {
|
|
32
|
+
auth: Auth<TAccount>;
|
|
34
33
|
cache?: SessionCacheConfig;
|
|
35
34
|
cookie?: HonoCookieConfig;
|
|
36
35
|
getIp?: HonoGetIp;
|
|
37
36
|
secret?: string;
|
|
38
37
|
};
|
|
39
|
-
type HonoAuthBase = AuthDeps & {
|
|
38
|
+
type HonoAuthBase<TAccount extends AuthAccount> = AuthDeps<TAccount> & {
|
|
40
39
|
cookie?: HonoCookieConfig;
|
|
41
40
|
getIp?: HonoGetIp;
|
|
42
41
|
};
|
|
43
|
-
export type HonoAuthConfig = HonoAuthBase & HonoCacheOptions;
|
|
42
|
+
export type HonoAuthConfig<TAccount extends AuthAccount = AuthAccount> = HonoAuthBase<TAccount> & HonoCacheOptions;
|
|
44
43
|
type CreateSessionInput = {
|
|
45
44
|
account_id: string;
|
|
46
45
|
context: Context;
|
|
47
46
|
};
|
|
48
|
-
export type HonoAdapter = {
|
|
47
|
+
export type HonoAdapter<TAccount extends AuthAccount = AuthAccount> = {
|
|
49
48
|
clearSession(c: Context): void;
|
|
50
49
|
cookie: Readonly<SessionCookieNames>;
|
|
51
50
|
createSession(input: CreateSessionInput): Promise<Session>;
|
|
52
51
|
getToken(c: Context): string | null;
|
|
53
52
|
renewSession(c: Context): Promise<Session>;
|
|
54
|
-
requireSession: MiddlewareHandler<HonoAuthEnv
|
|
55
|
-
resolveSession(c: Context): Promise<ResolvedSession
|
|
53
|
+
requireSession: MiddlewareHandler<HonoAuthEnv<TAccount>>;
|
|
54
|
+
resolveSession(c: Context): Promise<ResolvedSession<TAccount>>;
|
|
56
55
|
revokeSession(c: Context): Promise<string[]>;
|
|
57
56
|
};
|
|
58
|
-
export type HonoAuth = Auth & HonoAdapter
|
|
59
|
-
export declare const createHonoAdapter: ({ auth, cache, cookie, getIp, secret, }: HonoAdapterConfig) => HonoAdapter
|
|
60
|
-
export declare const createHonoAuth: ({ cache, cookie, db, getIp, password, secret, session, }: HonoAuthConfig) => HonoAuth
|
|
57
|
+
export type HonoAuth<TAccount extends AuthAccount = AuthAccount> = Auth<TAccount> & HonoAdapter<TAccount>;
|
|
58
|
+
export declare const createHonoAdapter: <TAccount extends AuthAccount>({ auth, cache, cookie, getIp, secret, }: HonoAdapterConfig<TAccount>) => HonoAdapter<TAccount>;
|
|
59
|
+
export declare const createHonoAuth: <TAccount extends AuthAccount>({ cache, cookie, db, getIp, password, secret, session, }: HonoAuthConfig<TAccount>) => HonoAuth<TAccount>;
|
|
61
60
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/hono/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAE5D,OAAO,EAAc,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGrE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/hono/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAE5D,OAAO,EAAc,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGrE,OAAO,EAGH,KAAK,kBAAkB,EAC1B,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEpF,YAAY,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAIH,KAAK,kBAAkB,EAC1B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E,yCAM7D,iBAAiB,CAAC,QAAQ,CAAC,KAAG,WAAW,CAAC,QAAQ,CAiOpD,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,QAAQ,SAAS,WAAW,EAAE,0DAQ1D,cAAc,CAAC,QAAQ,CAAC,KAAG,QAAQ,CAAC,QAAQ,CAiB9C,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { deleteCookie, getCookie, setCookie } from "hono/cookie";
|
|
2
2
|
import { createAuth } from "../../auth.js";
|
|
3
3
|
import { createError, isAuthError } from "../../errors.js";
|
|
4
|
-
import { createSessionCache } from "../../session/cache.js";
|
|
4
|
+
import { createSessionCache, } from "../../session/cache.js";
|
|
5
5
|
import { formatRenewAt, parseSessionToken, resolveSessionCookieNames, } from "../../session/cookie.js";
|
|
6
6
|
const resolveCookie = (config = {}) => {
|
|
7
7
|
const names = resolveSessionCookieNames(config);
|
|
@@ -151,7 +151,6 @@ export const createHonoAdapter = ({ auth, cache, cookie, getIp, secret, }) => {
|
|
|
151
151
|
const value = {
|
|
152
152
|
account: created.account,
|
|
153
153
|
session: created.session,
|
|
154
|
-
user: created.user,
|
|
155
154
|
};
|
|
156
155
|
setSession({ context, session: created.session, token: created.token });
|
|
157
156
|
setCache({ context, resolved: value, token: created.token });
|
|
@@ -210,7 +209,6 @@ export const createHonoAdapter = ({ auth, cache, cookie, getIp, secret, }) => {
|
|
|
210
209
|
const value = await resolveSession(c);
|
|
211
210
|
c.set("session", value.session);
|
|
212
211
|
c.set("account", value.account);
|
|
213
|
-
c.set("user", value.user);
|
|
214
212
|
await next();
|
|
215
213
|
};
|
|
216
214
|
const revokeSession = async (c) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/hono/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,UAAU,EAA4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,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;YACzC,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;YAC3C,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;YACzC,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;SAC9C,CAAC;KACL,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PrismaDelegate, ResolvedPrismaModels } from "./types.js";
|
|
2
|
+
export declare const isPrismaDelegate: (value: unknown) => value is PrismaDelegate;
|
|
3
|
+
export declare const resolvePrismaModels: ({ client, input, }: {
|
|
4
|
+
client: object;
|
|
5
|
+
input: unknown;
|
|
6
|
+
}) => ResolvedPrismaModels;
|
|
7
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/adapters/prisma/config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAER,cAAc,EAEd,oBAAoB,EACvB,MAAM,YAAY,CAAC;AAwBpB,eAAO,MAAM,gBAAgB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,cAU1D,CAAC;AAiJF,eAAO,MAAM,mBAAmB,GAAI,oBAGjC;IACC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;CAClB,KAAG,oBAkCH,CAAC"}
|