@happyvertical/smrt-users 0.57.17 → 0.57.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/AGENTS.md +21 -0
  2. package/README.md +134 -4
  3. package/agents/retention.md +3 -2
  4. package/dist/chunks/{PasswordCredentialService-CyB9FmYp.js → PasswordCredentialService-DezdsV_v.js} +40 -3
  5. package/dist/chunks/PasswordCredentialService-DezdsV_v.js.map +1 -0
  6. package/dist/chunks/TerminalAuthService-Dn2BIzRM.js +4012 -0
  7. package/dist/chunks/TerminalAuthService-Dn2BIzRM.js.map +1 -0
  8. package/dist/collections/PasskeyChallengeCollection.d.ts +37 -0
  9. package/dist/collections/PasskeyChallengeCollection.d.ts.map +1 -0
  10. package/dist/collections/PasskeyCredentialCollection.d.ts +66 -0
  11. package/dist/collections/PasskeyCredentialCollection.d.ts.map +1 -0
  12. package/dist/collections/SessionCollection.d.ts.map +1 -1
  13. package/dist/collections/index.d.ts +2 -0
  14. package/dist/collections/index.d.ts.map +1 -1
  15. package/dist/index.d.ts +4 -4
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +15 -6
  18. package/dist/index.js.map +1 -1
  19. package/dist/manifest.json +1302 -428
  20. package/dist/models/PasskeyChallenge.d.ts +32 -0
  21. package/dist/models/PasskeyChallenge.d.ts.map +1 -0
  22. package/dist/models/PasskeyCredential.d.ts +50 -0
  23. package/dist/models/PasskeyCredential.d.ts.map +1 -0
  24. package/dist/models/Session.d.ts +23 -0
  25. package/dist/models/Session.d.ts.map +1 -1
  26. package/dist/models/index.d.ts +2 -0
  27. package/dist/models/index.d.ts.map +1 -1
  28. package/dist/operator.js +1 -1
  29. package/dist/retention.d.ts +3 -1
  30. package/dist/retention.d.ts.map +1 -1
  31. package/dist/services/PasskeyCredentialService.d.ts +382 -0
  32. package/dist/services/PasskeyCredentialService.d.ts.map +1 -0
  33. package/dist/services/SessionService.d.ts.map +1 -1
  34. package/dist/services/index.d.ts +1 -0
  35. package/dist/services/index.d.ts.map +1 -1
  36. package/dist/smrt-knowledge.json +407 -9
  37. package/dist/svelte/auth.d.ts +9 -3
  38. package/dist/svelte/auth.d.ts.map +1 -1
  39. package/dist/svelte/index.d.ts +2 -0
  40. package/dist/svelte/index.d.ts.map +1 -1
  41. package/dist/svelte/index.js +1 -0
  42. package/dist/svelte/passkey.d.ts +58 -0
  43. package/dist/svelte/passkey.d.ts.map +1 -0
  44. package/dist/svelte/passkey.js +97 -0
  45. package/dist/sveltekit/index.d.ts +1 -0
  46. package/dist/sveltekit/index.d.ts.map +1 -1
  47. package/dist/sveltekit/passkey-handlers.d.ts +117 -0
  48. package/dist/sveltekit/passkey-handlers.d.ts.map +1 -0
  49. package/dist/sveltekit.js +259 -69
  50. package/dist/sveltekit.js.map +1 -1
  51. package/package.json +12 -10
  52. package/dist/chunks/PasswordCredentialService-CyB9FmYp.js.map +0 -1
  53. package/dist/chunks/TerminalAuthService-CCbM_G1V.js +0 -3012
  54. package/dist/chunks/TerminalAuthService-CCbM_G1V.js.map +0 -1
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Single-use ledger of CONSUMED passkey ceremony challenges (#3275).
3
+ *
4
+ * A ceremony challenge is issued statelessly (an HMAC-signed `ceremonyId`, so
5
+ * an unauthenticated "begin" request writes nothing). Single use is enforced
6
+ * here instead: when a ceremony is verified its challenge hash is inserted,
7
+ * and the unique `challengeHash` turns a replay into a conflict. Rows are
8
+ * worthless once `expiresAt` has passed (the signed ceremony itself no longer
9
+ * verifies), so the retention sweep reaps them.
10
+ *
11
+ * Only the sha256 of the challenge is stored, never the challenge.
12
+ *
13
+ * @packageDocumentation
14
+ */
15
+ import { SmrtObject } from '@happyvertical/smrt-core';
16
+ /** No configuration may keep a ceremony open longer than this (10 minutes). */
17
+ export declare const PASSKEY_CHALLENGE_TTL_CEILING_SECONDS: number;
18
+ /** What a consumed challenge was issued for. */
19
+ export type PasskeyChallengePurpose = 'authentication' | 'registration';
20
+ export declare class UsersPasskeyChallenge extends SmrtObject {
21
+ /** sha256 hex of the consumed challenge (base64url string). Unique. */
22
+ challengeHash: string;
23
+ /** `authentication` or `registration`. */
24
+ purpose: PasskeyChallengePurpose;
25
+ /**
26
+ * When the ceremony stops verifying anyway.
27
+ *
28
+ * Indexed: the retention sweep prunes by this column.
29
+ */
30
+ expiresAt: Date;
31
+ }
32
+ //# sourceMappingURL=PasskeyChallenge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PasskeyChallenge.d.ts","sourceRoot":"","sources":["../../src/models/PasskeyChallenge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAS,UAAU,EAAQ,MAAM,0BAA0B,CAAC;AAEnE,+EAA+E;AAC/E,eAAO,MAAM,qCAAqC,QAAU,CAAC;AAE7D,gDAAgD;AAChD,MAAM,MAAM,uBAAuB,GAAG,gBAAgB,GAAG,cAAc,CAAC;AAExE,qBAQa,qBAAsB,SAAQ,UAAU;IACnD,uEAAuE;IAEvE,aAAa,SAAM;IAEnB,0CAA0C;IAE1C,OAAO,EAAE,uBAAuB,CAAoB;IAEpD;;;;OAIG;IAEH,SAAS,OAAc;CACxB"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Per-person passkey (WebAuthn) credentials (#3275).
3
+ *
4
+ * Its own object rather than a column on `User`, like the password and PIN
5
+ * credentials: authentication extends without touching the identity model, the
6
+ * key material is never selected by the many existing user reads, and it is
7
+ * never serialized by accident. Unlike a password, a person may hold SEVERAL
8
+ * passkeys (a laptop, a phone, a security key), so `userId` is not unique;
9
+ * `credentialId` is, because the authenticator names the credential and the
10
+ * discoverable sign-in finds the person from it.
11
+ *
12
+ * Tenant access still comes only from an active Membership, which sign-in
13
+ * checks separately. See {@link PasskeyCredentialService}; that service and its
14
+ * SvelteKit handlers are the only read and write paths.
15
+ *
16
+ * @packageDocumentation
17
+ */
18
+ import { SmrtObject } from '@happyvertical/smrt-core';
19
+ /** Whether a credential can be synced between devices (WebAuthn `credentialDeviceType`). */
20
+ export type PasskeyDeviceType = 'singleDevice' | 'multiDevice';
21
+ /** The transport hints worth storing, in order; anything unknown is dropped. */
22
+ export declare function knownPasskeyTransports(values: readonly unknown[] | null | undefined): string[];
23
+ export declare class UsersPasskeyCredential extends SmrtObject {
24
+ /** The person this passkey signs in. A person may hold several. */
25
+ userId: string;
26
+ /** The authenticator's credential id, base64url. Unique across all people. */
27
+ credentialId: string;
28
+ /** The credential public key (COSE), base64url. */
29
+ publicKey: string;
30
+ /** The authenticator's signature counter at its last accepted assertion. */
31
+ signCount: number;
32
+ /** JSON array of transport hints; use {@link getTransports}. */
33
+ transports: string | null;
34
+ /** The name the person gave this passkey ("MacBook", "YubiKey"). */
35
+ name: string;
36
+ /** The authenticator model's AAGUID, when it reported one. */
37
+ aaguid: string | null;
38
+ /** Whether the credential is currently backed up (synced) by its provider. */
39
+ backedUp: boolean;
40
+ /** `singleDevice` or `multiDevice`, as reported at registration. */
41
+ deviceType: PasskeyDeviceType | null;
42
+ /** When this passkey last signed the person in. */
43
+ lastUsedAt: Date | null;
44
+ /** `self` (the only value today: a passkey is always registered by its owner). */
45
+ createdBy: string | null;
46
+ /** Transport hints, guarded: malformed or unknown entries are dropped. */
47
+ getTransports(): string[];
48
+ setTransports(value: readonly string[] | null | undefined): void;
49
+ }
50
+ //# sourceMappingURL=PasskeyCredential.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PasskeyCredential.d.ts","sourceRoot":"","sources":["../../src/models/PasskeyCredential.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAqB,UAAU,EAAQ,MAAM,0BAA0B,CAAC;AAE/E,4FAA4F;AAC5F,MAAM,MAAM,iBAAiB,GAAG,cAAc,GAAG,aAAa,CAAC;AAa/D,gFAAgF;AAChF,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI,GAAG,SAAS,GAC5C,MAAM,EAAE,CAKV;AAED,qBAQa,sBAAuB,SAAQ,UAAU;IACpD,mEAAmE;IAEnE,MAAM,SAAM;IAEZ,8EAA8E;IAE9E,YAAY,SAAM;IAElB,mDAAmD;IAEnD,SAAS,SAAM;IAEf,4EAA4E;IAE5E,SAAS,SAAK;IAEd,gEAAgE;IAEhE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAQ;IAEjC,oEAAoE;IAEpE,IAAI,SAAM;IAEV,8DAA8D;IAE9D,MAAM,EAAE,MAAM,GAAG,IAAI,CAAQ;IAE7B,8EAA8E;IAE9E,QAAQ,UAAS;IAEjB,oEAAoE;IAEpE,UAAU,EAAE,iBAAiB,GAAG,IAAI,CAAQ;IAE5C,mDAAmD;IAEnD,UAAU,EAAE,IAAI,GAAG,IAAI,CAAQ;IAE/B,kFAAkF;IAElF,SAAS,EAAE,MAAM,GAAG,IAAI,CAAQ;IAEhC,0EAA0E;IAC1E,aAAa,IAAI,MAAM,EAAE;IAUzB,aAAa,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI;CAIjE"}
@@ -52,6 +52,22 @@ export declare const SESSION_DATA_KEYS: {
52
52
  * `created_at`).
53
53
  */
54
54
  readonly outOfBandProofAt: "outOfBandProofAt";
55
+ /**
56
+ * ISO timestamp of the original authentication, carried forward when
57
+ * tenant-switch rotation mints a replacement row (whose own `created_at`
58
+ * is new). Written only by `SessionService.switchTenant`; never from client
59
+ * input, and `setSessionData` refuses it. Absent on a session that has not
60
+ * rotated, where `created_at` is the authentication time. See
61
+ * {@link Session.getAuthenticatedAt}.
62
+ */
63
+ readonly authenticatedAt: "authenticatedAt";
64
+ /**
65
+ * Row id of the passkey (`users_passkey_credentials`) a session was signed
66
+ * in with. Set only by `PasskeyCredentialService` at mint; it decides which
67
+ * session a passkey removal ends. Never from client input, and
68
+ * `setSessionData` refuses it.
69
+ */
70
+ readonly passkeyCredentialId: "passkeyCredentialId";
55
71
  };
56
72
  /**
57
73
  * Expiry for a session minted or extended now: `ttlSeconds` ahead, bounded by
@@ -154,6 +170,13 @@ export declare class Session extends SmrtObject {
154
170
  * the resolving service's TTL policy.
155
171
  */
156
172
  getIdleSeconds(): number | null;
173
+ /**
174
+ * When the person authenticated: `data.authenticatedAt` when present, else
175
+ * the row's `created_at`. A present but malformed or future stamp returns
176
+ * null, which callers must treat as "not fresh" (fail closed). Also null
177
+ * when there is no usable `created_at`.
178
+ */
179
+ getAuthenticatedAt(): Date | null;
157
180
  /**
158
181
  * Permission ceiling (`data.permissionCeiling`), or null when the session
159
182
  * has none. A present but malformed value fails closed as an empty ceiling.
@@ -1 +1 @@
1
- {"version":3,"file":"Session.d.ts","sourceRoot":"","sources":["../../src/models/Session.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAGL,UAAU,EACV,KAAK,iBAAiB,EAEvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,iBAAiB;IACvD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,mEAAmE;IACnE,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,cAAc,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,UAAU,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACtC,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED;;;;GAIG;AACH,MAAM,MAAM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N_EXPIRY_SECONDS, MagicLinkToken, UsersMagicLinkToken, } fr
14
14
  export { Membership } from './Membership.js';
15
15
  export { MembershipOverride } from './MembershipOverride.js';
16
16
  export { type OAuthTokenClaims, UsersOAuthAccessTokenRevocation, UsersOAuthAuthorization, UsersOAuthAuthorizationCode, UsersOAuthClient, UsersOAuthRefreshFamily, UsersOAuthRefreshGrant, } from './OAuthAuthorization.js';
17
+ export { type PasskeyChallengePurpose, UsersPasskeyChallenge, } from './PasskeyChallenge.js';
18
+ export { type PasskeyDeviceType, UsersPasskeyCredential, } from './PasskeyCredential.js';
17
19
  export { UsersPasswordCredential } from './PasswordCredential.js';
18
20
  export { isValidPermissionSlug, type ParsedPermissionSlug, Permission, parsePermissionSlug, } from './Permission.js';
19
21
  export { UsersPinCredential } from './PinCredential.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE9E,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EACL,cAAc,EACd,KAAK,oBAAoB,EACzB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,KAAK,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EACL,KAAK,iBAAiB,EACtB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,4BAA4B,EAC5B,cAAc,EACd,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,C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C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,OAAO,EACP,KAAK,iBAAiB,GACvB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,0BAA0B,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EACL,iBAAiB,EACjB,KAAK,6BAA6B,EAClC,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,GAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC"}
package/dist/operator.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Dt as normalizeUsername, Et as normalizeEmail, L as UserCollection, P as verifySecretHash, Tt as isValidEmail, U as TenantCollection, _ as PermissionResolver, ct as UsersPasswordCredentialCollection, f as PasswordCredentialService, ft as MembershipCollection, ot as RoleCollection } from "./chunks/PasswordCredentialService-CyB9FmYp.js";
1
+ import { Dt as normalizeUsername, Et as normalizeEmail, L as UserCollection, P as verifySecretHash, Tt as isValidEmail, U as TenantCollection, _ as PermissionResolver, ct as UsersPasswordCredentialCollection, f as PasswordCredentialService, ft as MembershipCollection, ot as RoleCollection } from "./chunks/PasswordCredentialService-DezdsV_v.js";
2
2
  import { a as MembershipStatus, l as TenantStatus, u as UserStatus } from "./chunks/types-DFqeph0R.js";
3
3
  import { isPostgresDatabase, withEmbeddedWriteTransaction } from "@happyvertical/smrt-core";
4
4
  import { withSystemContext } from "@happyvertical/smrt-tenancy";
@@ -34,10 +34,12 @@ export declare const LOGIN_ATTEMPTS_RETENTION_TASK = "users-login-attempts";
34
34
  export declare const LOGIN_AUDIT_RETENTION_TASK = "users-login-audit-events";
35
35
  /** How long login audit events are kept by default. */
36
36
  export declare const DEFAULT_LOGIN_AUDIT_RETENTION_DAYS = 90;
37
+ /** Retention task name for consumed passkey ceremony challenges (#3275). */
38
+ export declare const PASSKEY_CHALLENGES_RETENTION_TASK = "users-passkey-challenges";
37
39
  /** Retention task for OAuth codes, refresh history/families and revocations. */
38
40
  export declare const OAUTH_CREDENTIALS_RETENTION_TASK = "users-oauth-credentials";
39
41
  /** Every task name {@link registerUserRetentionTasks} installs. */
40
- export declare const USER_RETENTION_TASKS: readonly ["users-oauth-credentials", "users-sessions", "users-magic-link-tokens", "users-cli-auth-requests", "users-login-attempts", "users-login-audit-events"];
42
+ export declare const USER_RETENTION_TASKS: readonly ["users-oauth-credentials", "users-sessions", "users-magic-link-tokens", "users-cli-auth-requests", "users-login-attempts", "users-login-audit-events", "users-passkey-challenges"];
41
43
  /**
42
44
  * Register session and token expiry with the framework retention sweep.
43
45
  *
@@ -1 +1 @@
1
- {"version":3,"file":"retention.d.ts","sourceRoot":"","sources":["../src/retention.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAaH,4DAA4D;AAC5D,eAAO,MAAM,uBAAuB,mBAAmB,CAAC;AAExD,yDAAyD;AACzD,eAAO,MAAM,yBAAyB,4BAA4B,CAAC;AAEnE,gEAAgE;AAChE,eAAO,MAAM,uBAAuB,4BAA4B,CAAC;AAEjE,uEAAuE;AACvE,eAAO,MAAM,6BAA6B,yBAAyB,CAAC;AAEpE,0DAA0D;AAC1D,eAAO,MAAM,0BAA0B,6BAA6B,CAAC;AAErE,uDAAuD;AACvD,eAAO,MAAM,kCAAkC,KAAK,CAAC;AAErD,gFAAgF;AAChF,eAAO,MAAM,gCAAgC,4BAA4B,CAAC;AAE1E,mEAAmE;AACnE,eAAO,MAAM,oBAAoB,kKAOvB,CAAC;AAEX;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CA0DjD;AAED,sEAAsE;AACtE,wBAAgB,4BAA4B,IAAI,IAAI,CAInD"}
1
+ {"version":3,"file":"retention.d.ts","sourceRoot":"","sources":["../src/retention.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAcH,4DAA4D;AAC5D,eAAO,MAAM,uBAAuB,mBAAmB,CAAC;AAExD,yDAAyD;AACzD,eAAO,MAAM,yBAAyB,4BAA4B,CAAC;AAEnE,gEAAgE;AAChE,eAAO,MAAM,uBAAuB,4BAA4B,CAAC;AAEjE,uEAAuE;AACvE,eAAO,MAAM,6BAA6B,yBAAyB,CAAC;AAEpE,0DAA0D;AAC1D,eAAO,MAAM,0BAA0B,6BAA6B,CAAC;AAErE,uDAAuD;AACvD,eAAO,MAAM,kCAAkC,KAAK,CAAC;AAErD,4EAA4E;AAC5E,eAAO,MAAM,iCAAiC,6BAA6B,CAAC;AAE5E,gFAAgF;AAChF,eAAO,MAAM,gCAAgC,4BAA4B,CAAC;AAE1E,mEAAmE;AACnE,eAAO,MAAM,oBAAoB,8LAQvB,CAAC;AAEX;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CAqEjD;AAED,sEAAsE;AACtE,wBAAgB,4BAA4B,IAAI,IAAI,CAInD"}
@@ -0,0 +1,382 @@
1
+ /**
2
+ * PasskeyCredentialService — passkey (WebAuthn) sign-in for an existing,
3
+ * active user, and the lifecycle of the person's passkeys (#3275).
4
+ *
5
+ * All WebAuthn parsing and verification is `@simplewebauthn/server`; this
6
+ * module owns the ceremony state, the sign-in order, and the authority rules.
7
+ *
8
+ * ## Ceremonies
9
+ *
10
+ * `beginAuthentication` / `beginRegistration` return an opaque `ceremonyId`:
11
+ * `base64url(payload) + '.' + base64url(HMAC-SHA256(secret, payload))`, where
12
+ * the payload carries the purpose, the random 32-byte challenge, an expiry
13
+ * and, for registration, the person and the SHA-256 of the actor's session id
14
+ * (never the raw id). Issuing writes nothing, so an unauthenticated "begin"
15
+ * request costs no storage. Single use is enforced when a ceremony is
16
+ * finished: its challenge hash is inserted into the unique
17
+ * {@link UsersPasskeyChallenge} ledger, and a conflict is a replay. Set
18
+ * `challengeSecret` (at least 32 characters) in any deployment with more than
19
+ * one process, or a ceremony begun on one will not verify on another.
20
+ *
21
+ * ## Sign-in (discoverable / usernameless)
22
+ *
23
+ * 1. Take the submitted credential id (what the client sent, never a resolved
24
+ * user) and RESERVE a login attempt on it, source = the client address.
25
+ * 2. Verify and consume the ceremony; load the credential; verify the
26
+ * assertion (origin, RP id, user verification REQUIRED); check the
27
+ * user handle, the signature counter, that the user is ACTIVE and, when a
28
+ * tenant is given, holds an ACTIVE membership in it. Never create a user.
29
+ * 3. Mint a first-class session (`authMethod: 'passkey'`) through
30
+ * `SessionService.createSession`, then re-check the credential with one
31
+ * guarded UPDATE of the counter (a passkey removed meanwhile, or a
32
+ * concurrent assertion, makes it a no-op and the session is destroyed).
33
+ *
34
+ * Every refusal other than a rate limit is one {@link PasskeyCredentialError}
35
+ * ("Invalid credentials."); a rate limit is {@link LoginRateLimitError}.
36
+ *
37
+ * ## Management and authority
38
+ *
39
+ * Registering a passkey, or a person removing their own, needs a session
40
+ * minted within `freshSessionSeconds` (decided on the STORED session row): a
41
+ * stolen long-lived session cannot enrol an attacker's authenticator. A
42
+ * layered (device PIN) session never manages passkeys, and an administrator
43
+ * may only manage people whose every active membership is in the
44
+ * administrator's session tenant — passkeys, like the password, are one set
45
+ * per person across tenants.
46
+ *
47
+ * @packageDocumentation
48
+ */
49
+ import type { SmrtClassOptions } from '@happyvertical/smrt-core';
50
+ import type { PublicKeyCredentialCreationOptionsJSON, PublicKeyCredentialRequestOptionsJSON } from '@simplewebauthn/server';
51
+ import { PASSKEY_CHALLENGE_TTL_CEILING_SECONDS } from '../models/PasskeyChallenge.js';
52
+ import { type SessionAuthMethod } from '../models/Session.js';
53
+ import { InvalidCredentialsError, LoginAttemptLimiter, type LoginAttemptLimiterOptions } from './LoginAttemptLimiter.js';
54
+ import { type PermissionDefinition } from './PermissionCatalogService.js';
55
+ import { type SessionContext } from './SessionService.js';
56
+ /** Login-limiter kind and session `authMethod` for passkey sign-ins. */
57
+ export declare const PASSKEY_LOGIN_KIND = "passkey";
58
+ /** Default permission required to list or remove another person's passkeys. */
59
+ export declare const DEFAULT_PASSKEY_MANAGE_PERMISSION = "users.passkey.manage";
60
+ /**
61
+ * Server-set `Session.data` key naming the passkey row a session was signed
62
+ * in with. Never write it from client input.
63
+ */
64
+ export declare const PASSKEY_SESSION_DATA_KEY: "passkeyCredentialId";
65
+ /** Default lifetime of a ceremony (5 minutes). */
66
+ export declare const DEFAULT_PASSKEY_CHALLENGE_TTL_SECONDS: number;
67
+ export { PASSKEY_CHALLENGE_TTL_CEILING_SECONDS };
68
+ /** Default age a session may have when it registers or removes a passkey (15 minutes). */
69
+ export declare const DEFAULT_PASSKEY_FRESH_SESSION_SECONDS: number;
70
+ /** Smallest accepted `freshSessionSeconds`. */
71
+ export declare const PASSKEY_FRESH_SESSION_FLOOR_SECONDS = 60;
72
+ /** Largest accepted `freshSessionSeconds` (1 hour). */
73
+ export declare const PASSKEY_FRESH_SESSION_CEILING_SECONDS: number;
74
+ /** Sign-in methods that count as a fresh authentication by default. */
75
+ export declare const DEFAULT_PASSKEY_FRESH_AUTH_METHODS: readonly SessionAuthMethod[];
76
+ /** Default passkeys per person. */
77
+ export declare const DEFAULT_MAX_PASSKEYS_PER_USER = 10;
78
+ /** No configuration may allow more passkeys per person than this. */
79
+ export declare const PASSKEY_MAX_PER_USER_CEILING = 100;
80
+ /** Longest passkey name, in code points. */
81
+ export declare const PASSKEY_NAME_MAX_LENGTH = 64;
82
+ /** Name given to a passkey registered without one. */
83
+ export declare const DEFAULT_PASSKEY_NAME = "Passkey";
84
+ /** Catalog definition for {@link DEFAULT_PASSKEY_MANAGE_PERMISSION}. */
85
+ export declare const PASSKEY_PERMISSION_DEFINITIONS: PermissionDefinition[];
86
+ /** Register the passkey management permission once when the service is used. */
87
+ export declare function ensurePasskeyPermissionsRegistered(): void;
88
+ /**
89
+ * Every sign-in refusal that is not a rate limit: unknown credential, bad or
90
+ * replayed or expired ceremony, failed verification, counter regression,
91
+ * inactive user, no membership. One message, so responses cannot enumerate
92
+ * accounts.
93
+ */
94
+ export declare class PasskeyCredentialError extends InvalidCredentialsError {
95
+ constructor(message?: string);
96
+ }
97
+ /** Thrown by the management calls when the actor may not manage the passkey. */
98
+ export declare class PasskeyCredentialForbiddenError extends Error {
99
+ constructor(message?: string);
100
+ }
101
+ /**
102
+ * Thrown when a management call needs a session minted recently and the
103
+ * actor's is older: the person must sign in again, then retry.
104
+ */
105
+ export declare class PasskeyReauthenticationRequiredError extends Error {
106
+ constructor(message?: string);
107
+ }
108
+ /**
109
+ * Thrown by register and rename for a refusal whose message is safe to show
110
+ * the person: a bad name, the passkey limit, an authenticator that is already
111
+ * registered, or a registration that did not verify.
112
+ */
113
+ export declare class PasskeyRegistrationError extends Error {
114
+ constructor(message: string);
115
+ }
116
+ /** Where passkeys are valid: the origin(s) and relying party identity. */
117
+ export interface PasskeyRelyingPartyOptions {
118
+ /**
119
+ * Every origin a ceremony may run on: an absolute `https:` URL with no path
120
+ * (or `http:` for localhost, 127.0.0.1 and [::1] only).
121
+ */
122
+ origin: string | readonly string[];
123
+ /**
124
+ * The RP id passkeys are scoped to. Defaults to the hostname of the first
125
+ * origin; must be that hostname, or a parent domain of EVERY origin's. It
126
+ * cannot be changed later without orphaning every registered passkey.
127
+ */
128
+ rpId?: string;
129
+ /** Name the authenticator shows the person. */
130
+ rpName: string;
131
+ }
132
+ export interface PasskeyCredentialServiceOptions extends SmrtClassOptions {
133
+ /** Required: passkeys are bound to the relying party. */
134
+ relyingParty: PasskeyRelyingPartyOptions;
135
+ /** Lifetime of a passkey session in seconds. Default seven days. */
136
+ sessionTtl?: number;
137
+ /**
138
+ * Shared {@link LoginAttemptLimiter}. When omitted one is created from
139
+ * `limiter` (or defaults). Supplying the host's instance keeps password,
140
+ * passkey and PIN budgets in one table with one audit sink.
141
+ */
142
+ loginLimiter?: LoginAttemptLimiter;
143
+ /** Options for the private limiter when `loginLimiter` is not supplied. */
144
+ limiter?: Omit<LoginAttemptLimiterOptions, keyof SmrtClassOptions>;
145
+ /** Permission slug an administrator needs to manage others' passkeys. */
146
+ managePermission?: string;
147
+ /**
148
+ * Secret that signs ceremony ids (at least 32 characters). When omitted a
149
+ * random per-instance secret is used, which only works while the process
150
+ * that began a ceremony is the one that finishes it: set it for any
151
+ * multi-process deployment.
152
+ */
153
+ challengeSecret?: string;
154
+ /** Seconds a ceremony stays valid, 1 to 600. Default 300. */
155
+ challengeTtlSeconds?: number;
156
+ /**
157
+ * How recently the session must have been minted to register a passkey or
158
+ * remove one's own, 60 to 3600 seconds. Default 900.
159
+ */
160
+ freshSessionSeconds?: number;
161
+ /**
162
+ * Session `authMethod`s whose sign-in counts as a fresh authentication for
163
+ * registering or removing one's own passkey. Read from the STORED session
164
+ * row; a null or unlisted method is never fresh. Default
165
+ * {@link DEFAULT_PASSKEY_FRESH_AUTH_METHODS}. `terminal` and `pin` are
166
+ * refused at construction: a terminal approval lets any session (even a
167
+ * stolen stale one) mint a brand new first-class `terminal` session, and a
168
+ * PIN session is layered.
169
+ */
170
+ freshAuthMethods?: readonly SessionAuthMethod[];
171
+ /** Passkeys one person may hold, 1 to 100. Default 10. */
172
+ maxPasskeysPerUser?: number;
173
+ }
174
+ export interface PasskeyAuthenticationBegin {
175
+ /** Opaque, signed ceremony state: send it back with the assertion. */
176
+ ceremonyId: string;
177
+ options: PublicKeyCredentialRequestOptionsJSON;
178
+ }
179
+ export interface PasskeyRegistrationBegin {
180
+ ceremonyId: string;
181
+ options: PublicKeyCredentialCreationOptionsJSON;
182
+ }
183
+ export interface PasskeySignInInput {
184
+ ceremonyId: string;
185
+ /** The `AuthenticationResponseJSON` the browser produced; validated here. */
186
+ response: unknown;
187
+ /**
188
+ * Tenant to sign into. When set, the person must hold an ACTIVE membership
189
+ * in it; when null/omitted the session carries no tenant context (and so
190
+ * no tenant permissions) until `switchSessionTenant`.
191
+ */
192
+ tenantId?: string | null | 'unique-active-membership';
193
+ ipAddress?: string;
194
+ userAgent?: string;
195
+ /**
196
+ * The session id the client presented before signing in (its old cookie),
197
+ * if any. Revoked after a successful sign-in (session fixation).
198
+ */
199
+ replaceSessionId?: string | null;
200
+ }
201
+ export interface PasskeySignInResult {
202
+ /** The new session id: the cookie value. Never send it to client script. */
203
+ sessionId: string;
204
+ userId: string;
205
+ tenantId: string | null;
206
+ authMethod: SessionAuthMethod;
207
+ expiresAt: string;
208
+ }
209
+ /** A passkey as shown to its owner or an administrator. No key material, no credential id. */
210
+ export interface PasskeySummary {
211
+ id: string;
212
+ name: string;
213
+ createdAt: string | null;
214
+ lastUsedAt: string | null;
215
+ backedUp: boolean;
216
+ deviceType: 'singleDevice' | 'multiDevice' | null;
217
+ transports: string[];
218
+ }
219
+ export interface BeginPasskeyRegistrationInput {
220
+ /** Resolved session of the person registering. */
221
+ actor: SessionContext;
222
+ }
223
+ export interface FinishPasskeyRegistrationInput {
224
+ actor: SessionContext;
225
+ ceremonyId: string;
226
+ /** The `RegistrationResponseJSON` the browser produced; validated here. */
227
+ response: unknown;
228
+ /** Shown name; trimmed, at most 64 characters, defaults to "Passkey". */
229
+ name?: string;
230
+ ipAddress?: string;
231
+ }
232
+ export interface ListPasskeysInput {
233
+ actor: SessionContext;
234
+ /** Another person's passkeys (administrators); omitted for the actor's own. */
235
+ userId?: string;
236
+ }
237
+ export interface RenamePasskeyInput {
238
+ actor: SessionContext;
239
+ passkeyId: string;
240
+ name: string;
241
+ ipAddress?: string;
242
+ }
243
+ export interface RemovePasskeyInput {
244
+ actor: SessionContext;
245
+ passkeyId: string;
246
+ ipAddress?: string;
247
+ }
248
+ export interface RemoveAllPasskeysInput {
249
+ actor: SessionContext;
250
+ userId: string;
251
+ ipAddress?: string;
252
+ }
253
+ export declare class PasskeyCredentialService {
254
+ private readonly options;
255
+ private readonly sessionTtl;
256
+ private readonly managePermission;
257
+ private readonly origins;
258
+ private readonly rpId;
259
+ private readonly rpName;
260
+ private readonly challengeSecret;
261
+ private readonly challengeTtlMs;
262
+ private readonly freshSessionMs;
263
+ private readonly maxPasskeys;
264
+ private readonly freshAuthMethods;
265
+ private sessionService;
266
+ private sessionRows;
267
+ private memberships;
268
+ private users;
269
+ private credentials;
270
+ private challenges;
271
+ private limiter;
272
+ constructor(options: PasskeyCredentialServiceOptions);
273
+ static create(options: PasskeyCredentialServiceOptions): Promise<PasskeyCredentialService>;
274
+ initialize(): Promise<void>;
275
+ /** The limiter in use (shared or private). */
276
+ get loginLimiter(): LoginAttemptLimiter;
277
+ /**
278
+ * Start a usernameless sign-in: the options to hand to the browser's
279
+ * `navigator.credentials.get`. Writes nothing and says nothing about any
280
+ * account (`allowCredentials` is empty: the authenticator offers its own).
281
+ */
282
+ beginAuthentication(): Promise<PasskeyAuthenticationBegin>;
283
+ /**
284
+ * Verify a passkey assertion and mint a session. Throws
285
+ * {@link PasskeyCredentialError} for every refusal that is not a rate limit
286
+ * and {@link LoginRateLimitError} when the budget is exhausted.
287
+ */
288
+ finishAuthentication(input: PasskeySignInInput): Promise<PasskeySignInResult>;
289
+ /**
290
+ * Start registering a passkey for the actor: the options to hand to
291
+ * `navigator.credentials.create`. The actor's session must be fresh, first
292
+ * class, and without a permission ceiling.
293
+ */
294
+ beginRegistration(input: BeginPasskeyRegistrationInput): Promise<PasskeyRegistrationBegin>;
295
+ /**
296
+ * Verify a registration and store the passkey. Same guards as
297
+ * {@link beginRegistration}, and the ceremony must have been begun by this
298
+ * actor's own session.
299
+ */
300
+ finishRegistration(input: FinishPasskeyRegistrationInput): Promise<{
301
+ passkey: PasskeySummary;
302
+ }>;
303
+ /**
304
+ * The person's passkeys, oldest first: their own, or — for an
305
+ * administrator holding `managePermission` under the single-tenant target
306
+ * rule — someone else's. Never key material or credential ids.
307
+ */
308
+ listPasskeys(input: ListPasskeysInput): Promise<PasskeySummary[]>;
309
+ /** The person renames one of their own passkeys. */
310
+ renamePasskey(input: RenamePasskeyInput): Promise<{
311
+ passkey: PasskeySummary;
312
+ }>;
313
+ /**
314
+ * Remove one passkey: the person's own (from a fresh session) or, for an
315
+ * administrator under the single-tenant target rule, anyone's. Sessions
316
+ * end before AND after the delete, so a failure between the two leaves the
317
+ * person signed out, never signed in on a passkey that is gone: for an
318
+ * administrator every passkey session of the person; for the person every
319
+ * one except the current session — unless the current session was signed in
320
+ * with the removed passkey, which then ends too.
321
+ */
322
+ removePasskey(input: RemovePasskeyInput): Promise<{
323
+ revokedSessions: number;
324
+ endedCurrentSession: boolean;
325
+ }>;
326
+ /**
327
+ * Administrative recovery for a person who lost every authenticator: delete
328
+ * all their passkeys and end every passkey session of theirs. Holding
329
+ * `managePermission` under the single-tenant target rule; never on oneself.
330
+ * The person then signs in with another credential and registers anew.
331
+ */
332
+ removeAllPasskeys(input: RemoveAllPasskeysInput): Promise<{
333
+ removed: number;
334
+ revokedSessions: number;
335
+ }>;
336
+ /** Whether the person has a passkey (for admin UIs; never for sign-in responses). */
337
+ hasPasskeys(userId: string): Promise<boolean>;
338
+ private sign;
339
+ private issueCeremony;
340
+ /**
341
+ * Check a ceremony id: bounded, well formed, correctly signed (constant
342
+ * time), for `purpose`, and unexpired. Throws {@link CeremonyRejectedError}.
343
+ */
344
+ private readCeremony;
345
+ /**
346
+ * {@link readCeremony}, then consume it: of any number of uses of one
347
+ * ceremony exactly one gets past the unique challenge hash.
348
+ */
349
+ private consumeCeremony;
350
+ /**
351
+ * Select a tenant only when a passkey-authenticated person has exactly one
352
+ * active direct membership; resolved after the assertion verifies, so
353
+ * ambiguity cannot turn a successful sign-in into an unscoped session.
354
+ */
355
+ private resolveUniqueActiveMembershipTenant;
356
+ private assertNotLayered;
357
+ /**
358
+ * The actor's own STORED session row, never the caller-built context: it
359
+ * must exist and still be valid, belong to the actor, not be layered, and
360
+ * carry no permission ceiling — a restricted session, such as a
361
+ * must-change password session, cannot manage an authenticator.
362
+ */
363
+ private assertOwnSession;
364
+ /**
365
+ * The actor may enrol or remove their own passkey only from an
366
+ * {@link assertOwnSession} session that was authenticated within
367
+ * `freshSessionSeconds` by an interactive method in `freshAuthMethods`.
368
+ * The method is read from the stored row: a `terminal` approval can mint a
369
+ * brand new first-class session for anyone holding any session, so its
370
+ * `created_at` proves nothing about the person.
371
+ */
372
+ private assertFreshManager;
373
+ private assertCanManage;
374
+ private requireOwned;
375
+ /** Trim and bound a passkey name; throws {@link PasskeyRegistrationError}. */
376
+ private normalizeName;
377
+ private limitReached;
378
+ private registrationFailed;
379
+ private summarize;
380
+ private recordManagement;
381
+ }
382
+ //# sourceMappingURL=PasskeyCredentialService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PasskeyCredentialService.d.ts","sourceRoot":"","sources":["../../src/services/PasskeyCredentialService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AASH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,OAAO,KAAK,EAEV,sCAAsC,EACtC,qCAAqC,EAEtC,MAAM,wBAAwB,CAAC;AAMhC,OAAO,EACL,qCAAqC,EAEtC,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,KAAK,0BAA0B,EAEhC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,KAAK,cAAc,EAAkB,MAAM,qBAAqB,CAAC;AAoB1E,wEAAwE;AACxE,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAC5C,+EAA+E;AAC/E,eAAO,MAAM,iCAAiC,yBAAyB,CAAC;AACxE;;;GAGG;AACH,eAAO,MAAM,wBAAwB,uBAAwC,CAAC;AAC9E,kDAAkD;AAClD,eAAO,MAAM,qCAAqC,QAAS,CAAC;AAC5D,OAAO,EAAE,qCAAqC,EAAE,C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SmrtOAuthAuthorizationServiceOption
12
12
  export { SMRT_OAUTH_GRANT_CLAIM, SmrtOAuthAuthorizationStorage, type SmrtOAuthAuthorizationStorageOptions, } from './OAuthAuthorizationStorage.js';
13
13
  export { type CreateAuthorizationUrlOptions, decodeOidcTransaction, encodeOidcTransaction, getUsersOidcConfig, type OidcCallbackResult, OidcLoginError, type OidcLoginResult, OidcLoginService, type OidcLoginServiceOptions, type OidcProviderConfig, type OidcProviderKind, type OidcProviderMetadata, type OidcProviderResolution, type OidcProviderResolutionOptions, type OidcTokenEndpointAuthMethod, type OidcTokenSet, type OidcTransaction, type ResolvedOidcProviderConfig, resolveOidcProviderConfig, type UsersOidcConfig, } from './OidcLoginService.js';
14
14
  export { assertOperationPermission, checkOperationPermission, hasOperationPermission, type OperationPermissionAllowReason, type OperationPermissionDecision, type OperationPermissionDenyReason, OperationPermissionError, type OperationPermissionOptions, } from './OperationPermissionService.js';
15
+ export { type BeginPasskeyRegistrationInput, DEFAULT_MAX_PASSKEYS_PER_USER, DEFAULT_PASSKEY_CHALLENGE_TTL_SECONDS, DEFAULT_PASSKEY_FRESH_AUTH_METHODS, DEFAULT_PASSKEY_FRESH_SESSION_SECONDS, DEFAULT_PASSKEY_MANAGE_PERMISSION, DEFAULT_PASSKEY_NAME, ensurePasskeyPermissionsRegistered, type FinishPasskeyRegistrationInput, type ListPasskeysInput, PASSKEY_CHALLENGE_TTL_CEILING_SECONDS, PASSKEY_FRESH_SESSION_CEILING_SECONDS, PASSKEY_FRESH_SESSION_FLOOR_SECONDS, PASSKEY_LOGIN_KIND, PASSKEY_MAX_PER_USER_CEILING, PASSKEY_NAME_MAX_LENGTH, PASSKEY_PERMISSION_DEFINITIONS, PASSKEY_SESSION_DATA_KEY, type PasskeyAuthenticationBegin, PasskeyCredentialError, PasskeyCredentialForbiddenError, PasskeyCredentialService, type PasskeyCredentialServiceOptions, PasskeyReauthenticationRequiredError, type PasskeyRegistrationBegin, PasskeyRegistrationError, type PasskeyRelyingPartyOptions, type PasskeySignInInput, type PasskeySignInResult, type PasskeySummary, type RemoveAllPasskeysInput, type RemovePasskeyInput, type RenamePasskeyInput, } from './PasskeyCredentialService.js';
15
16
  export { type ChangePasswordInput, type ClearPasswordInput, DEFAULT_PASSWORD_DENYLIST, DEFAULT_PASSWORD_MANAGE_PERMISSION, DEFAULT_PASSWORD_MAX_LENGTH, DEFAULT_PASSWORD_MIN_LENGTH, DEFAULT_PASSWORD_RECOVERY_MAX_AGE_SECONDS, ensurePasswordPermissionsRegistered, outOfBandProofSessionData, PASSWORD_LOGIN_KIND, PASSWORD_MAX_LENGTH_CEILING, PASSWORD_PERMISSION_DEFINITIONS, PASSWORD_RECOVERY_MAX_AGE_CEILING_SECONDS, PasswordCredentialError, PasswordCredentialForbiddenError, PasswordCredentialService, type PasswordCredentialServiceOptions, type PasswordPolicyContext, PasswordPolicyError, type PasswordPolicyOptions, type PasswordRecoveryOptions, type PasswordRecoveryProofContext, type PasswordSignInInput, type PasswordSignInResult, type ReplaceForgottenPasswordInput, type ResetPasswordInput, type SetPasswordInput, } from './PasswordCredentialService.js';
16
17
  export { deriveOperationPermissionCollectionName, deriveOperationPermissionSlug, normalizeOperationPermissionAction, type OperationPermissionCollectionInput, type PermissionCatalog, PermissionCatalogService, type PermissionCatalogSource, type PermissionCatalogSyncResult, type PermissionDefinition, type PostgresPermissionAction, type PostgresPermissionBinding, registerPermissionDefinitions, syncPermissionCatalog, type UsersConfig, } from './PermissionCatalogService.js';
17
18
  export { type PermissionResolutionOptions, type PermissionResolutionResult, PermissionResolver, type PermissionResolverOptions, type TenantPermissionInheritanceResult, } from './PermissionResolver.js';