@sixb/core 0.1.19 → 0.1.20
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/dist/actions/index.js +24 -24
- package/dist/agents/index.js +25 -25
- package/dist/agents/index.js.map +1 -1
- package/dist/auth/cookies.d.ts +2 -4
- package/dist/auth/cookies.d.ts.map +1 -1
- package/dist/auth/index.d.ts +0 -2
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +8 -14
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/runtime.d.ts +8 -10
- package/dist/auth/runtime.d.ts.map +1 -1
- package/dist/auth/session-cache.d.ts +1 -5
- package/dist/auth/session-cache.d.ts.map +1 -1
- package/dist/auth/strategy.js +1 -1
- package/dist/auth/types.d.ts +4 -8
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/auth/validation.d.ts +0 -1
- package/dist/auth/validation.d.ts.map +1 -1
- package/dist/authorization/decision.d.ts +0 -4
- package/dist/authorization/decision.d.ts.map +1 -1
- package/dist/authorization/grant-kinds.d.ts +6 -8
- package/dist/authorization/grant-kinds.d.ts.map +1 -1
- package/dist/authorization/index.d.ts +0 -1
- package/dist/authorization/index.d.ts.map +1 -1
- package/dist/authorization/index.js +3 -7
- package/dist/authorization/index.js.map +1 -1
- package/dist/authorization/resolve.d.ts +1 -1
- package/dist/authorization/resolve.d.ts.map +1 -1
- package/dist/bootstrap/index.js +26 -26
- package/dist/{chunk-aff7cyea.js → chunk-0rbyz4qy.js} +21 -21
- package/dist/{chunk-aff7cyea.js.map → chunk-0rbyz4qy.js.map} +1 -1
- package/dist/{chunk-rz53yb4v.js → chunk-0yh890a4.js} +1 -1
- package/dist/{chunk-7mbzgd9m.js → chunk-1zq2p6g0.js} +1 -1
- package/dist/{chunk-dnmadg9k.js → chunk-3t2hgbgd.js} +2 -2
- package/dist/{chunk-wwdfe68s.js → chunk-4vyr1j8f.js} +2 -2
- package/dist/{chunk-kyzq4wy9.js → chunk-5j58wjct.js} +15 -15
- package/dist/chunk-5j58wjct.js.map +18 -0
- package/dist/{chunk-ey3pyej1.js → chunk-6c6sn0bh.js} +29 -24
- package/dist/{chunk-ey3pyej1.js.map → chunk-6c6sn0bh.js.map} +3 -3
- package/dist/{chunk-q1vkr2ys.js → chunk-6p49a5cq.js} +2 -2
- package/dist/{chunk-nre82s12.js → chunk-9dmt152s.js} +1 -1
- package/dist/{chunk-7kg3k1m9.js → chunk-9w055r5b.js} +1 -1
- package/dist/{chunk-4tcx876c.js → chunk-bx9q3cwv.js} +15 -15
- package/dist/{chunk-4tcx876c.js.map → chunk-bx9q3cwv.js.map} +1 -1
- package/dist/{chunk-bpgy64fw.js → chunk-d09tj99x.js} +1 -1
- package/dist/{chunk-y7rqfrgg.js → chunk-d0bqz29d.js} +23 -36
- package/dist/chunk-d0bqz29d.js.map +23 -0
- package/dist/{chunk-rhg02hxq.js → chunk-dk8tkk5f.js} +3 -3
- package/dist/{chunk-xt1zt7gv.js → chunk-es1gxsbf.js} +24 -15
- package/dist/chunk-es1gxsbf.js.map +13 -0
- package/dist/{chunk-52bk93x8.js → chunk-fkgc1wt8.js} +1 -1
- package/dist/{chunk-enpsx8k5.js → chunk-gsjm1wms.js} +16 -20
- package/dist/chunk-gsjm1wms.js.map +10 -0
- package/dist/{chunk-2jntasmh.js → chunk-hcbyfxbe.js} +25 -49
- package/dist/chunk-hcbyfxbe.js.map +12 -0
- package/dist/{chunk-zrmy8zvw.js → chunk-hjzdd750.js} +3 -3
- package/dist/chunk-hkc3jct7.js.map +1 -1
- package/dist/{chunk-85yvv5n0.js → chunk-k6q3n2sc.js} +3 -3
- package/dist/{chunk-j2bp5ryw.js → chunk-n33z5bjw.js} +11 -10
- package/dist/{chunk-j2bp5ryw.js.map → chunk-n33z5bjw.js.map} +3 -3
- package/dist/{chunk-80mc0971.js → chunk-ren4kg2j.js} +8 -8
- package/dist/{chunk-1f7wpmyp.js → chunk-rrzt8jdy.js} +2 -2
- package/dist/{chunk-6gmfggss.js → chunk-t7x8dmn0.js} +2 -2
- package/dist/{chunk-wz0xs816.js → chunk-tg2cw67r.js} +1 -1
- package/dist/{chunk-3gnrh4ve.js → chunk-vpq4shxz.js} +46 -106
- package/dist/chunk-vpq4shxz.js.map +39 -0
- package/dist/{chunk-bwjcehza.js → chunk-way52z4h.js} +1 -1
- package/dist/{chunk-tjb1mk5t.js → chunk-x6m907x7.js} +2 -2
- package/dist/{chunk-t6vq7bff.js → chunk-xfs8x8m9.js} +3 -3
- package/dist/{chunk-d2ync1v3.js → chunk-yevzdx4y.js} +3 -3
- package/dist/{chunk-kg5j6fct.js → chunk-z4m0yz8c.js} +1 -1
- package/dist/datasets/write.js +5 -5
- package/dist/deploy/internal.js +4 -3
- package/dist/deploy/internal.js.map +4 -4
- package/dist/deploy/services.d.ts.map +1 -1
- package/dist/deploy/types.d.ts +1 -2
- package/dist/deploy/types.d.ts.map +1 -1
- package/dist/execution/agent.js +24 -24
- package/dist/execution/authorization.d.ts.map +1 -1
- package/dist/execution/primitive.js +24 -24
- package/dist/execution/request.js +23 -23
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -46
- package/dist/index.js.map +1 -1
- package/dist/lake-storage/index.js +5 -5
- package/dist/materializer/index.js +13 -13
- package/dist/models/execution/index.js +10 -10
- package/dist/objects/index.js +24 -24
- package/dist/objects/query/index.js +12 -12
- package/dist/objects/vectors/handle.d.ts.map +1 -1
- package/dist/objects/vectors/profile.d.ts +5 -0
- package/dist/objects/vectors/profile.d.ts.map +1 -1
- package/dist/ontology/index.js +3 -3
- package/dist/pipelines/index.js +15 -15
- package/dist/projections/internal.js +13 -13
- package/dist/runtime/internal.js +13 -13
- package/dist/security/builders.d.ts.map +1 -1
- package/dist/security/every.d.ts +1 -4
- package/dist/security/every.d.ts.map +1 -1
- package/dist/security/grants.d.ts +2 -4
- package/dist/security/grants.d.ts.map +1 -1
- package/dist/security/index.d.ts +1 -2
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/membership-policies.d.ts.map +1 -1
- package/dist/security/public.d.ts +10 -0
- package/dist/security/public.d.ts.map +1 -0
- package/dist/security/public.js +10 -0
- package/dist/security/public.js.map +9 -0
- package/dist/security/registry.d.ts +0 -1
- package/dist/security/registry.d.ts.map +1 -1
- package/dist/security/types.d.ts +13 -18
- package/dist/security/types.d.ts.map +1 -1
- package/dist/security/validation.d.ts +0 -6
- package/dist/security/validation.d.ts.map +1 -1
- package/dist/shares/internal.js +10 -10
- package/dist/storage/agents/types.d.ts +1 -1
- package/dist/storage/auth/in-memory/auth-storage.d.ts.map +1 -1
- package/dist/storage/auth/in-memory/magic-links.d.ts.map +1 -1
- package/dist/storage/auth/in-memory/oidc-attempts.d.ts.map +1 -1
- package/dist/storage/auth/in-memory/sessions.d.ts +0 -10
- package/dist/storage/auth/in-memory/sessions.d.ts.map +1 -1
- package/dist/storage/auth/in-memory/shared.d.ts +1 -2
- package/dist/storage/auth/in-memory/shared.d.ts.map +1 -1
- package/dist/storage/auth/types.d.ts +1 -17
- package/dist/storage/auth/types.d.ts.map +1 -1
- package/dist/storage/file-upload-sessions/provider.js +6 -6
- package/dist/storage/index.js +21 -21
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/workflow-runs/provider.js +6 -6
- package/dist/syncs/index.js +16 -16
- package/dist/testing/auth-storage-contract.d.ts.map +1 -1
- package/dist/testing/index.js +41 -124
- package/dist/testing/index.js.map +4 -4
- package/dist/webhooks/internal.js +11 -11
- package/dist/workflows/index.js +25 -25
- package/package.json +8 -2
- package/src/auth/cookies.ts +3 -20
- package/src/auth/index.ts +0 -6
- package/src/auth/runtime.ts +59 -76
- package/src/auth/session-cache.ts +2 -9
- package/src/auth/types.ts +4 -8
- package/src/auth/validation.ts +0 -2
- package/src/authorization/decision.ts +8 -23
- package/src/authorization/grant-kinds.ts +20 -27
- package/src/authorization/index.ts +0 -1
- package/src/authorization/resolve.ts +10 -6
- package/src/deploy/services.ts +0 -1
- package/src/deploy/types.ts +1 -2
- package/src/deploy/validation.ts +3 -1
- package/src/execution/authorization.ts +11 -5
- package/src/index.ts +1 -14
- package/src/models/execution/embedding.ts +6 -6
- package/src/objects/vectors/README.md +4 -0
- package/src/objects/vectors/handle.ts +11 -2
- package/src/objects/vectors/indexing-generate.ts +2 -2
- package/src/objects/vectors/profile.ts +5 -0
- package/src/security/builders.ts +7 -2
- package/src/security/every.ts +0 -4
- package/src/security/grants.ts +5 -25
- package/src/security/index.ts +0 -3
- package/src/security/membership-policies.ts +3 -1
- package/src/security/public.ts +10 -0
- package/src/security/registry.ts +0 -8
- package/src/security/types.ts +19 -25
- package/src/security/validation.ts +19 -17
- package/src/storage/agents/types.ts +1 -1
- package/src/storage/auth/in-memory/auth-storage.ts +0 -18
- package/src/storage/auth/in-memory/magic-links.ts +0 -3
- package/src/storage/auth/in-memory/oidc-attempts.ts +0 -3
- package/src/storage/auth/in-memory/sessions.ts +1 -25
- package/src/storage/auth/in-memory/shared.ts +1 -10
- package/src/storage/auth/types.ts +2 -18
- package/src/testing/auth-storage-contract.ts +14 -107
- package/src/testing/execution-storage-contract.ts +0 -2
- package/dist/auth/audience.d.ts +0 -8
- package/dist/auth/audience.d.ts.map +0 -1
- package/dist/authorization/application-access.d.ts +0 -18
- package/dist/authorization/application-access.d.ts.map +0 -1
- package/dist/chunk-2jntasmh.js.map +0 -13
- package/dist/chunk-3gnrh4ve.js.map +0 -40
- package/dist/chunk-enpsx8k5.js.map +0 -10
- package/dist/chunk-kyzq4wy9.js.map +0 -18
- package/dist/chunk-xt1zt7gv.js.map +0 -13
- package/dist/chunk-y7rqfrgg.js.map +0 -24
- package/dist/security/applications.d.ts +0 -15
- package/dist/security/applications.d.ts.map +0 -1
- package/src/auth/audience.ts +0 -28
- package/src/authorization/application-access.ts +0 -34
- package/src/security/applications.ts +0 -11
- /package/dist/{chunk-rz53yb4v.js.map → chunk-0yh890a4.js.map} +0 -0
- /package/dist/{chunk-7mbzgd9m.js.map → chunk-1zq2p6g0.js.map} +0 -0
- /package/dist/{chunk-dnmadg9k.js.map → chunk-3t2hgbgd.js.map} +0 -0
- /package/dist/{chunk-wwdfe68s.js.map → chunk-4vyr1j8f.js.map} +0 -0
- /package/dist/{chunk-q1vkr2ys.js.map → chunk-6p49a5cq.js.map} +0 -0
- /package/dist/{chunk-nre82s12.js.map → chunk-9dmt152s.js.map} +0 -0
- /package/dist/{chunk-7kg3k1m9.js.map → chunk-9w055r5b.js.map} +0 -0
- /package/dist/{chunk-bpgy64fw.js.map → chunk-d09tj99x.js.map} +0 -0
- /package/dist/{chunk-rhg02hxq.js.map → chunk-dk8tkk5f.js.map} +0 -0
- /package/dist/{chunk-52bk93x8.js.map → chunk-fkgc1wt8.js.map} +0 -0
- /package/dist/{chunk-zrmy8zvw.js.map → chunk-hjzdd750.js.map} +0 -0
- /package/dist/{chunk-85yvv5n0.js.map → chunk-k6q3n2sc.js.map} +0 -0
- /package/dist/{chunk-80mc0971.js.map → chunk-ren4kg2j.js.map} +0 -0
- /package/dist/{chunk-1f7wpmyp.js.map → chunk-rrzt8jdy.js.map} +0 -0
- /package/dist/{chunk-6gmfggss.js.map → chunk-t7x8dmn0.js.map} +0 -0
- /package/dist/{chunk-wz0xs816.js.map → chunk-tg2cw67r.js.map} +0 -0
- /package/dist/{chunk-bwjcehza.js.map → chunk-way52z4h.js.map} +0 -0
- /package/dist/{chunk-tjb1mk5t.js.map → chunk-x6m907x7.js.map} +0 -0
- /package/dist/{chunk-t6vq7bff.js.map → chunk-xfs8x8m9.js.map} +0 -0
- /package/dist/{chunk-d2ync1v3.js.map → chunk-yevzdx4y.js.map} +0 -0
- /package/dist/{chunk-kg5j6fct.js.map → chunk-z4m0yz8c.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AccessTokenKind,
|
|
1
|
+
import type { AccessTokenKind, Principal } from "../../auth"
|
|
2
2
|
import type { AuthorizablePrincipal } from "../../execution/types"
|
|
3
3
|
|
|
4
4
|
export type UserStatus = "active" | "suspended"
|
|
@@ -57,7 +57,6 @@ export interface SessionRecord {
|
|
|
57
57
|
readonly userId: string
|
|
58
58
|
readonly strategyId: string
|
|
59
59
|
/** The web app a browser session belongs to. A bearer session belongs to none and ignores it. */
|
|
60
|
-
readonly audience: AuthSessionAudience
|
|
61
60
|
readonly tokenHash: string
|
|
62
61
|
readonly createdAt: Date
|
|
63
62
|
readonly expiresAt: Date
|
|
@@ -142,7 +141,6 @@ export interface MagicLinkRecord {
|
|
|
142
141
|
readonly id: string
|
|
143
142
|
readonly projectId: string
|
|
144
143
|
readonly strategyId: string
|
|
145
|
-
readonly audience: AuthSessionAudience
|
|
146
144
|
readonly email: string
|
|
147
145
|
readonly tokenHash: string
|
|
148
146
|
readonly returnTo?: string
|
|
@@ -156,7 +154,6 @@ export interface OidcAuthorizationAttemptRecord {
|
|
|
156
154
|
readonly id: string
|
|
157
155
|
readonly projectId: string
|
|
158
156
|
readonly strategyId: string
|
|
159
|
-
readonly audience: AuthSessionAudience
|
|
160
157
|
readonly stateHash: string
|
|
161
158
|
readonly nonceHash: string
|
|
162
159
|
readonly codeVerifier: string
|
|
@@ -288,7 +285,6 @@ export interface CreateAuthSessionInput {
|
|
|
288
285
|
readonly projectId: string
|
|
289
286
|
readonly userId: string
|
|
290
287
|
readonly strategyId: string
|
|
291
|
-
readonly audience: AuthSessionAudience
|
|
292
288
|
readonly tokenHash: string
|
|
293
289
|
readonly createdAt: Date
|
|
294
290
|
readonly expiresAt: Date
|
|
@@ -330,7 +326,6 @@ export interface ListAuthAccessTokensResult {
|
|
|
330
326
|
|
|
331
327
|
export interface CompleteAuthSessionInput {
|
|
332
328
|
readonly id: string
|
|
333
|
-
readonly audience: AuthSessionAudience
|
|
334
329
|
readonly tokenHash: string
|
|
335
330
|
readonly createdAt: Date
|
|
336
331
|
readonly expiresAt: Date
|
|
@@ -379,7 +374,6 @@ export interface CreateAuthMagicLinkInput {
|
|
|
379
374
|
readonly id: string
|
|
380
375
|
readonly projectId: string
|
|
381
376
|
readonly strategyId: string
|
|
382
|
-
readonly audience: AuthSessionAudience
|
|
383
377
|
readonly email: string
|
|
384
378
|
readonly tokenHash: string
|
|
385
379
|
readonly returnTo?: string
|
|
@@ -391,7 +385,6 @@ export interface CreateOidcAuthorizationAttemptInput {
|
|
|
391
385
|
readonly id: string
|
|
392
386
|
readonly projectId: string
|
|
393
387
|
readonly strategyId: string
|
|
394
|
-
readonly audience: AuthSessionAudience
|
|
395
388
|
readonly stateHash: string
|
|
396
389
|
readonly nonceHash: string
|
|
397
390
|
readonly codeVerifier: string
|
|
@@ -536,13 +529,7 @@ export interface AuthSessionStore {
|
|
|
536
529
|
readonly projectId: string
|
|
537
530
|
readonly id: string
|
|
538
531
|
}): Promise<SessionRecord | null>
|
|
539
|
-
|
|
540
|
-
readonly projectId: string
|
|
541
|
-
readonly userId: string
|
|
542
|
-
readonly audience: AuthSessionAudience
|
|
543
|
-
readonly now: Date
|
|
544
|
-
}): Promise<SessionRecord | null>
|
|
545
|
-
// All active sessions for a user across every audience, most-recently-active
|
|
532
|
+
// All active sessions for a user, most-recently-active
|
|
546
533
|
// first. Backs the active-sessions view.
|
|
547
534
|
listActiveByUserId(params: {
|
|
548
535
|
readonly projectId: string
|
|
@@ -553,7 +540,6 @@ export interface AuthSessionStore {
|
|
|
553
540
|
findValidByTokenHash(params: {
|
|
554
541
|
readonly projectId: string
|
|
555
542
|
readonly id: string
|
|
556
|
-
readonly audience: AuthSessionAudience
|
|
557
543
|
readonly tokenHash: string
|
|
558
544
|
readonly now: Date
|
|
559
545
|
}): Promise<SessionRecord | null>
|
|
@@ -585,7 +571,6 @@ export interface AuthSessionStore {
|
|
|
585
571
|
renewIfValid(params: {
|
|
586
572
|
readonly projectId: string
|
|
587
573
|
readonly id: string
|
|
588
|
-
readonly audience: AuthSessionAudience
|
|
589
574
|
readonly tokenHash: string
|
|
590
575
|
readonly now: Date
|
|
591
576
|
readonly expiresAt: Date
|
|
@@ -598,7 +583,6 @@ export interface AuthSessionStore {
|
|
|
598
583
|
revokeActiveForUser(params: {
|
|
599
584
|
readonly projectId: string
|
|
600
585
|
readonly userId: string
|
|
601
|
-
readonly audience?: AuthSessionAudience
|
|
602
586
|
readonly revokedAt: Date
|
|
603
587
|
}): Promise<readonly SessionRecord[]>
|
|
604
588
|
touch(params: {
|
|
@@ -24,12 +24,10 @@ function at(value: string): Date {
|
|
|
24
24
|
function sessionInput(
|
|
25
25
|
id: string,
|
|
26
26
|
tokenHash = `${id}-hash`,
|
|
27
|
-
audience: CompleteAuthSessionInput["audience"] = "atlas",
|
|
28
27
|
absoluteExpiresAt?: Date
|
|
29
28
|
): CompleteAuthSessionInput {
|
|
30
29
|
return {
|
|
31
30
|
id,
|
|
32
|
-
audience,
|
|
33
31
|
tokenHash,
|
|
34
32
|
createdAt: at("2026-05-14T10:10:00.000Z"),
|
|
35
33
|
expiresAt: at("2026-05-21T10:10:00.000Z"),
|
|
@@ -43,7 +41,6 @@ function bearerSessionInput(id: string) {
|
|
|
43
41
|
projectId,
|
|
44
42
|
userId: "usr_1",
|
|
45
43
|
strategyId: "magic-link",
|
|
46
|
-
audience: "atlas" as const,
|
|
47
44
|
tokenHash: "access-1",
|
|
48
45
|
createdAt: at("2026-05-14T10:00:00.000Z"),
|
|
49
46
|
expiresAt: at("2026-06-14T10:00:00.000Z"),
|
|
@@ -89,7 +86,6 @@ async function completeOidcSignInForAva(
|
|
|
89
86
|
id: "oidc_directory",
|
|
90
87
|
projectId,
|
|
91
88
|
strategyId: "entra",
|
|
92
|
-
audience: "atlas",
|
|
93
89
|
stateHash: "directory-state",
|
|
94
90
|
nonceHash: "nonce-hash",
|
|
95
91
|
codeVerifier: "verifier",
|
|
@@ -201,7 +197,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
201
197
|
projectId,
|
|
202
198
|
userId: "usr_1",
|
|
203
199
|
strategyId: "magic-link",
|
|
204
|
-
audience: "atlas",
|
|
205
200
|
tokenHash: "hash-1",
|
|
206
201
|
createdAt: at("2026-05-14T10:00:00.000Z"),
|
|
207
202
|
expiresAt: at("2026-05-21T10:00:00.000Z"),
|
|
@@ -211,13 +206,12 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
211
206
|
projectId,
|
|
212
207
|
userId: "usr_1",
|
|
213
208
|
strategyId: "magic-link",
|
|
214
|
-
audience: "atlas",
|
|
215
209
|
tokenHash: "hash-2",
|
|
216
210
|
createdAt: at("2026-05-14T10:05:00.000Z"),
|
|
217
211
|
expiresAt: at("2026-05-21T10:05:00.000Z"),
|
|
218
212
|
})
|
|
219
213
|
|
|
220
|
-
// Creating a second session
|
|
214
|
+
// Creating a second session no longer revokes the
|
|
221
215
|
// first: both stay active and authenticate independently.
|
|
222
216
|
expect(first.revokedAt).toBeUndefined()
|
|
223
217
|
expect(second.revokedAt).toBeUndefined()
|
|
@@ -228,7 +222,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
228
222
|
storage.sessions.findValidByTokenHash({
|
|
229
223
|
projectId,
|
|
230
224
|
id: "ses_1",
|
|
231
|
-
audience: "atlas",
|
|
232
225
|
tokenHash: "hash-1",
|
|
233
226
|
now: at("2026-05-14T10:06:00.000Z"),
|
|
234
227
|
})
|
|
@@ -237,7 +230,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
237
230
|
storage.sessions.findValidByTokenHash({
|
|
238
231
|
projectId,
|
|
239
232
|
id: "ses_2",
|
|
240
|
-
audience: "atlas",
|
|
241
233
|
tokenHash: "hash-2",
|
|
242
234
|
now: at("2026-05-14T10:06:00.000Z"),
|
|
243
235
|
})
|
|
@@ -246,22 +238,11 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
246
238
|
storage.sessions.findValidByTokenHash({
|
|
247
239
|
projectId,
|
|
248
240
|
id: "ses_2",
|
|
249
|
-
audience: "atlas",
|
|
250
241
|
tokenHash: "wrong",
|
|
251
242
|
now: at("2026-05-14T10:06:00.000Z"),
|
|
252
243
|
})
|
|
253
244
|
).resolves.toBeNull()
|
|
254
245
|
|
|
255
|
-
// getActiveByUserId returns the most recently created active session.
|
|
256
|
-
await expect(
|
|
257
|
-
storage.sessions.getActiveByUserId({
|
|
258
|
-
projectId,
|
|
259
|
-
userId: "usr_1",
|
|
260
|
-
audience: "atlas",
|
|
261
|
-
now: at("2026-05-14T10:06:00.000Z"),
|
|
262
|
-
})
|
|
263
|
-
).resolves.toMatchObject({ id: "ses_2" })
|
|
264
|
-
|
|
265
246
|
const touched = await storage.sessions.touch({
|
|
266
247
|
projectId,
|
|
267
248
|
id: second.id,
|
|
@@ -270,28 +251,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
270
251
|
expect(touched.lastSeenAt?.toISOString()).toBe("2026-05-15T10:00:00.000Z")
|
|
271
252
|
expect(touched.expiresAt.toISOString()).toBe("2026-05-21T10:05:00.000Z")
|
|
272
253
|
|
|
273
|
-
// A session in a different audience coexists and is cookie-scoped.
|
|
274
|
-
const appSession = await storage.sessions.create({
|
|
275
|
-
id: "ses_app",
|
|
276
|
-
projectId,
|
|
277
|
-
userId: "usr_1",
|
|
278
|
-
strategyId: "magic-link",
|
|
279
|
-
audience: "app",
|
|
280
|
-
tokenHash: "hash-app",
|
|
281
|
-
createdAt: at("2026-05-14T10:06:00.000Z"),
|
|
282
|
-
expiresAt: at("2026-05-21T10:06:00.000Z"),
|
|
283
|
-
})
|
|
284
|
-
expect(appSession.revokedAt).toBeUndefined()
|
|
285
|
-
await expect(
|
|
286
|
-
storage.sessions.findValidByTokenHash({
|
|
287
|
-
projectId,
|
|
288
|
-
id: "ses_app",
|
|
289
|
-
audience: "atlas",
|
|
290
|
-
tokenHash: "hash-app",
|
|
291
|
-
now: at("2026-05-14T10:07:00.000Z"),
|
|
292
|
-
})
|
|
293
|
-
).resolves.toBeNull()
|
|
294
|
-
|
|
295
254
|
// Revoking a single session leaves the user's other sessions active.
|
|
296
255
|
await storage.sessions.revoke({
|
|
297
256
|
projectId,
|
|
@@ -302,7 +261,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
302
261
|
storage.sessions.findValidByTokenHash({
|
|
303
262
|
projectId,
|
|
304
263
|
id: "ses_1",
|
|
305
|
-
audience: "atlas",
|
|
306
264
|
tokenHash: "hash-1",
|
|
307
265
|
now: at("2026-05-14T10:09:00.000Z"),
|
|
308
266
|
})
|
|
@@ -311,28 +269,26 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
311
269
|
storage.sessions.findValidByTokenHash({
|
|
312
270
|
projectId,
|
|
313
271
|
id: "ses_2",
|
|
314
|
-
audience: "atlas",
|
|
315
272
|
tokenHash: "hash-2",
|
|
316
273
|
now: at("2026-05-14T10:09:00.000Z"),
|
|
317
274
|
})
|
|
318
275
|
).resolves.toMatchObject({ id: "ses_2" })
|
|
319
276
|
|
|
320
277
|
// "Sign out everywhere": revokeActiveForUser clears every remaining
|
|
321
|
-
// active session for the user
|
|
278
|
+
// active session for the user.
|
|
322
279
|
const revoked = await storage.sessions.revokeActiveForUser({
|
|
323
280
|
projectId,
|
|
324
281
|
userId: "usr_1",
|
|
325
282
|
revokedAt: at("2026-05-14T10:10:00.000Z"),
|
|
326
283
|
})
|
|
327
|
-
expect(revoked.map((entry) => entry.id).sort()).toEqual(["ses_2"
|
|
284
|
+
expect(revoked.map((entry) => entry.id).sort()).toEqual(["ses_2"])
|
|
328
285
|
await expect(
|
|
329
|
-
storage.sessions.
|
|
286
|
+
storage.sessions.listActiveByUserId({
|
|
330
287
|
projectId,
|
|
331
288
|
userId: "usr_1",
|
|
332
|
-
audience: "atlas",
|
|
333
289
|
now: at("2026-05-14T10:11:00.000Z"),
|
|
334
290
|
})
|
|
335
|
-
).resolves.
|
|
291
|
+
).resolves.toEqual([])
|
|
336
292
|
})
|
|
337
293
|
})
|
|
338
294
|
|
|
@@ -344,7 +300,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
344
300
|
projectId,
|
|
345
301
|
userId: "usr_1",
|
|
346
302
|
strategyId: "magic-link",
|
|
347
|
-
audience: "atlas",
|
|
348
303
|
tokenHash: "hash-capped",
|
|
349
304
|
createdAt: at("2026-05-14T10:00:00.000Z"),
|
|
350
305
|
expiresAt: at("2026-05-21T10:00:00.000Z"),
|
|
@@ -355,7 +310,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
355
310
|
projectId,
|
|
356
311
|
userId: "usr_1",
|
|
357
312
|
strategyId: "magic-link",
|
|
358
|
-
audience: "app",
|
|
359
313
|
tokenHash: "hash-uncapped",
|
|
360
314
|
createdAt: at("2026-05-14T10:01:00.000Z"),
|
|
361
315
|
expiresAt: at("2026-05-21T10:01:00.000Z"),
|
|
@@ -367,7 +321,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
367
321
|
storage.sessions.findValidByTokenHash({
|
|
368
322
|
projectId,
|
|
369
323
|
id: capped.id,
|
|
370
|
-
audience: "atlas",
|
|
371
324
|
tokenHash: "hash-capped",
|
|
372
325
|
now: at("2026-05-16T09:59:59.999Z"),
|
|
373
326
|
})
|
|
@@ -376,7 +329,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
376
329
|
storage.sessions.findValidByTokenHash({
|
|
377
330
|
projectId,
|
|
378
331
|
id: capped.id,
|
|
379
|
-
audience: "atlas",
|
|
380
332
|
tokenHash: "hash-capped",
|
|
381
333
|
now: at("2026-05-16T10:00:00.000Z"),
|
|
382
334
|
})
|
|
@@ -387,22 +339,13 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
387
339
|
now: at("2026-05-16T10:00:00.000Z"),
|
|
388
340
|
})
|
|
389
341
|
expect(active.map((session) => session.id)).toEqual([uncapped.id])
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
).resolves.toBeNull()
|
|
398
|
-
await expect(
|
|
399
|
-
storage.sessions.revokeActiveForUser({
|
|
400
|
-
projectId,
|
|
401
|
-
userId: "usr_1",
|
|
402
|
-
audience: "atlas",
|
|
403
|
-
revokedAt: at("2026-05-16T10:00:00.000Z"),
|
|
404
|
-
})
|
|
405
|
-
).resolves.toEqual([])
|
|
342
|
+
// A session past its absolute deadline is no longer active, so there is nothing to revoke.
|
|
343
|
+
const revoked = await storage.sessions.revokeActiveForUser({
|
|
344
|
+
projectId,
|
|
345
|
+
userId: "usr_1",
|
|
346
|
+
revokedAt: at("2026-05-16T10:00:00.000Z"),
|
|
347
|
+
})
|
|
348
|
+
expect(revoked.map((session) => session.id)).toEqual([uncapped.id])
|
|
406
349
|
})
|
|
407
350
|
})
|
|
408
351
|
|
|
@@ -414,7 +357,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
414
357
|
projectId,
|
|
415
358
|
userId: "usr_1",
|
|
416
359
|
strategyId: "magic-link",
|
|
417
|
-
audience: "atlas",
|
|
418
360
|
tokenHash: "hash-renew",
|
|
419
361
|
createdAt: at("2026-05-14T10:00:00.000Z"),
|
|
420
362
|
expiresAt: at("2026-05-15T10:00:00.000Z"),
|
|
@@ -424,7 +366,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
424
366
|
const renewed = await storage.sessions.renewIfValid({
|
|
425
367
|
projectId,
|
|
426
368
|
id: "ses_renew",
|
|
427
|
-
audience: "atlas",
|
|
428
369
|
tokenHash: "hash-renew",
|
|
429
370
|
now: at("2026-05-14T11:00:00.000Z"),
|
|
430
371
|
expiresAt: at("2026-05-25T10:00:00.000Z"),
|
|
@@ -435,7 +376,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
435
376
|
const monotonic = await storage.sessions.renewIfValid({
|
|
436
377
|
projectId,
|
|
437
378
|
id: "ses_renew",
|
|
438
|
-
audience: "atlas",
|
|
439
379
|
tokenHash: "hash-renew",
|
|
440
380
|
now: at("2026-05-14T12:00:00.000Z"),
|
|
441
381
|
expiresAt: at("2026-05-18T10:00:00.000Z"),
|
|
@@ -446,7 +386,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
446
386
|
storage.sessions.renewIfValid({
|
|
447
387
|
projectId,
|
|
448
388
|
id: "ses_renew",
|
|
449
|
-
audience: "atlas",
|
|
450
389
|
tokenHash: "wrong-hash",
|
|
451
390
|
now: at("2026-05-14T13:00:00.000Z"),
|
|
452
391
|
expiresAt: at("2026-05-19T10:00:00.000Z"),
|
|
@@ -456,7 +395,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
456
395
|
storage.sessions.renewIfValid({
|
|
457
396
|
projectId,
|
|
458
397
|
id: "ses_renew",
|
|
459
|
-
audience: "atlas",
|
|
460
398
|
tokenHash: "hash-renew",
|
|
461
399
|
now: at("2026-05-20T10:00:00.000Z"),
|
|
462
400
|
expiresAt: at("2026-05-21T10:00:00.000Z"),
|
|
@@ -468,7 +406,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
468
406
|
projectId,
|
|
469
407
|
userId: "usr_1",
|
|
470
408
|
strategyId: "magic-link",
|
|
471
|
-
audience: "atlas",
|
|
472
409
|
tokenHash: "hash-concurrent",
|
|
473
410
|
createdAt: at("2026-05-14T10:00:00.000Z"),
|
|
474
411
|
expiresAt: at("2026-05-15T10:00:00.000Z"),
|
|
@@ -477,7 +414,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
477
414
|
storage.sessions.renewIfValid({
|
|
478
415
|
projectId,
|
|
479
416
|
id: "ses_concurrent",
|
|
480
|
-
audience: "atlas",
|
|
481
417
|
tokenHash: "hash-concurrent",
|
|
482
418
|
now: at("2026-05-14T11:00:00.000Z"),
|
|
483
419
|
expiresAt: at("2026-05-18T10:00:00.000Z"),
|
|
@@ -485,7 +421,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
485
421
|
storage.sessions.renewIfValid({
|
|
486
422
|
projectId,
|
|
487
423
|
id: "ses_concurrent",
|
|
488
|
-
audience: "atlas",
|
|
489
424
|
tokenHash: "hash-concurrent",
|
|
490
425
|
now: at("2026-05-14T11:00:00.000Z"),
|
|
491
426
|
expiresAt: at("2026-05-19T10:00:00.000Z"),
|
|
@@ -505,7 +440,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
505
440
|
projectId,
|
|
506
441
|
userId: "usr_1",
|
|
507
442
|
strategyId: "magic-link",
|
|
508
|
-
audience: "atlas",
|
|
509
443
|
tokenHash: "hash-device",
|
|
510
444
|
createdAt: at("2026-05-14T10:00:00.000Z"),
|
|
511
445
|
expiresAt: at("2026-05-21T10:00:00.000Z"),
|
|
@@ -527,7 +461,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
527
461
|
projectId,
|
|
528
462
|
userId: "usr_1",
|
|
529
463
|
strategyId: "magic-link",
|
|
530
|
-
audience: "atlas",
|
|
531
464
|
tokenHash: "hash-plain",
|
|
532
465
|
createdAt: at("2026-05-14T10:01:00.000Z"),
|
|
533
466
|
expiresAt: at("2026-05-21T10:01:00.000Z"),
|
|
@@ -537,7 +470,7 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
537
470
|
})
|
|
538
471
|
})
|
|
539
472
|
|
|
540
|
-
test("lists a user's active sessions
|
|
473
|
+
test("lists a user's active sessions, newest activity first", async () => {
|
|
541
474
|
await withStorage(async (storage) => {
|
|
542
475
|
await createUser(storage)
|
|
543
476
|
|
|
@@ -546,7 +479,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
546
479
|
projectId,
|
|
547
480
|
userId: "usr_1",
|
|
548
481
|
strategyId: "magic-link",
|
|
549
|
-
audience: "atlas",
|
|
550
482
|
tokenHash: "hash-a",
|
|
551
483
|
createdAt: at("2026-05-14T10:00:00.000Z"),
|
|
552
484
|
expiresAt: at("2026-05-21T10:00:00.000Z"),
|
|
@@ -556,7 +488,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
556
488
|
projectId,
|
|
557
489
|
userId: "usr_1",
|
|
558
490
|
strategyId: "magic-link",
|
|
559
|
-
audience: "app",
|
|
560
491
|
tokenHash: "hash-b",
|
|
561
492
|
createdAt: at("2026-05-14T10:05:00.000Z"),
|
|
562
493
|
expiresAt: at("2026-05-21T10:05:00.000Z"),
|
|
@@ -568,7 +499,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
568
499
|
projectId,
|
|
569
500
|
userId: "usr_1",
|
|
570
501
|
strategyId: "magic-link",
|
|
571
|
-
audience: "atlas",
|
|
572
502
|
tokenHash: "hash-revoked",
|
|
573
503
|
createdAt: at("2026-05-14T10:01:00.000Z"),
|
|
574
504
|
expiresAt: at("2026-05-21T10:01:00.000Z"),
|
|
@@ -586,7 +516,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
586
516
|
projectId,
|
|
587
517
|
userId: "usr_2",
|
|
588
518
|
strategyId: "magic-link",
|
|
589
|
-
audience: "atlas",
|
|
590
519
|
tokenHash: "hash-other",
|
|
591
520
|
createdAt: at("2026-05-14T10:03:00.000Z"),
|
|
592
521
|
expiresAt: at("2026-05-21T10:03:00.000Z"),
|
|
@@ -984,7 +913,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
984
913
|
projectId,
|
|
985
914
|
userId: "usr_creator",
|
|
986
915
|
strategyId: "magic-link",
|
|
987
|
-
audience: "atlas",
|
|
988
916
|
tokenHash: "hash-creator",
|
|
989
917
|
createdAt: at("2026-05-14T10:00:30.000Z"),
|
|
990
918
|
expiresAt: at("2026-05-21T10:00:30.000Z"),
|
|
@@ -1251,7 +1179,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
1251
1179
|
id: "ml_1",
|
|
1252
1180
|
projectId,
|
|
1253
1181
|
strategyId: "magic-link",
|
|
1254
|
-
audience: "atlas",
|
|
1255
1182
|
email: "ava@acme.com",
|
|
1256
1183
|
tokenHash: "hash-1",
|
|
1257
1184
|
createdAt: at("2026-05-14T10:00:00.000Z"),
|
|
@@ -1261,7 +1188,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
1261
1188
|
id: "ml_2",
|
|
1262
1189
|
projectId,
|
|
1263
1190
|
strategyId: "magic-link",
|
|
1264
|
-
audience: "atlas",
|
|
1265
1191
|
email: " ava@acme.com ",
|
|
1266
1192
|
tokenHash: "hash-2",
|
|
1267
1193
|
returnTo: "/dashboard",
|
|
@@ -1290,7 +1216,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
1290
1216
|
consumedAt: at("2026-05-14T10:02:00.000Z"),
|
|
1291
1217
|
})
|
|
1292
1218
|
).resolves.toMatchObject({
|
|
1293
|
-
audience: "atlas",
|
|
1294
1219
|
returnTo: "/dashboard",
|
|
1295
1220
|
consumedAt: at("2026-05-14T10:02:00.000Z"),
|
|
1296
1221
|
})
|
|
@@ -1312,7 +1237,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
1312
1237
|
id: "oidc_1",
|
|
1313
1238
|
projectId,
|
|
1314
1239
|
strategyId: "okta",
|
|
1315
|
-
audience: "atlas",
|
|
1316
1240
|
stateHash: "state-hash",
|
|
1317
1241
|
nonceHash: "nonce-hash",
|
|
1318
1242
|
codeVerifier: "verifier",
|
|
@@ -1338,7 +1262,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
1338
1262
|
consumedAt: at("2026-05-14T10:01:00.000Z"),
|
|
1339
1263
|
})
|
|
1340
1264
|
).resolves.toMatchObject({
|
|
1341
|
-
audience: "atlas",
|
|
1342
1265
|
codeVerifier: "verifier",
|
|
1343
1266
|
consumedAt: at("2026-05-14T10:01:00.000Z"),
|
|
1344
1267
|
})
|
|
@@ -1362,7 +1285,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
1362
1285
|
projectId,
|
|
1363
1286
|
userId: "usr_1",
|
|
1364
1287
|
strategyId: "magic-link",
|
|
1365
|
-
audience: "atlas",
|
|
1366
1288
|
tokenHash: "session-hash",
|
|
1367
1289
|
createdAt: at("2026-05-14T10:00:00.000Z"),
|
|
1368
1290
|
expiresAt: at("2026-05-21T10:00:00.000Z"),
|
|
@@ -1433,7 +1355,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
1433
1355
|
storage.sessions.findValidByTokenHash({
|
|
1434
1356
|
projectId,
|
|
1435
1357
|
id: "ses_cli",
|
|
1436
|
-
audience: "atlas",
|
|
1437
1358
|
tokenHash: "access-1",
|
|
1438
1359
|
now,
|
|
1439
1360
|
})
|
|
@@ -1524,7 +1445,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
1524
1445
|
projectId,
|
|
1525
1446
|
userId: "usr_1",
|
|
1526
1447
|
strategyId: "magic-link",
|
|
1527
|
-
audience: "atlas",
|
|
1528
1448
|
tokenHash: "old-hash",
|
|
1529
1449
|
createdAt: at("2026-05-14T10:00:00.000Z"),
|
|
1530
1450
|
expiresAt: at("2026-05-21T10:00:00.000Z"),
|
|
@@ -1533,7 +1453,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
1533
1453
|
id: "ml_1",
|
|
1534
1454
|
projectId,
|
|
1535
1455
|
strategyId: "magic-link",
|
|
1536
|
-
audience: "atlas",
|
|
1537
1456
|
email: "ava@acme.com",
|
|
1538
1457
|
tokenHash: "link-hash",
|
|
1539
1458
|
createdAt: at("2026-05-14T10:01:00.000Z"),
|
|
@@ -1546,7 +1465,7 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
1546
1465
|
tokenHash: "link-hash",
|
|
1547
1466
|
completedAt: at("2026-05-14T10:02:00.000Z"),
|
|
1548
1467
|
newUserId: "usr_unused",
|
|
1549
|
-
session: sessionInput("ses_new", "session-hash",
|
|
1468
|
+
session: sessionInput("ses_new", "session-hash", at("2026-06-21T10:10:00.000Z")),
|
|
1550
1469
|
})
|
|
1551
1470
|
|
|
1552
1471
|
expect(result.user.id).toBe("usr_1")
|
|
@@ -1588,7 +1507,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
1588
1507
|
id: "ml_1",
|
|
1589
1508
|
projectId,
|
|
1590
1509
|
strategyId: "magic-link",
|
|
1591
|
-
audience: "atlas",
|
|
1592
1510
|
email: "ava@acme.com",
|
|
1593
1511
|
tokenHash: "link-hash",
|
|
1594
1512
|
createdAt: at("2026-05-14T10:02:00.000Z"),
|
|
@@ -1643,7 +1561,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
1643
1561
|
id: "ml_1",
|
|
1644
1562
|
projectId,
|
|
1645
1563
|
strategyId: "magic-link",
|
|
1646
|
-
audience: "atlas",
|
|
1647
1564
|
email: "ava@acme.com",
|
|
1648
1565
|
tokenHash: "link-hash",
|
|
1649
1566
|
createdAt: at("2026-05-14T10:02:00.000Z"),
|
|
@@ -1683,7 +1600,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
1683
1600
|
id: "ml_1",
|
|
1684
1601
|
projectId,
|
|
1685
1602
|
strategyId: "magic-link",
|
|
1686
|
-
audience: "atlas",
|
|
1687
1603
|
email: "ava@acme.com",
|
|
1688
1604
|
tokenHash: "link-hash",
|
|
1689
1605
|
createdAt: at("2026-05-14T10:01:00.000Z"),
|
|
@@ -1721,7 +1637,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
1721
1637
|
id: "ml_1",
|
|
1722
1638
|
projectId,
|
|
1723
1639
|
strategyId: "magic-link",
|
|
1724
|
-
audience: "atlas",
|
|
1725
1640
|
email: "founder@acme.com",
|
|
1726
1641
|
tokenHash: "link-hash",
|
|
1727
1642
|
createdAt: at("2026-05-14T10:01:00.000Z"),
|
|
@@ -1756,7 +1671,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
1756
1671
|
id: "ml_1",
|
|
1757
1672
|
projectId,
|
|
1758
1673
|
strategyId: "magic-link",
|
|
1759
|
-
audience: "atlas",
|
|
1760
1674
|
email: "ava@acme.com",
|
|
1761
1675
|
tokenHash: "link-hash",
|
|
1762
1676
|
createdAt: at("2026-05-14T10:01:00.000Z"),
|
|
@@ -1795,7 +1709,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
1795
1709
|
id: "oidc_1",
|
|
1796
1710
|
projectId,
|
|
1797
1711
|
strategyId: "okta",
|
|
1798
|
-
audience: "atlas",
|
|
1799
1712
|
stateHash: "state-hash",
|
|
1800
1713
|
nonceHash: "nonce-hash",
|
|
1801
1714
|
codeVerifier: "verifier",
|
|
@@ -1834,7 +1747,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
1834
1747
|
id: "oidc_1",
|
|
1835
1748
|
projectId,
|
|
1836
1749
|
strategyId: "okta",
|
|
1837
|
-
audience: "atlas",
|
|
1838
1750
|
stateHash: "state-hash",
|
|
1839
1751
|
nonceHash: "nonce-hash",
|
|
1840
1752
|
codeVerifier: "verifier",
|
|
@@ -1873,7 +1785,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
1873
1785
|
id: "oidc_1",
|
|
1874
1786
|
projectId,
|
|
1875
1787
|
strategyId: "okta",
|
|
1876
|
-
audience: "atlas",
|
|
1877
1788
|
stateHash: "state-hash",
|
|
1878
1789
|
nonceHash: "nonce-hash",
|
|
1879
1790
|
codeVerifier: "verifier",
|
|
@@ -1919,7 +1830,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
1919
1830
|
id: "oidc_1",
|
|
1920
1831
|
projectId,
|
|
1921
1832
|
strategyId: "okta",
|
|
1922
|
-
audience: "atlas",
|
|
1923
1833
|
stateHash: "state-hash",
|
|
1924
1834
|
nonceHash: "nonce-hash",
|
|
1925
1835
|
codeVerifier: "verifier",
|
|
@@ -1952,7 +1862,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
1952
1862
|
id: "oidc_bootstrap",
|
|
1953
1863
|
projectId,
|
|
1954
1864
|
strategyId: "okta",
|
|
1955
|
-
audience: "atlas",
|
|
1956
1865
|
stateHash: "bootstrap-state",
|
|
1957
1866
|
nonceHash: "nonce-hash",
|
|
1958
1867
|
codeVerifier: "verifier",
|
|
@@ -2057,7 +1966,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
2057
1966
|
projectId,
|
|
2058
1967
|
userId: "usr_1",
|
|
2059
1968
|
strategyId: "magic-link",
|
|
2060
|
-
audience: "atlas",
|
|
2061
1969
|
tokenHash: "hash-1",
|
|
2062
1970
|
createdAt: at("2026-05-14T10:00:00.000Z"),
|
|
2063
1971
|
expiresAt: at("2026-05-21T10:00:00.000Z"),
|
|
@@ -2067,7 +1975,6 @@ export function runAuthStorageContractSuite<TStorage extends AuthStorage>(
|
|
|
2067
1975
|
projectId,
|
|
2068
1976
|
userId: "usr_1",
|
|
2069
1977
|
strategyId: "magic-link",
|
|
2070
|
-
audience: "app",
|
|
2071
1978
|
tokenHash: "hash-app",
|
|
2072
1979
|
createdAt: at("2026-05-14T10:01:00.000Z"),
|
|
2073
1980
|
expiresAt: at("2026-05-21T10:01:00.000Z"),
|
|
@@ -382,7 +382,6 @@ async function seedAuth(auth: AuthStorage): Promise<void> {
|
|
|
382
382
|
projectId,
|
|
383
383
|
userId: "user-one",
|
|
384
384
|
strategyId: "contract",
|
|
385
|
-
audience: "atlas",
|
|
386
385
|
tokenHash: "session-user-hash",
|
|
387
386
|
createdAt,
|
|
388
387
|
expiresAt,
|
|
@@ -392,7 +391,6 @@ async function seedAuth(auth: AuthStorage): Promise<void> {
|
|
|
392
391
|
projectId,
|
|
393
392
|
userId: "user-other",
|
|
394
393
|
strategyId: "contract",
|
|
395
|
-
audience: "atlas",
|
|
396
394
|
tokenHash: "session-other-hash",
|
|
397
395
|
createdAt,
|
|
398
396
|
expiresAt,
|
package/dist/auth/audience.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare const DEFAULT_AUTH_SESSION_AUDIENCE = "atlas";
|
|
2
|
-
export type AuthSessionAudience = typeof DEFAULT_AUTH_SESSION_AUDIENCE | "app";
|
|
3
|
-
export interface AuthSessionAudienceOptions {
|
|
4
|
-
readonly audience?: AuthSessionAudience;
|
|
5
|
-
}
|
|
6
|
-
export declare function isValidAuthSessionAudience(value: string): value is AuthSessionAudience;
|
|
7
|
-
export declare function resolveAuthSessionAudience(value: AuthSessionAudience | undefined): AuthSessionAudience;
|
|
8
|
-
//# sourceMappingURL=audience.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audience.d.ts","sourceRoot":"","sources":["../../src/auth/audience.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,6BAA6B,UAAU,CAAA;AAEpD,MAAM,MAAM,mBAAmB,GAAG,OAAO,6BAA6B,GAAG,KAAK,CAAA;AAE9E,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAA;CACxC;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,mBAAmB,CAEtF;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,mBAAmB,GAAG,SAAS,GACrC,mBAAmB,CAWrB"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { AuthSessionAudience } from "../auth/audience";
|
|
2
|
-
import type { AuthorizationContext, ResolvedRole } from "./types";
|
|
3
|
-
/** Whether declaring roles has enabled an allowlist for an application. */
|
|
4
|
-
export declare function isApplicationAccessControlled(roles: readonly ResolvedRole[], audience: AuthSessionAudience): boolean;
|
|
5
|
-
/**
|
|
6
|
-
* Whether this principal may open this application.
|
|
7
|
-
*
|
|
8
|
-
* KNOWN LIMITATION (0.1.x): application access is the one capability that is **not** deny-by-default.
|
|
9
|
-
* While no role mentions an application, every authenticated principal may open it; the allowlist only
|
|
10
|
-
* switches on once some role grants it. Every other capability — `view`, `apply`, `run`, `observe` —
|
|
11
|
-
* denies unless granted, so this is the single asymmetry in the model.
|
|
12
|
-
*
|
|
13
|
-
* It is deliberate for now: flipping it would lock every project out of Atlas until it declares a role,
|
|
14
|
-
* including projects with no security definitions at all. Closing it means shipping a default grant with
|
|
15
|
-
* the scaffold first, and it is a breaking change for any project relying on the open default.
|
|
16
|
-
*/
|
|
17
|
-
export declare function canAccessApplication(authorization: AuthorizationContext, roles: readonly ResolvedRole[], audience: AuthSessionAudience): boolean;
|
|
18
|
-
//# sourceMappingURL=application-access.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"application-access.d.ts","sourceRoot":"","sources":["../../src/authorization/application-access.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAE3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEjE,2EAA2E;AAC3E,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,SAAS,YAAY,EAAE,EAC9B,QAAQ,EAAE,mBAAmB,GAC5B,OAAO,CAET;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,oBAAoB,EACnC,KAAK,EAAE,SAAS,YAAY,EAAE,EAC9B,QAAQ,EAAE,mBAAmB,GAC5B,OAAO,CAKT"}
|