@jskit-ai/auth-provider-local-db-core 0.1.183 → 0.1.185

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/CHANGELOG.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ - A new account keeps the `emailVerifiedAt` it is created with (`users.create`), as local sign-in's email confirmation now gives it; without one it stays empty, as before.
5
6
  - Used one-time passes in the database: the table `auth_local_used_passes` (the hash of each pass's id, until it expires), created by the new migration `auth_local_db_used_passes`, behind the backend contract's `passes` collection, so a pass one server accepted is refused by every server on the database. Two first uses at once both find no row, and the later one's duplicate entry runs its transaction again, which finds it. `LOCAL_AUTH_DB_TABLES.passes` names the table, which the package owns.
6
7
  - The package manifest no longer requires `runtime.actions`: its feature declares no actions, so since the kernel's 9646ecf21 it does not require the action catalogue, and the catalog's manifest check reported the requirement as one no server provider has.
7
8
  - Second factors in the database: the table `auth_local_second_factors` (one row per account, deleted with it) and the sessions' `second_factor_at` column, created by the new migration `auth_local_db_users_second_factors`, behind the backend contract's `secondFactors` collection and `sessions.markSecondFactorProved` / `sessions.clearSecondFactorForUser`. `LOCAL_AUTH_DB_TABLES.secondFactors` names the table, which the package owns.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jskit-ai/auth-provider-local-db-core",
3
- "version": "0.1.183",
3
+ "version": "0.1.185",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "test": "jskit test"
@@ -11,14 +11,14 @@
11
11
  "./server/types": "./src/server/types.js"
12
12
  },
13
13
  "dependencies": {
14
- "@jskit-ai/auth-provider-local-core": "0.2.34",
14
+ "@jskit-ai/auth-provider-local-core": "0.2.35",
15
15
  "@jskit-ai/resource-core": "0.1.217"
16
16
  },
17
17
  "peerDependencies": {
18
18
  "@jskit-ai/auth-core": "0.2.29",
19
19
  "@jskit-ai/database-runtime": "0.1.275",
20
20
  "@jskit-ai/kernel": "0.2.26",
21
- "@jskit-ai/resource-runtime": "0.2.33"
21
+ "@jskit-ai/resource-runtime": "0.2.34"
22
22
  },
23
23
  "description": "Database-backed local auth storage backend for JSKIT local auth.",
24
24
  "jskit": {
@@ -181,7 +181,9 @@ function userRecord(input = {}) {
181
181
  ...writePassword(input.password),
182
182
  disabled: input.disabled === true,
183
183
  createdAt,
184
- updatedAt: requiredDateTime(input.updatedAt, createdAt)
184
+ updatedAt: requiredDateTime(input.updatedAt, createdAt),
185
+ // An account made by a confirmation link has its email confirmed then.
186
+ emailVerifiedAt: optionalDateTime(input.emailVerifiedAt)
185
187
  };
186
188
  }
187
189
 
@@ -14,8 +14,12 @@ test("registration waits for its email to be confirmed, with a hashed, single-us
14
14
 
15
15
  // "" leaves AUTH_LOCAL_EMAIL_CONFIRMATION unset: confirmation on, its default.
16
16
  const service = createLocalAuthService({ ...localServiceOptions({ env: { AUTH_LOCAL_EMAIL_CONFIRMATION: "" } }), backend });
17
- await exerciseEmailConfirmation(t, service, async () =>
18
- JSON.stringify(await knex(LOCAL_AUTH_DB_TABLES.registrations).select()));
17
+ await exerciseEmailConfirmation(
18
+ t,
19
+ service,
20
+ async () => JSON.stringify(await knex(LOCAL_AUTH_DB_TABLES.registrations).select()),
21
+ (email) => backend.withTransaction((tx) => tx.users.findByEmail(email))
22
+ );
19
23
  });
20
24
 
21
25
  test("registering an email before or after its owner never gives its account someone else's password (database backend)", async (t) => {