@voult/core 0.3.0 → 0.3.1

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,12 @@
2
2
 
3
3
  All notable changes to `@voult/core` are documented here.
4
4
 
5
+ ## 0.3.1
6
+
7
+ - New route `POST /user/password` (`{ password }`): a user who signed up with Google or GitHub adds a password, so email + password sign-in works too. Checked against the password rule before Voult is called.
8
+ - New route `GET /user/activity?limit=20&skip=0`: the signed-in user's own audit log (sign-ins, MFA and password changes, …), newest first.
9
+ - `@voult/express` and `@voult/next` get both with a fresh install (they depend on `^0.3.0`).
10
+
5
11
  ## 0.3.0
6
12
 
7
13
  - **Breaking: error codes are the Voult API's.** A failed request now answers with the API's catalog code (`INVALID_CREDENTIALS`, `USER_EXISTS`, `WEAK_PASSWORD`, see ERRORS.md) instead of the SDK's category (`AUTHENTICATION_ERROR`, `CONFLICT_ERROR`, `VALIDATION_ERROR`). Errors raised by the router itself keep their codes (`AUTHENTICATION_ERROR` for "Authentication required", `INVALID_JSON`, `PAYLOAD_TOO_LARGE`). If you branch on `code`, switch to the catalog codes; branching on `status` is unaffected.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voult/core",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "The Voult auth router on the Fetch API (Request \u2192 Response), shared by @voult/express and @voult/next",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
package/src/routes.js CHANGED
@@ -9,6 +9,7 @@ import {
9
9
  getMfaStatus,
10
10
  regenerateMfaBackupCodes,
11
11
  revokeSession,
12
+ setPassword,
12
13
  setupMfa,
13
14
  unlinkOAuthProvider,
14
15
  refreshSession,
@@ -195,6 +196,16 @@ export const authRoutes = [
195
196
  json(await unlinkOAuthProvider(ctx.params.provider, ctx.client))
196
197
  ))],
197
198
 
199
+ // Signed up with Google/GitHub only: add a password, so email + password sign-in works too.
200
+ ['POST', '/user/password', authenticated(async (ctx) => json(await setPassword(ctx.body.password, ctx.client)))],
201
+
202
+ // The user's own activity (sign-ins, MFA and password changes, …), newest first. ?limit=&skip=
203
+ // (No SDK function for it yet, so the client calls the API path directly.)
204
+ ['GET', '/user/activity', authenticated(async (ctx) => json(await ctx.client.get('/api/audit-logs/me', {
205
+ requireAuth: true,
206
+ params: { limit: ctx.query('limit') ?? '20', skip: ctx.query('skip') ?? '0' },
207
+ })))],
208
+
198
209
  // Voult disables the account (it can be re-enabled), and this browser is signed out.
199
210
  ['DELETE', '/user/me', authenticated(async (ctx) => {
200
211
  const result = await deleteUser(ctx.client);