@softistx/janus 0.76.0 → 0.78.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 +11 -6
- package/dist/auth/api-keys/authenticate-key.d.ts +3 -2
- package/dist/auth/api-keys/authenticate-key.d.ts.map +1 -1
- package/dist/auth/api-keys/count.d.ts.map +1 -1
- package/dist/auth/api-keys/create/after-insert.d.ts +11 -0
- package/dist/auth/api-keys/create/after-insert.d.ts.map +1 -0
- package/dist/auth/api-keys/create/checks.d.ts +17 -0
- package/dist/auth/api-keys/create/checks.d.ts.map +1 -1
- package/dist/auth/api-keys/create/index.d.ts.map +1 -1
- package/dist/auth/api-keys/create/service-checks.d.ts +25 -0
- package/dist/auth/api-keys/create/service-checks.d.ts.map +1 -0
- package/dist/auth/api-keys/create/service.d.ts +12 -0
- package/dist/auth/api-keys/create/service.d.ts.map +1 -0
- package/dist/auth/api-keys/expiry.d.ts.map +1 -1
- package/dist/auth/api-keys/flows.d.ts +6 -2
- package/dist/auth/api-keys/flows.d.ts.map +1 -1
- package/dist/auth/api-keys/owned.d.ts +12 -0
- package/dist/auth/api-keys/owned.d.ts.map +1 -0
- package/dist/auth/api-keys/read.d.ts.map +1 -1
- package/dist/auth/api-keys/service-flows.d.ts +13 -0
- package/dist/auth/api-keys/service-flows.d.ts.map +1 -0
- package/dist/auth/api-keys/to-api-key.d.ts.map +1 -1
- package/dist/auth/config/api-keys-config.d.ts +29 -2
- package/dist/auth/config/api-keys-config.d.ts.map +1 -1
- package/dist/auth/config/index.d.ts +1 -1
- package/dist/auth/config/index.d.ts.map +1 -1
- package/dist/auth/config/resolve-api-keys.d.ts.map +1 -1
- package/dist/auth/config/resolved-config.d.ts +8 -0
- package/dist/auth/config/resolved-config.d.ts.map +1 -1
- package/dist/auth/index.d.ts +3 -2
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/port/memory/api-keys/capabilities.d.ts.map +1 -1
- package/dist/auth/port/memory/api-keys/index.d.ts.map +1 -1
- package/dist/auth/port/types/api-keys.d.ts +25 -5
- package/dist/auth/port/types/api-keys.d.ts.map +1 -1
- package/dist/auth/sessions/amr.d.ts +2 -2
- package/dist/auth/sessions/authenticate.d.ts +3 -2
- package/dist/auth/sessions/authenticate.d.ts.map +1 -1
- package/dist/auth/sessions/fresh.d.ts +2 -2
- package/dist/auth/sessions/fresh.d.ts.map +1 -1
- package/dist/auth/sessions/shared-api.d.ts +3 -2
- package/dist/auth/sessions/shared-api.d.ts.map +1 -1
- package/dist/auth/shared-api.d.ts +11 -3
- package/dist/auth/shared-api.d.ts.map +1 -1
- package/dist/auth/signed-token.d.ts +41 -0
- package/dist/auth/signed-token.d.ts.map +1 -0
- package/dist/auth/types/api-keys-of.d.ts +6 -1
- package/dist/auth/types/api-keys-of.d.ts.map +1 -1
- package/dist/auth/types/api-keys.d.ts +18 -6
- package/dist/auth/types/api-keys.d.ts.map +1 -1
- package/dist/auth/types/checks.d.ts +17 -1
- package/dist/auth/types/checks.d.ts.map +1 -1
- package/dist/auth/types/index.d.ts +3 -2
- package/dist/auth/types/index.d.ts.map +1 -1
- package/dist/auth/types/service-keys.d.ts +58 -0
- package/dist/auth/types/service-keys.d.ts.map +1 -0
- package/dist/auth/types/session.d.ts +21 -2
- package/dist/auth/types/session.d.ts.map +1 -1
- package/dist/auth/types/shared-api.d.ts +15 -1
- package/dist/auth/types/shared-api.d.ts.map +1 -1
- package/dist/auth/types/sign-in.d.ts +1 -1
- package/dist/auth/types/sign-in.d.ts.map +1 -1
- package/dist/chunks/{index-7h34nqrm.js → index-5hcajrrx.js} +5 -5
- package/dist/chunks/{index-7h34nqrm.js.map → index-5hcajrrx.js.map} +4 -4
- package/dist/chunks/{index-n8jxmxeg.js → index-gzc472ar.js} +2 -2
- package/dist/chunks/{index-ftz0ne6j.js → index-r8fcessc.js} +2 -2
- package/dist/chunks/{index-2ttdcz7n.js → index-vx9a5cpy.js} +9 -3
- package/dist/chunks/{index-2ttdcz7n.js.map → index-vx9a5cpy.js.map} +4 -4
- package/dist/conformance/api-keys/cases/index.d.ts.map +1 -1
- package/dist/conformance/api-keys/cases/outage.d.ts.map +1 -1
- package/dist/conformance/api-keys/cases/service.d.ts +3 -0
- package/dist/conformance/api-keys/cases/service.d.ts.map +1 -0
- package/dist/conformance/index.js +407 -302
- package/dist/conformance/index.js.map +6 -5
- package/dist/errors/janus-error/codes.invitations.d.ts +6 -0
- package/dist/errors/janus-error/codes.invitations.d.ts.map +1 -1
- package/dist/errors/janus-error/index.d.ts +1 -1
- package/dist/errors/janus-error/index.d.ts.map +1 -1
- package/dist/errors/janus-error/options.d.ts +1 -1
- package/dist/errors/janus-error/options.d.ts.map +1 -1
- package/dist/errors/janus-error/refusals.d.ts +5 -0
- package/dist/errors/janus-error/refusals.d.ts.map +1 -1
- package/dist/errors/janus-error/status.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +428 -100
- package/dist/index.js.map +22 -16
- package/dist/permissions/index.js +3 -3
- package/docs/README.md +1 -0
- package/docs/guide/api-keys.md +78 -1
- package/docs/guide/errors.md +1 -0
- package/docs/guide/second-factor.md +1 -1
- package/docs/guide/sessions.md +3 -1
- package/docs/guide/signed-tokens.md +46 -0
- package/docs/roadmap.md +3 -1
- package/docs/troubleshooting.md +17 -5
- package/package.json +1 -1
- /package/dist/chunks/{index-n8jxmxeg.js.map → index-gzc472ar.js.map} +0 -0
- /package/dist/chunks/{index-ftz0ne6j.js.map → index-r8fcessc.js.map} +0 -0
package/README.md
CHANGED
|
@@ -207,6 +207,7 @@ if (error instanceof JanusError) {
|
|
|
207
207
|
| `CURSOR_FILTER_MISMATCH` | 400 |
|
|
208
208
|
| `UNSUPPORTED` | 501 — a wiring mistake, and the message names the store to change |
|
|
209
209
|
| `PERMISSION_DEPTH` | 500 — a permission check or list walked past `maxDepth`; not a denial |
|
|
210
|
+
| `API_KEY_REFUSED` | 403 — `apiKeys.createService` was refused by `apiKeys.service.authorize` |
|
|
210
211
|
| `API_KEY_LIMIT` | 409 — the user holds `maxActive` API keys; `maxActive` belongs in the body, and they revoke one first |
|
|
211
212
|
| `API_KEY_INVALID` | 400 — a key's name, lifetime, scopes or bound object is refused; `field` says which |
|
|
212
213
|
| `INVITATION_INVALID` | 400 — a code that names no pending invitation (one code for unknown, malformed, accepted, revoked and lapsed, told apart by `reason`), or an invitation field that cannot be kept (`field`) |
|
|
@@ -330,7 +331,7 @@ read it. Where you do show a total, ask for it apart: `auth.count()`, or
|
|
|
330
331
|
[users](docs/guide/users.md#searching-by-e-mail-prefix)), and `namePrefix` the
|
|
331
332
|
same way for the display name
|
|
332
333
|
([users](docs/guide/users.md#searching-by-display-name)). `nextCursor` is `string | null` with no `undefined`, so `while (cursor)`
|
|
333
|
-
is the loop.
|
|
334
|
+
is the loop. A page may come back short, even empty, with a `nextCursor`: follow it until it is `null`.
|
|
334
335
|
|
|
335
336
|
`fixedClock` is **shipped, not test-only** — testing session expiry needs it, and
|
|
336
337
|
so do your own tests.
|
|
@@ -773,6 +774,8 @@ Keeping the keys in one variable (`"id:key,id:key"`)? `parseSealingKeys(process.
|
|
|
773
774
|
|
|
774
775
|
Sealing a secret of your own with the same keys? `sealerFor(keys, 'integration-keys')` returns `{ seal(id, plaintext), unseal(id, sealed), sealWith, needsReseal(sealed) }` with a key derived for that purpose, so it never shares one with the second factor; `unseal` answers `null` on any failure ([guide](docs/guide/second-factor.md#sealing-your-own-secrets-sealerfor)).
|
|
775
776
|
|
|
777
|
+
Handing out a signed, expiring link (a download URL, an unsubscribe link)? `signToken(keys, 'download', payload, { expiresIn: '15m' })` returns `v1.<key id>.<payload>.<HMAC>` and `verifyToken(keys, 'download', token)` answers `{ payload, expiresAt, keyId, needsResign }` or `null` (expired, changed, another purpose, a key no longer held), with the same keys and rotation as `sealerFor` ([guide](docs/guide/signed-tokens.md)). Magic links do not use it: they store a hashed one-time secret.
|
|
778
|
+
|
|
776
779
|
- **`signIn` answers a union once `secondFactor` is configured**:
|
|
777
780
|
`{ status: 'signedIn', user, session, token }`, or
|
|
778
781
|
`{ status: 'secondFactor', challenge, expiresAt, userId }` for a user whose factor
|
|
@@ -789,9 +792,9 @@ Sealing a secret of your own with the same keys? `sealerFor(keys, 'integration-k
|
|
|
789
792
|
- **Which proof opened the session.** `confirm` answers `method: 'totp'`,
|
|
790
793
|
`recover` `method: 'recovery'` and `confirmPasskey` `method: 'passkey'`
|
|
791
794
|
(`SecondFactorProof`), so an application can alert on a recovery-code
|
|
792
|
-
sign-in or record its own `amr` value. The session's `amr`
|
|
793
|
-
|
|
794
|
-
|
|
795
|
+
sign-in or record its own `amr` value. The session's `amr` says it too:
|
|
796
|
+
`otp`, `mfa` for an app code and `rec`, `mfa` for a recovery code
|
|
797
|
+
(RFC 8176); `session.id` is on the result.
|
|
795
798
|
- **Recovery codes, for a lost phone.** `activate` answers a
|
|
796
799
|
`RecoveryCodesIssued` — `{ user, recoveryCodes }`, ten single-use codes,
|
|
797
800
|
shown once, stored only as keyed hashes. `recover(challenge, code)` redeems a
|
|
@@ -2262,6 +2265,8 @@ it must not read anything tied to the request (a body stream, a transaction, a
|
|
|
2262
2265
|
scoped connection), or it fails and logs `<name> failed in the background: …`.
|
|
2263
2266
|
Copy what it needs before calling `run`.
|
|
2264
2267
|
|
|
2268
|
+
**`verifyToken` answers `null` for every bad token.** A renamed `purpose`, a key dropped while tokens it signed are still out, an expired or a changed token all look the same, by design: answer 404 or 410, never say which. Keep a key until its tokens have expired ([guide](docs/guide/signed-tokens.md)).
|
|
2269
|
+
|
|
2265
2270
|
**`sealerFor` answers a silent `null` when a value cannot open.** Renaming a
|
|
2266
2271
|
`purpose`, or dropping a key before every value sealed with it was sealed
|
|
2267
2272
|
again, makes `unseal` answer `null` for those values, as it does for any
|
|
@@ -2909,7 +2914,7 @@ subdomain) and `https`, except `http://localhost`, `http://<name>.localhost` (su
|
|
|
2909
2914
|
|
|
2910
2915
|
## Type safety, counted
|
|
2911
2916
|
|
|
2912
|
-
**Three hundred and
|
|
2917
|
+
**Three hundred and sixty-one plausible mistakes, three hundred and sixty-one refused at compile time — and
|
|
2913
2918
|
two gaps, named.**
|
|
2914
2919
|
|
|
2915
2920
|
The lists are typechecked and never run, with one `@ts-expect-error` per
|
|
@@ -2917,7 +2922,7 @@ mistake beside the shapes that must keep compiling. Two are single files:
|
|
|
2917
2922
|
`test/types/refusals.ts` (sixteen, on the shared vocabulary) and `test/types/issuers.ts` (four, on `createJanusIssuers`: no `resolve`, no `build`, a numeric `version`, an instance read without its `null`). The other four
|
|
2918
2923
|
are folders with one file per behaviour: `test/types/port/` (forty-nine, on
|
|
2919
2924
|
the identity stores' port, from the point of view of the person implementing
|
|
2920
|
-
it), `test/types/auth/` (
|
|
2925
|
+
it), `test/types/auth/` (two hundred and nine, on `janus()`, from the point of view of
|
|
2921
2926
|
the application — thirteen of them on the second factor, three on sign-in codes,
|
|
2922
2927
|
five on user events, four on step-ups, six on the sign-in throttle, five on the mail throttle, three on the second-factor throttle, four on
|
|
2923
2928
|
sign-in links, six on devices, seven on reading and writing users (two of them on `findMany`), five on requests in two steps, three on signing in on the application's proof, three on finding a user by e-mail, three on proving an e-mail on the application's proof, six on changing an e-mail, sixteen on confirming a link at the root of several types and binding it to a user, twelve on the wiring of `janus()` (reserved type names included), six on signing up and in, four on `findOrCreate`, five on avatars, five on verified sign-up, two on the cut-off of `signOutEverywhere`, nine on API keys (five on scopes, bound objects and expiry notices), thirty-two on invitations — a `beforeAccept` that answers an object, a user type with no e-mail, a login that is not the e-mail, several types and no `type`, a `type` that is none of them, `accept` without the block, a `get` without its `scope`, a numeric `id`, an `issue` that leaves `invitedBy` out, a `ref`, `order`, `status`, `role` or `lapsed` of the wrong type, a `by` that is no string on `revoke` or `resend`, a list of types with an unknown name, a login that is not the e-mail or no e-mail, an empty list, a name listed twice, and an `issue` whose `type` is not a string, is none of the listed types or is missing with several types, and an `importHistory` record that is accepted without `acceptedAt`, revoked without `revokedAt`, of an unknown status, with no `key`, with a `type` that is not listed or a `createdAt` that is a string, and a `dryRun` that is no boolean — twenty on passkeys and four on the magic-link switch) `test/types/social/` (twenty-one, on `auth.social`: a `social` block with neither providers nor a resolver, a `resolveProvider` that answers a name or undefined, or is not async, a step-up whose `acrValues` is a string, whose `maxAge` is no number, that asks for nothing or that has a third key, a misspelled provider, a type without social, social without an e-mail, a `signUp` on the wrong login or answering the wrong fields, a link given a bare user and a result switch missing a status and a `linked` result read for a session token) and `test/types/permissions/` (sixty, on the
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { type AnyUser, type Context } from '../context';
|
|
6
6
|
import type { ApiKeyStore } from '../port/types';
|
|
7
|
-
import type { KeyAuthenticated } from '../types';
|
|
7
|
+
import type { KeyAuthenticated, ServiceKeyAuthenticated } from '../types';
|
|
8
8
|
/** Whether a token is shaped like one of this instance's keys. */
|
|
9
9
|
export declare function isKeyShaped(prefix: string, token: string): boolean;
|
|
10
10
|
/**
|
|
@@ -17,5 +17,6 @@ export declare function isKeyShaped(prefix: string, token: string): boolean;
|
|
|
17
17
|
*/
|
|
18
18
|
export declare function authenticateKey(context: Context, keys: ApiKeyStore, token: string, options: {
|
|
19
19
|
readonly type?: string;
|
|
20
|
-
|
|
20
|
+
readonly service?: boolean;
|
|
21
|
+
} | undefined): Promise<KeyAuthenticated<AnyUser> | ServiceKeyAuthenticated | null>;
|
|
21
22
|
//# sourceMappingURL=authenticate-key.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate-key.d.ts","sourceRoot":"","sources":["../../../src/auth/api-keys/authenticate-key.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"authenticate-key.d.ts","sourceRoot":"","sources":["../../../src/auth/api-keys/authenticate-key.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,YAAY,CAAC;AAChE,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,eAAe,CAAC;AAE/D,OAAO,KAAK,EACX,gBAAgB,EAChB,uBAAuB,EAEvB,MAAM,UAAU,CAAC;AAIlB,kEAAkE;AAClE,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAElE;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACpC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE;IAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,GACzE,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,GAAG,uBAAuB,GAAG,IAAI,CAAC,CAuDrE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"count.d.ts","sourceRoot":"","sources":["../../../src/auth/api-keys/count.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;GAIG;AACH,wBAAsB,aAAa,CAClC,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,IAAI,EACT,MAAM,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"count.d.ts","sourceRoot":"","sources":["../../../src/auth/api-keys/count.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;GAIG;AACH,wBAAsB,aAAa,CAClC,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,IAAI,EACT,MAAM,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,CAAC,CAmBjB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** What both creations do once their key is inserted: keep it, or revoke it and rethrow. */
|
|
2
|
+
import type { Clock } from '../../../time/clock';
|
|
3
|
+
import type { ApiKeyStore } from '../../port/types';
|
|
4
|
+
/**
|
|
5
|
+
* Settles the checks that follow an insert (the race guard on the count, the
|
|
6
|
+
* creator still standing). A refusal or an outage must leave no standing key
|
|
7
|
+
* nobody holds: the key is revoked, and the failure rethrown. A revoke that
|
|
8
|
+
* fails too is warned of; the token is only answered when the checks pass.
|
|
9
|
+
*/
|
|
10
|
+
export declare function settleInsert(keys: ApiKeyStore, clock: Clock, id: string, checks: Promise<void>, noun: 'an API key' | 'a service key'): Promise<void>;
|
|
11
|
+
//# sourceMappingURL=after-insert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"after-insert.d.ts","sourceRoot":"","sources":["../../../../src/auth/api-keys/create/after-insert.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAE5F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD;;;;;GAKG;AACH,wBAAsB,YAAY,CACjC,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,KAAK,EACZ,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,EACrB,IAAI,EAAE,YAAY,GAAG,eAAe,GAClC,OAAO,CAAC,IAAI,CAAC,CAiBf"}
|
|
@@ -25,6 +25,16 @@ export declare function checkBeforeInsert(context: Context, settings: Settings,
|
|
|
25
25
|
scopes?: readonly string[];
|
|
26
26
|
};
|
|
27
27
|
}>;
|
|
28
|
+
/** A session fresh enough: a key never is, and a stale session needs a step-up. */
|
|
29
|
+
export declare function assertFreshCreator(context: Context, settings: Settings, current: Principal<{
|
|
30
|
+
readonly id: string;
|
|
31
|
+
readonly type: string;
|
|
32
|
+
}>, where?: string): void;
|
|
33
|
+
/** The creating user, read again: active, able to hold keys, e-mail proved, password still the one the session proved. */
|
|
34
|
+
export declare function loadCreator(context: Context, settings: Settings, current: Principal<{
|
|
35
|
+
readonly id: string;
|
|
36
|
+
readonly type: string;
|
|
37
|
+
}>, where?: string): Promise<import("../..").UserRecord>;
|
|
28
38
|
/**
|
|
29
39
|
* What can only be known once the key is stored: the limit still holds
|
|
30
40
|
* against a racing creation, the user still can hold a key, and the session
|
|
@@ -39,4 +49,11 @@ export declare function checkAfterInsert(context: Context, settings: Settings, k
|
|
|
39
49
|
readonly id: string;
|
|
40
50
|
readonly type: string;
|
|
41
51
|
}>, userId: string): Promise<void>;
|
|
52
|
+
/** The creator is still active with the password the session proved, and the session still stands. */
|
|
53
|
+
export declare function checkCreatorStands(context: Context, current: Principal<{
|
|
54
|
+
readonly id: string;
|
|
55
|
+
readonly type: string;
|
|
56
|
+
}>, userId: string, where?: string): Promise<void>;
|
|
57
|
+
export declare function checkName(name: unknown): string;
|
|
58
|
+
export declare function checkLifetime(settings: Settings, lifetime: unknown): number;
|
|
42
59
|
//# sourceMappingURL=checks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../../../src/auth/api-keys/create/checks.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAYlF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,KAAK,OAAO,EAAW,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAIpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAKhE,eAAO,MAAM,KAAK,mBAAmB,CAAC;AAEtC,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC;AAE9D,0CAA0C;AAC1C,MAAM,MAAM,WAAW,GAAG,iBAAiB,CAAC,MAAM,GAAG,MAAM,CAAC,CA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appings":"AAAA,4EAA4E;AAG5E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/auth/api-keys/create/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAG5E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAc,MAAM,aAAa,CAAC;AAKxE,OAAO,EACN,KAAK,WAAW,EAGhB,KAAK,QAAQ,EACb,MAAM,UAAU,CAAC;AAElB,wBAAsB,YAAY,CACjC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,SAAS,CAAC;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,EAClE,KAAK,EAAE,WAAW,GAChB,OAAO,CAAC,aAAa,CAAC,CA0CxB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** The checks of `apiKeys.createService` that read only its input and configuration. */
|
|
2
|
+
import { ApiKeyLimitError } from '../../../errors/janus-error';
|
|
3
|
+
import type { CreateServiceKeyInput } from '../../types';
|
|
4
|
+
import { type Settings } from './checks';
|
|
5
|
+
export declare const WHERE = "apiKeys.createService";
|
|
6
|
+
export declare function limitReached(maxActive: number): ApiKeyLimitError;
|
|
7
|
+
export declare function checkOwner(owner: unknown): {
|
|
8
|
+
type: string;
|
|
9
|
+
id: string;
|
|
10
|
+
};
|
|
11
|
+
/** A configured lifetime in ms, or `null` for `'never'` when the configuration lists it. */
|
|
12
|
+
export declare function checkServiceLifetime(settings: Settings, lifetime: unknown): number | null;
|
|
13
|
+
export declare function checkDetails(details: unknown): Readonly<Record<string, unknown>> | undefined;
|
|
14
|
+
/** The name, owner, scopes, lifetime and details of a service key, checked in that order. */
|
|
15
|
+
export declare function checkServiceInput(settings: Settings, input: CreateServiceKeyInput<string | number> | undefined): {
|
|
16
|
+
name: string;
|
|
17
|
+
owner: {
|
|
18
|
+
type: string;
|
|
19
|
+
id: string;
|
|
20
|
+
};
|
|
21
|
+
scopes: readonly string[];
|
|
22
|
+
lifetimeMs: number | null;
|
|
23
|
+
details: Readonly<Record<string, unknown>> | undefined;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=service-checks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-checks.d.ts","sourceRoot":"","sources":["../../../../src/auth/api-keys/create/service-checks.ts"],"names":[],"mappings":"AAAA,wFAAwF;AAExF,OAAO,EAEN,gBAAgB,EAChB,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EAA4B,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEnE,eAAO,MAAM,KAAK,0BAA0B,CAAC;AAG7C,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,CAKhE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO;;;EAQxC;AAED,4FAA4F;AAC5F,wBAAgB,oBAAoB,CACnC,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,OAAO,GACf,MAAM,GAAG,IAAI,CASf;AAED,wBAAgB,YAAY,CAC3B,OAAO,EAAE,OAAO,GACd,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAyB/C;AAED,6FAA6F;AAC7F,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,qBAAqB,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,SAAS;;;;;;;;;EAazD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** `apiKeys.createService`: a key that belongs to an object, not to its creator. */
|
|
2
|
+
import type { Context } from '../../context';
|
|
3
|
+
import type { ApiKeyStore } from '../../port/types';
|
|
4
|
+
import type { ApiKey, CreatedApiKey, CreateServiceKeyInput, Principal } from '../../types';
|
|
5
|
+
import { type Settings } from './checks';
|
|
6
|
+
type Current = Principal<{
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly type: string;
|
|
9
|
+
}>;
|
|
10
|
+
export declare function createServiceKey(context: Context, settings: Settings, keys: ApiKeyStore, current: Current, input: CreateServiceKeyInput<string | number>): Promise<CreatedApiKey<ApiKey>>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/auth/api-keys/create/service.ts"],"names":[],"mappings":"AAAA,oFAAoF;AAIpF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EACX,MAAM,EACN,aAAa,EACb,qBAAqB,EACrB,SAAS,EACT,MAAM,aAAa,CAAC;AAMrB,OAAO,EAIN,KAAK,QAAQ,EACb,MAAM,UAAU,CAAC;AAGlB,KAAK,OAAO,GAAG,SAAS,CAAC;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEzE,wBAAsB,gBAAgB,CACrC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,qBAAqB,CAAC,MAAM,GAAG,MAAM,CAAC,GAC3C,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAmFhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expiry.d.ts","sourceRoot":"","sources":["../../../src/auth/api-keys/expiry.ts"],"names":[],"mappings":"AAAA,iGAAiG;AAMjG,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"expiry.d.ts","sourceRoot":"","sources":["../../../src/auth/api-keys/expiry.ts"],"names":[],"mappings":"AAAA,iGAAiG;AAMjG,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,UAAU,CAAC;AAIvD,KAAK,GAAG,GAAG,UAAU,CAAC;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACtB,CAAC,CAAC,SAAS,CAAC,CAAC;AAEd,wBAAgB,SAAS,CACxB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,WAAW,GACf,IAAI,CAAC,GAAG,EAAE,UAAU,GAAG,oBAAoB,CAAC,CA4C9C"}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
/** The `auth.apiKeys` surface: create, get, list, revoke, revokeAll, and the bound and expiry methods beside. */
|
|
2
2
|
import { type Context } from '../context';
|
|
3
3
|
import type { ApiKeyStore } from '../port/types';
|
|
4
|
-
import type { ApiKeysApi } from '../types';
|
|
4
|
+
import type { ApiKeysApi, ServiceKeysApi } from '../types';
|
|
5
5
|
/** `ApiKeysApi`, degenericised: `janus()` casts it to the typed form once. */
|
|
6
|
-
type
|
|
6
|
+
type ApiKeysOnly = ApiKeysApi<{
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly type: string;
|
|
9
|
+
}>['apiKeys'];
|
|
10
|
+
type InternalApiKeysApi = ApiKeysOnly & ServiceKeysApi<{
|
|
7
11
|
readonly id: string;
|
|
8
12
|
readonly type: string;
|
|
9
13
|
}>['apiKeys'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../../src/auth/api-keys/flows.ts"],"names":[],"mappings":"AAAA,iHAAiH;AAIjH,OAAO,EAAE,KAAK,OAAO,EAAS,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../../src/auth/api-keys/flows.ts"],"names":[],"mappings":"AAAA,iHAAiH;AAIjH,OAAO,EAAE,KAAK,OAAO,EAAS,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAQ3D,8EAA8E;AAC9E,KAAK,WAAW,GAAG,UAAU,CAAC;IAC7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACtB,CAAC,CAAC,SAAS,CAAC,CAAC;AACd,KAAK,kBAAkB,GAAG,WAAW,GACpC,cAAc,CAAC;IACd,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACtB,CAAC,CAAC,SAAS,CAAC,CAAC;AAEf,wEAAwE;AACxE,wBAAgB,UAAU,CACzB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,WAAW,GACf,kBAAkB,CAyDpB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** The service keys of one object: the bound keys that no user holds. */
|
|
2
|
+
import type { CursorPage } from '../../pagination/cursor-page';
|
|
3
|
+
import type { ApiKeyBound, ApiKeyPageRequest, ApiKeyRecord, ApiKeyStore } from '../port/types';
|
|
4
|
+
/**
|
|
5
|
+
* One page of the service keys bound to `owner`, in id order: the store's
|
|
6
|
+
* `listBoundApiKeys`, read `READ` at a time and kept when `userId` is `null`,
|
|
7
|
+
* until the page fills (one more is read to know whether another follows).
|
|
8
|
+
*/
|
|
9
|
+
export declare function listOwnedRecords(keys: ApiKeyStore, owner: ApiKeyBound, { first, after }: ApiKeyPageRequest, where: string): Promise<CursorPage<ApiKeyRecord>>;
|
|
10
|
+
/** How many standing service keys `owner` holds at `now`, counted up to `stopAt`. */
|
|
11
|
+
export declare function countOwnedStanding(keys: ApiKeyStore, owner: ApiKeyBound, now: Date, stopAt: number, where: string): Promise<number>;
|
|
12
|
+
//# sourceMappingURL=owned.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"owned.d.ts","sourceRoot":"","sources":["../../../src/auth/api-keys/owned.ts"],"names":[],"mappings":"AAAA,yEAAyE;AAEzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,KAAK,EACX,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,MAAM,eAAe,CAAC;AAKvB;;;;GAIG;AACH,wBAAsB,gBAAgB,CACrC,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,WAAW,EAClB,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,iBAAiB,EACnC,KAAK,EAAE,MAAM,GACX,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAqBnC;AAED,qFAAqF;AACrF,wBAAsB,kBAAkB,CACvC,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,IAAI,EACT,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,CAAC,CAqBjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../src/auth/api-keys/read.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAK5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../src/auth/api-keys/read.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAK5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,UAAU,CAAC;AAKvD,KAAK,GAAG,GAAG,UAAU,CAAC;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACtB,CAAC,CAAC,SAAS,CAAC,CAAC;AAEd,wBAAgB,OAAO,CACtB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,WAAW,GACf,IAAI,CAAC,GAAG,EAAE,KAAK,GAAG,MAAM,CAAC,CAqD3B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** The service half of `auth.apiKeys`: createService, listOwned and revokeOwned. */
|
|
2
|
+
import type { Context } from '../context';
|
|
3
|
+
import type { ApiKeyStore } from '../port/types';
|
|
4
|
+
import type { ServiceKeysApi } from '../types';
|
|
5
|
+
import type { Settings } from './create/checks';
|
|
6
|
+
type Service = ServiceKeysApi<{
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly type: string;
|
|
9
|
+
}>['apiKeys'];
|
|
10
|
+
/** Only built when `apiKeys.service` is configured. */
|
|
11
|
+
export declare function serviceApi(context: Context, settings: Settings, keys: ApiKeyStore): Service;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=service-flows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-flows.d.ts","sourceRoot":"","sources":["../../../src/auth/api-keys/service-flows.ts"],"names":[],"mappings":"AAAA,oFAAoF;AAKpF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAMhD,KAAK,OAAO,GAAG,cAAc,CAAC;IAC7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACtB,CAAC,CAAC,SAAS,CAAC,CAAC;AAEd,uDAAuD;AACvD,wBAAgB,UAAU,CACzB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,WAAW,GACf,OAAO,CA4CT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-api-key.d.ts","sourceRoot":"","sources":["../../../src/auth/api-keys/to-api-key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGvC;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"to-api-key.d.ts","sourceRoot":"","sources":["../../../src/auth/api-keys/to-api-key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGvC;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,MAAM,CAiBrE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Duration } from '../../time/duration';
|
|
2
|
-
import type { ApiKeyStore } from '../port/types';
|
|
2
|
+
import type { ApiKeyBound, ApiKeyStore } from '../port/types';
|
|
3
3
|
/** What API keys need: their store, a token prefix, and the lifetimes a key may have. */
|
|
4
4
|
export interface ApiKeysConfig {
|
|
5
5
|
/** `createMemoryApiKeys()`, or an adapter's. */
|
|
@@ -13,8 +13,10 @@ export interface ApiKeysConfig {
|
|
|
13
13
|
/**
|
|
14
14
|
* The lifetimes a key may be created with — at least `'1d'` each. **There
|
|
15
15
|
* is no default and no unlimited key**: the user picks one of these.
|
|
16
|
+
* `'never'` is the opt-in of **service keys** (it needs `service`): only
|
|
17
|
+
* `apiKeys.createService` takes it, a user's key never does.
|
|
16
18
|
*/
|
|
17
|
-
readonly lifetimes: readonly [Duration, ...Duration[]];
|
|
19
|
+
readonly lifetimes: readonly [Duration | 'never', ...(Duration | 'never')[]];
|
|
18
20
|
/** The standing keys one user may hold, 1 to 100. `10` when absent. */
|
|
19
21
|
readonly maxActive?: number;
|
|
20
22
|
/** How recently the session must have proved who it is to create a key. `'10m'` when absent. */
|
|
@@ -29,5 +31,30 @@ export interface ApiKeysConfig {
|
|
|
29
31
|
* them. `changePassword` and `signOutEverywhere` never touch keys.
|
|
30
32
|
*/
|
|
31
33
|
readonly revokeOnPasswordReset?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Turns on service keys — `apiKeys.createService`, `listOwned`,
|
|
36
|
+
* `revokeOwned` — keys that belong to an object, outlive their creator and
|
|
37
|
+
* may never expire. Absent: no service key can be made.
|
|
38
|
+
*/
|
|
39
|
+
readonly service?: ServiceKeysConfig;
|
|
40
|
+
}
|
|
41
|
+
/** What service keys need: who may make one, and how many an owner may hold. */
|
|
42
|
+
export interface ServiceKeysConfig {
|
|
43
|
+
/**
|
|
44
|
+
* Called after the session and the user are checked, before anything is
|
|
45
|
+
* written. `false` refuses with `API_KEY_REFUSED` (403); a throw is thrown
|
|
46
|
+
* as it is. This is where the application checks that `user` may manage
|
|
47
|
+
* keys of `owner` and ask for `scopes`.
|
|
48
|
+
*/
|
|
49
|
+
readonly authorize: (request: {
|
|
50
|
+
readonly user: {
|
|
51
|
+
readonly id: string;
|
|
52
|
+
readonly type: string;
|
|
53
|
+
};
|
|
54
|
+
readonly owner: ApiKeyBound;
|
|
55
|
+
readonly scopes: readonly string[];
|
|
56
|
+
}) => boolean | Promise<boolean>;
|
|
57
|
+
/** The standing service keys one owner may hold, 1 to 100. `10` when absent. */
|
|
58
|
+
readonly maxActive?: number;
|
|
32
59
|
}
|
|
33
60
|
//# sourceMappingURL=api-keys-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys-config.d.ts","sourceRoot":"","sources":["../../../src/auth/config/api-keys-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"api-keys-config.d.ts","sourceRoot":"","sources":["../../../src/auth/config/api-keys-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE9D,yFAAyF;AACzF,MAAM,WAAW,aAAa;IAC7B,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC,QAAQ,GAAG,OAAO,EAAE,GAAG,CAAC,QAAQ,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC;IAC7E,uEAAuE;IACvE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,gGAAgG;IAChG,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC;IAChC,uFAAuF;IACvF,QAAQ,CAAC,aAAa,CAAC,EAAE,QAAQ,CAAC;IAClC,iEAAiE;IACjE,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC;;;;OAIG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IACzC;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,iBAAiB,CAAC;CACrC;AAED,gFAAgF;AAChF,MAAM,WAAW,iBAAiB;IACjC;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE;QAC7B,QAAQ,CAAC,IAAI,EAAE;YAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC;QAC9D,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;QAC5B,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;KACnC,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACjC,gFAAgF;IAChF,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC5B"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Gathered here from the files beside this one.
|
|
10
10
|
*/
|
|
11
|
-
export type { ApiKeysConfig } from './api-keys-config';
|
|
11
|
+
export type { ApiKeysConfig, ServiceKeysConfig } from './api-keys-config';
|
|
12
12
|
export type { PasswordHasher } from './hasher';
|
|
13
13
|
export type { InvitationsConfig } from './invitations-config';
|
|
14
14
|
export type { CookieConfig, DevicesConfig, JanusConfig, MailConfig, MailThrottleConfig, MultiTypeConfig, SecondFactorConfig, SecondFactorThrottleConfig, SignInConfig, SignInThrottleConfig, SingleTypeConfig, } from './janus-config';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/config/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/config/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC1E,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,YAAY,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,YAAY,EACX,YAAY,EACZ,aAAa,EACb,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,0BAA0B,EAC1B,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,GAChB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,KAAK,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACvE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EACX,cAAc,EACd,cAAc,EACd,YAAY,GACZ,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACX,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,mBAAmB,GACnB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACX,UAAU,EACV,aAAa,EACb,UAAU,EACV,cAAc,GACd,MAAM,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-api-keys.d.ts","sourceRoot":"","sources":["../../../src/auth/config/resolve-api-keys.ts"],"names":[],"mappings":"AAAA,sHAAsH;AAGtH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAKtE,wBAAgB,cAAc,CAC7B,MAAM,EAAE,aAAa,GAAG,SAAS,EACjC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,EACxC,KAAK,EAAE,MAAM,GACX,cAAc,CAAC,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"resolve-api-keys.d.ts","sourceRoot":"","sources":["../../../src/auth/config/resolve-api-keys.ts"],"names":[],"mappings":"AAAA,sHAAsH;AAGtH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAKtE,wBAAgB,cAAc,CAC7B,MAAM,EAAE,aAAa,GAAG,SAAS,EACjC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,EACxC,KAAK,EAAE,MAAM,GACX,cAAc,CAAC,SAAS,CAAC,CA+D3B"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import type { InvitationEventListener } from '../invitations/events';
|
|
6
6
|
import type { PasskeyRelyingParty, PasskeyVerifier } from '../passkeys/verifier';
|
|
7
7
|
import type { Sealer } from '../sealing';
|
|
8
|
+
import type { ApiKeysConfig } from './api-keys-config';
|
|
8
9
|
import type { InvitationsConfig } from './invitations-config';
|
|
9
10
|
import type { SocialProfile, SocialProvider, SocialProviderResolver } from './social-config';
|
|
10
11
|
import type { UserSchema } from './user-type';
|
|
@@ -97,6 +98,13 @@ export interface ResolvedConfig {
|
|
|
97
98
|
readonly apiKeys: {
|
|
98
99
|
readonly prefix: string;
|
|
99
100
|
readonly lifetimesMs: readonly number[];
|
|
101
|
+
/** Whether `lifetimes` lists `'never'`. */
|
|
102
|
+
readonly never: boolean;
|
|
103
|
+
/** `null` without `apiKeys.service`. */
|
|
104
|
+
readonly service: {
|
|
105
|
+
readonly authorize: NonNullable<ApiKeysConfig['service']>['authorize'];
|
|
106
|
+
readonly maxActive: number;
|
|
107
|
+
} | null;
|
|
100
108
|
readonly maxActive: number;
|
|
101
109
|
readonly freshWithinMs: number;
|
|
102
110
|
readonly lastUsedEveryMs: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolved-config.d.ts","sourceRoot":"","sources":["../../../src/auth/config/resolved-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,KAAK,EACX,mBAAmB,EACnB,eAAe,EACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EACX,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,8CAA8C;AAC9C,MAAM,WAAW,cAAc;IAC9B,8EAA8E;IAC9E,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACxD,wCAAwC;IACxC,QAAQ,CAAC,eAAe,EAAE,sBAAsB,GAAG,IAAI,CAAC;IACxD,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,EAAE,KAAK,GAAG,CAAC,CAAC,OAAO,EAAE,aAAa,KAAK,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;QAChB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;QAC7C,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;KACzB,CAAC;CACF"}
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { ApiKeysConfig, CookieConfig, DevicesConfig, FederatedAmr, FieldsJson, InvitationsConfig, JanusConfig, MagicLinkConfig, MailConfig, MailThrottleConfig, MultiTypeConfig, Normalize, PasskeysConfig, PasswordConfig, PasswordHasher, SecondFactorConfig, SecondFactorThrottleConfig, SessionConfig, SignInConfig, SignInThrottleConfig, SingleTypeConfig, SocialConfig, SocialIdentity, SocialProfile, SocialProvider, SocialProviderResolver, SocialStepUpRequest, UserSchema, UserTypeConfig, } from './config';
|
|
1
|
+
export type { ApiKeysConfig, CookieConfig, DevicesConfig, FederatedAmr, FieldsJson, InvitationsConfig, JanusConfig, MagicLinkConfig, MailConfig, MailThrottleConfig, MultiTypeConfig, Normalize, PasskeysConfig, PasswordConfig, PasswordHasher, SecondFactorConfig, SecondFactorThrottleConfig, ServiceKeysConfig, SessionConfig, SignInConfig, SignInThrottleConfig, SingleTypeConfig, SocialConfig, SocialIdentity, SocialProfile, SocialProvider, SocialProviderResolver, SocialStepUpRequest, UserSchema, UserTypeConfig, } from './config';
|
|
2
2
|
export { DEVICE_COOKIE, type DeviceCookieOptions, deviceCookie, deviceFromCookieHeader, } from './devices/cookie';
|
|
3
3
|
export type { UserEvent, UserEventListener, UserEventType, } from './events';
|
|
4
4
|
export { bunHasher, scryptHasher } from './hashers';
|
|
@@ -16,7 +16,8 @@ export { type PurposeSealer, sealerFor } from './sealer-for';
|
|
|
16
16
|
export type { SealingKey } from './sealing';
|
|
17
17
|
export { AMR, isMultiFactor } from './sessions/amr';
|
|
18
18
|
export { assertFresh } from './sessions/fresh';
|
|
19
|
+
export { type SignTokenOptions, signToken, type VerifiedToken, type VerifyTokenOptions, verifyToken, } from './signed-token';
|
|
19
20
|
export { isReturnTo } from './social/return-to';
|
|
20
21
|
export type { StandardSchemaV1 } from './standard-schema';
|
|
21
|
-
export type { AcceptedInvitation, AnyTypeChangeEmailApi, AnyTypeResetPasswordApi, AnyTypeVerifyEmailApi, ApiKey, ApiKeyListOptions, ApiKeyPage, ApiKeysApi, Authenticated, AvatarApi, ChangeEmailApi, Checked, CreateApiKeyInput, CreatedApiKey, EmailOf, FindByEmailApi, FindOrCreateApi, FirstProof, HeaderRecord, HistoryRecord, HistoryRefusal, ImportHistoryItem, ImportHistoryOptions, ImportHistoryReport, Invitation, InvitationPreview, InvitationsApi, IssuedCode, IssuedInvitation, IssuedToken, Janus, KeyAuthenticated, LoginOf, MagicLinkApi, Passkey, PasskeyFirstFactorApi, PasskeyRegistrationOptions, PasskeySignInApi, PasskeySignInChallenge, PasskeySignInOptions, PasskeysApi, PasswordApi, PreparedCode, PreparedRequest, Principal, ProvenSignInApi, RecoveredSignIn, RecoveryCodesIssued, RequestLike, RequiredStringKeys, ResetPasswordApi, SecondFactorApi, SecondFactorEnrolment, SecondFactorMethod, SecondFactorProof, SecondFactorRequired, SecondFactorResealed, SecondFactorSignedIn, Session, SharedApi, SignedIn, SignInCodeApi, SignInOptions, SignInResult, SocialApi, SocialCompleted, SocialFlowStart, SocialLink, SocialLinked, SocialStepUp, SocialStepUpProof, SpentRecoveryCode, StepUpApi, StepUpByApp, StepUpByEmail, StepUpByPasskey, StepUpPasskeyApi, TypeApi, TypesOf, User, UserAvatar, UserBase, UserOf, UserRef, UserTypeApi, VerifyEmailApi, WriteOptions, } from './types';
|
|
22
|
+
export type { AcceptedInvitation, AnyTypeChangeEmailApi, AnyTypeResetPasswordApi, AnyTypeVerifyEmailApi, ApiKey, ApiKeyListOptions, ApiKeyPage, ApiKeysApi, Authenticated, AvatarApi, ChangeEmailApi, Checked, CreateApiKeyInput, CreatedApiKey, CreateServiceKeyInput, EmailOf, FindByEmailApi, FindOrCreateApi, FirstProof, HeaderRecord, HistoryRecord, HistoryRefusal, ImportHistoryItem, ImportHistoryOptions, ImportHistoryReport, Invitation, InvitationPreview, InvitationsApi, IssuedCode, IssuedInvitation, IssuedToken, Janus, KeyAuthenticated, LoginOf, MagicLinkApi, Passkey, PasskeyFirstFactorApi, PasskeyRegistrationOptions, PasskeySignInApi, PasskeySignInChallenge, PasskeySignInOptions, PasskeysApi, PasswordApi, PreparedCode, PreparedRequest, Principal, ProvenSignInApi, RecoveredSignIn, RecoveryCodesIssued, RequestLike, RequiredStringKeys, ResetPasswordApi, SecondFactorApi, SecondFactorEnrolment, SecondFactorMethod, SecondFactorProof, SecondFactorRequired, SecondFactorResealed, SecondFactorSignedIn, ServiceKeyAuthenticated, ServiceKeysApi, Session, SharedApi, SignedIn, SignInCodeApi, SignInOptions, SignInResult, SocialApi, SocialCompleted, SocialFlowStart, SocialLink, SocialLinked, SocialStepUp, SocialStepUpProof, SpentRecoveryCode, StepUpApi, StepUpByApp, StepUpByEmail, StepUpByPasskey, StepUpPasskeyApi, TypeApi, TypesOf, User, UserApiKey, UserAvatar, UserBase, UserOf, UserRef, UserTypeApi, VerifyEmailApi, WriteOptions, } from './types';
|
|
22
23
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/auth/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACX,aAAa,EACb,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,SAAS,EACT,cAAc,EACd,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,0B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,OAAO,EACP,qBAAqB,EACrB,0BAA0B,EAC1B,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,eAAe,EACf,SAAS,EACT,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,OAAO,EACP,SAAS,EACT,QAAQ,EACR,aAAa,EACb,aAAa,EACb,YAAY,EACZ,SAAS,EACT,eAAe,EACf,eAAe,EACf,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,OAAO,EACP,OAAO,EACP,IAAI,EACJ,UAAU,EACV,QAAQ,EACR,MAAM,EACN,OAAO,EACP,WAAW,EACX,cAAc,EACd,YAAY,GACZ,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACX,aAAa,EACb,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,SAAS,EACT,cAAc,EACd,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,0BAA0B,EAC1B,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,mBAAmB,EACnB,UAAU,EACV,cAAc,GACd,MAAM,UAAU,CAAC;AAClB,OAAO,EACN,aAAa,EACb,KAAK,mBAAmB,EACxB,YAAY,EACZ,sBAAsB,GACtB,MAAM,kBAAkB,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,EACT,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,OAAO,EACP,SAAS,EACT,QAAQ,EACR,aAAa,EACb,aAAa,EACb,YAAY,EACZ,SAAS,EACT,eAAe,EACf,eAAe,EACf,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,OAAO,EACP,OAAO,EACP,IAAI,EACJ,UAAU,EACV,UAAU,EACV,QAAQ,EACR,MAAM,EACN,OAAO,EACP,WAAW,EACX,cAAc,EACd,YAAY,GACZ,MAAM,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../../../src/auth/port/memory/api-keys/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,kBAAkB,EAClB,yBAAyB,EACzB,QAAQ,EACR,YAAY,EACZ,sBAAsB,EACtB,MAAM,aAAa,CAAC;AAGrB,2DAA2D;AAC3D,wBAAgB,YAAY,CAC3B,IAAI,EAAE,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC,GAC/B,kBAAkB,CAuBpB;AAED,+DAA+D;AAC/D,wBAAgB,gBAAgB,CAC/B,IAAI,EAAE,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC,GAC/B,sBAAsB,CAcxB;AAED,kEAAkE;AAClE,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC,GAC/B,yBAAyB,
|
|
1
|
+
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../../../src/auth/port/memory/api-keys/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,kBAAkB,EAClB,yBAAyB,EACzB,QAAQ,EACR,YAAY,EACZ,sBAAsB,EACtB,MAAM,aAAa,CAAC;AAGrB,2DAA2D;AAC3D,wBAAgB,YAAY,CAC3B,IAAI,EAAE,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC,GAC/B,kBAAkB,CAuBpB;AAED,+DAA+D;AAC/D,wBAAgB,gBAAgB,CAC/B,IAAI,EAAE,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC,GAC/B,sBAAsB,CAcxB;AAED,kEAAkE;AAClE,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC,GAC/B,yBAAyB,CAyB3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/auth/port/memory/api-keys/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,kBAAkB,EAClB,yBAAyB,EAGzB,WAAW,EACX,sBAAsB,EACtB,MAAM,aAAa,CAAC;AASrB;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,IAAI,WAAW,GACjD,kBAAkB,GAClB,sBAAsB,GACtB,yBAAyB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/auth/port/memory/api-keys/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,kBAAkB,EAClB,yBAAyB,EAGzB,WAAW,EACX,sBAAsB,EACtB,MAAM,aAAa,CAAC;AASrB;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,IAAI,WAAW,GACjD,kBAAkB,GAClB,sBAAsB,GACtB,yBAAyB,CAsEzB"}
|
|
@@ -31,14 +31,26 @@ export interface ApiKeyBound {
|
|
|
31
31
|
*/
|
|
32
32
|
export interface ApiKeyRecord {
|
|
33
33
|
readonly id: ApiKeyId;
|
|
34
|
-
|
|
34
|
+
/**
|
|
35
|
+
* The user who holds the key; `null` for a **service key**, which belongs
|
|
36
|
+
* to its `bound` object and outlives whoever created it. A store with the
|
|
37
|
+
* `bound` capability stores both, and every method that reads by user
|
|
38
|
+
* (`listUserApiKeys`, `revokeUserApiKeys`, `deleteUserApiKeys`) leaves a
|
|
39
|
+
* `null` one alone.
|
|
40
|
+
*/
|
|
41
|
+
readonly userId: Id | null;
|
|
35
42
|
/** A label the owner chose, to tell their keys apart. */
|
|
36
43
|
readonly name: string;
|
|
37
44
|
/** `sha256` of the secret, hex. */
|
|
38
45
|
readonly secretHash: string;
|
|
39
46
|
readonly createdAt: Date;
|
|
40
|
-
/**
|
|
41
|
-
|
|
47
|
+
/**
|
|
48
|
+
* When the key lapses; `null` for a service key created with the `'never'`
|
|
49
|
+
* lifetime, which stands until revoked. Every other key expires. A store
|
|
50
|
+
* with the `bound` capability stores `null` and never lists it as expiring
|
|
51
|
+
* or deletes it as expired.
|
|
52
|
+
*/
|
|
53
|
+
readonly expiresAt: Date | null;
|
|
42
54
|
/** When the key last authenticated a request, within the throttle; `null` if never. */
|
|
43
55
|
readonly lastUsedAt: Date | null;
|
|
44
56
|
/** `null` while the key stands. */
|
|
@@ -46,7 +58,7 @@ export interface ApiKeyRecord {
|
|
|
46
58
|
/**
|
|
47
59
|
* What the key may do, as the application names it (`mcp:read`…); absent
|
|
48
60
|
* for a key that may do whatever its user may. Only a store with the
|
|
49
|
-
* `bound` capability is handed one.
|
|
61
|
+
* `bound` capability is handed one. A service key always has them.
|
|
50
62
|
*/
|
|
51
63
|
readonly scopes?: readonly string[];
|
|
52
64
|
/**
|
|
@@ -54,6 +66,12 @@ export interface ApiKeyRecord {
|
|
|
54
66
|
* to nothing. Only a store with the `bound` capability is handed one.
|
|
55
67
|
*/
|
|
56
68
|
readonly bound?: ApiKeyBound;
|
|
69
|
+
/**
|
|
70
|
+
* Free-form JSON the application attached to a service key (`domains`…),
|
|
71
|
+
* answered verbatim as `apiKey.details`; absent for a key without any. Only a
|
|
72
|
+
* store with the `bound` capability is handed one.
|
|
73
|
+
*/
|
|
74
|
+
readonly details?: Readonly<Record<string, unknown>>;
|
|
57
75
|
/** When the expiry notice was recorded; absent until it is. */
|
|
58
76
|
readonly expiryNotifiedAt?: Date;
|
|
59
77
|
}
|
|
@@ -134,7 +152,9 @@ export interface ApiKeyStoreBase {
|
|
|
134
152
|
}
|
|
135
153
|
/**
|
|
136
154
|
* The optional capability `bound`: both methods, or neither. A store that has
|
|
137
|
-
* them also stores `scopes` and `bound` as given, and answers them verbatim
|
|
155
|
+
* them also stores `scopes` and `bound` as given, and answers them verbatim,
|
|
156
|
+
* and stores a **service key**: a record whose `userId` is `null` and whose
|
|
157
|
+
* `expiresAt` may be `null` (see {@link ApiKeyRecord}).
|
|
138
158
|
*/
|
|
139
159
|
export interface ApiKeyBoundMethods {
|
|
140
160
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys.d.ts","sourceRoot":"","sources":["../../../../src/auth/port/types/api-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAElE,+DAA+D;AAC/D,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC3B,uEAAuE;IACvE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"api-keys.d.ts","sourceRoot":"","sources":["../../../../src/auth/port/types/api-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQ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;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IAClC;;;;;;;OAOG;IACH,gBAAgB,CACf,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,iBAAiB,GACrB,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;IAErC;;;;OAIG;IACH,kBAAkB,CAAC,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC9E;AAED;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACtC;;;;;OAKG;IACH,oBAAoB,CACnB,MAAM,EAAE,EAAE,EACV,KAAK,EAAE,WAAW,GAAG,IAAI,EACzB,IAAI,EAAE,iBAAiB,GACrB,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;CACrC;AAED,wEAAwE;AACxE,MAAM,WAAW,yBAAyB;IACzC;;;;;OAKG;IACH,mBAAmB,CAClB,OAAO,EAAE,qBAAqB,GAC5B,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;IAErC;;;;;;OAMG;IACH,wBAAwB,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACnE;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,WAChB,SAAQ,eAAe,EACtB,OAAO,CAAC,kBAAkB,CAAC,EAC3B,OAAO,CAAC,sBAAsB,CAAC,EAC/B,OAAO,CAAC,yBAAyB,CAAC;CAAG"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* | e-mailed code, magic link | `otp` |
|
|
9
9
|
* | passkey (user verified) | `hwk`, `user` |
|
|
10
10
|
* | app code (TOTP) as a second factor or step-up | `otp`, `mfa` |
|
|
11
|
-
* | recovery code as a second factor | `
|
|
11
|
+
* | recovery code as a second factor | `rec`, `mfa` |
|
|
12
12
|
* | passkey as a second factor or step-up | `hwk`, `user`, `mfa` |
|
|
13
13
|
* | social provider | `fed`, plus what its `federatedAmr` grants |
|
|
14
14
|
* | `signInProven` (the application's own proof) | none |
|
|
@@ -22,7 +22,7 @@ export declare const AMR: {
|
|
|
22
22
|
readonly oneTimeCode: readonly ["otp"];
|
|
23
23
|
readonly passkey: readonly ["hwk", "user"];
|
|
24
24
|
readonly appCode: readonly ["otp", "mfa"];
|
|
25
|
-
readonly recoveryCode: readonly ["
|
|
25
|
+
readonly recoveryCode: readonly ["rec", "mfa"];
|
|
26
26
|
readonly passkeySecondFactor: readonly ["hwk", "user", "mfa"];
|
|
27
27
|
readonly social: readonly ["fed"];
|
|
28
28
|
};
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* anonymous — and the renewal of a session used past its `renewAfter`.
|
|
4
4
|
*/
|
|
5
5
|
import { type AnyUser, type Context } from '../context';
|
|
6
|
-
import type { Principal, RequestLike } from '../types';
|
|
6
|
+
import type { Principal, RequestLike, ServiceKeyAuthenticated } from '../types';
|
|
7
7
|
/** Answers the user and the session `request` presents, or `null` for anonymous. */
|
|
8
8
|
export declare function authenticate(context: Context, request: RequestLike, options?: {
|
|
9
9
|
readonly type?: string;
|
|
10
10
|
readonly apiKey?: boolean;
|
|
11
|
-
|
|
11
|
+
readonly service?: boolean;
|
|
12
|
+
}): Promise<Principal<AnyUser> | ServiceKeyAuthenticated | null>;
|
|
12
13
|
//# sourceMappingURL=authenticate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate.d.ts","sourceRoot":"","sources":["../../../src/auth/sessions/authenticate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,YAAY,CAAC;AAEhE,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"authenticate.d.ts","sourceRoot":"","sources":["../../../src/auth/sessions/authenticate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,YAAY,CAAC;AAEhE,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAKhF,oFAAoF;AACpF,wBAAsB,YAAY,CACjC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE;IACT,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC3B,GACC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,uBAAuB,GAAG,IAAI,CAAC,CAmF9D"}
|