@jskit-ai/auth-web 0.2.43 → 0.2.44

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
+ - Its tests name `APP_ENV`, which the auth providers now read in place of `NODE_ENV`; the setup-code field is asked for by a staging or production server.
5
6
  - `POST /api/login/pass` reads its settings with `resolvePassSignInFromEnv` from `@jskit-ai/auth-pass/server`, a new dependency, instead of auth-core's removed `./server/passSignIn`. The route behaves as before.
6
7
 
7
8
  - `POST /api/login/pass`, registered only while `AUTH_PASS_PUBLIC_KEY` is set: an issuer's page posts a one-time pass as the form field `pass`, and a pass that signs in sets the session cookies and answers 303 to `/`; a refused one answers 303 to `/auth/login` with `error=sign_in_unavailable`, `error_description` and `error_code`, which the sign-in page shows. It takes form bodies in a Fastify scope of its own, registered at boot, so the feature now requires `runtime.fastify`; it is public, takes no CSRF token (the pass authenticates it) and answers `Cache-Control: no-store`. Its rate limit is `config.auth.rateLimits.passSignIn` (20 a minute per address); one that no route limiter would enforce stops startup.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jskit-ai/auth-web",
3
- "version": "0.2.43",
3
+ "version": "0.2.44",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "test": "jskit test"
@@ -28,14 +28,14 @@
28
28
  "./locales/en.json": "./locales/en.json"
29
29
  },
30
30
  "dependencies": {
31
- "@jskit-ai/auth-pass": "0.1.0",
31
+ "@jskit-ai/auth-pass": "0.1.1",
32
32
  "uqr": "0.1.3"
33
33
  },
34
34
  "peerDependencies": {
35
- "@jskit-ai/auth-core": "0.2.29",
36
- "@jskit-ai/http-runtime": "0.2.26",
37
- "@jskit-ai/kernel": "0.2.26",
38
- "@jskit-ai/shell-web": "0.2.37",
35
+ "@jskit-ai/auth-core": "0.2.30",
36
+ "@jskit-ai/http-runtime": "0.2.27",
37
+ "@jskit-ai/kernel": "0.2.27",
38
+ "@jskit-ai/shell-web": "0.2.38",
39
39
  "@tanstack/vue-query": "^5.90.5",
40
40
  "pinia": "^4.0.3",
41
41
  "vue": "^3.5.44",
@@ -45,7 +45,7 @@ export function useLoginViewState({ placementContext }) {
45
45
  const password = ref("");
46
46
  const confirmPassword = ref("");
47
47
  const otpCode = ref("");
48
- // The first account's setup code, asked for while a production server has no account.
48
+ // The first account's setup code, asked for while a staging or production server has no account.
49
49
  const setupCode = ref("");
50
50
  const showPassword = ref(false);
51
51
  const showConfirmPassword = ref(false);
@@ -33,7 +33,7 @@ async function startAuthWeb(t, config = {}) {
33
33
  inputs: {
34
34
  "auth.service": createRefusingAuthService(),
35
35
  "runtime.config": config,
36
- "runtime.env": { NODE_ENV: "test" },
36
+ "runtime.env": { APP_ENV: "test" },
37
37
  "runtime.fastify": app,
38
38
  "runtime.logger": silentLogger
39
39
  },
@@ -77,6 +77,7 @@ test("managed preview identity signs out before selecting an existing applicatio
77
77
  }, {
78
78
  ...HOST_OPTIONS,
79
79
  env: {
80
+ APP_ENV: "development",
80
81
  AUTH_DEV_BYPASS_ENABLED: "true",
81
82
  AUTH_DEV_BYPASS_SECRET: SECRET
82
83
  },
@@ -114,7 +115,7 @@ test("managed preview identity rejects a disabled or non-local exchange", async
114
115
  protocol: HOST_PROTOCOL,
115
116
  requestId: "request-2",
116
117
  target: { origin: "http://localhost:3000" }
117
- }, { ...HOST_OPTIONS, env: {}, fetchImpl: async () => assert.fail("fetch must not run") });
118
+ }, { ...HOST_OPTIONS, env: { APP_ENV: "development" }, fetchImpl: async () => assert.fail("fetch must not run") });
118
119
  assert.equal(disabled.ok, false);
119
120
  assert.equal(disabled.code, "jskit_managed_preview_identity_disabled");
120
121
 
@@ -126,6 +127,7 @@ test("managed preview identity rejects a disabled or non-local exchange", async
126
127
  }, {
127
128
  ...HOST_OPTIONS,
128
129
  env: {
130
+ APP_ENV: "development",
129
131
  AUTH_DEV_BYPASS_ENABLED: "true",
130
132
  AUTH_DEV_BYPASS_SECRET: SECRET
131
133
  },
@@ -141,6 +143,7 @@ test("managed preview identity rejects a disabled or non-local exchange", async
141
143
  target: { origin: "http://preview-deadbeefcafe" }
142
144
  }, {
143
145
  env: {
146
+ APP_ENV: "development",
144
147
  AUTH_DEV_BYPASS_ENABLED: "true",
145
148
  AUTH_DEV_BYPASS_SECRET: SECRET
146
149
  },
@@ -159,7 +162,7 @@ test("managed preview identity accepts the dev auth secret auth-core accepts", a
159
162
  };
160
163
  const missing = await executeManagedPreviewIdentityRequest(request, {
161
164
  ...HOST_OPTIONS,
162
- env: { AUTH_DEV_BYPASS_ENABLED: "true", AUTH_DEV_BYPASS_SECRET: " " },
165
+ env: { APP_ENV: "development", AUTH_DEV_BYPASS_ENABLED: "true", AUTH_DEV_BYPASS_SECRET: " " },
163
166
  fetchImpl: async () => assert.fail("fetch must not run")
164
167
  });
165
168
  assert.equal(missing.code, "jskit_managed_preview_identity_secret_missing");
@@ -170,7 +173,7 @@ test("managed preview identity accepts the dev auth secret auth-core accepts", a
170
173
  ];
171
174
  const signedOut = await executeManagedPreviewIdentityRequest(request, {
172
175
  ...HOST_OPTIONS,
173
- env: { AUTH_DEV_BYPASS_ENABLED: "true", AUTH_DEV_BYPASS_SECRET: " any-local-secret " },
176
+ env: { APP_ENV: "development", AUTH_DEV_BYPASS_ENABLED: "true", AUTH_DEV_BYPASS_SECRET: " any-local-secret " },
174
177
  fetchImpl: async () => responses.shift()
175
178
  });
176
179
  assert.equal(signedOut.ok, true);
@@ -62,7 +62,7 @@ before(async () => {
62
62
  inputs: {
63
63
  "auth.service": authService,
64
64
  "runtime.config": {},
65
- "runtime.env": { NODE_ENV: "test", ...env },
65
+ "runtime.env": { APP_ENV: "test", ...env },
66
66
  "runtime.fastify": api,
67
67
  "runtime.logger": silentLogger
68
68
  },
@@ -35,7 +35,7 @@ async function startApp(t, { env = {}, config = {} } = {}) {
35
35
  inputs: {
36
36
  "auth.service": authService,
37
37
  "runtime.config": config,
38
- "runtime.env": { NODE_ENV: "test", ...env },
38
+ "runtime.env": { APP_ENV: "test", ...env },
39
39
  "runtime.fastify": app,
40
40
  "runtime.logger": silentLogger
41
41
  },
@@ -110,7 +110,7 @@ async function startAuthWeb({ env = {}, authService = null } = {}) {
110
110
  "runtime.logger": silentLogger,
111
111
  "auth.service": authService || createAuthService(),
112
112
  "runtime.config": {},
113
- "runtime.env": { NODE_ENV: "test", ...env },
113
+ "runtime.env": { APP_ENV: "test", ...env },
114
114
  "runtime.fastify": fastify
115
115
  },
116
116
  providers: [EventProvider, ActionProvider, HttpProvider, AuthFeature, AuthWebFeature]
@@ -141,7 +141,7 @@ test("AuthWebFeature exposes dev login only when the explicit dev policy enables
141
141
  assert.equal(disabled.fastify.routes.some((route) => route.url === "/api/dev-auth/login-as"), false);
142
142
  const enabled = await startAuthWeb({
143
143
  env: {
144
- NODE_ENV: "development",
144
+ APP_ENV: "development",
145
145
  AUTH_DEV_BYPASS_ENABLED: "true",
146
146
  AUTH_DEV_BYPASS_SECRET: "test-secret"
147
147
  }
@@ -68,7 +68,7 @@ before(async () => {
68
68
  inputs: {
69
69
  "auth.service": authService,
70
70
  "runtime.config": {},
71
- "runtime.env": { NODE_ENV: "test", ...STRICT },
71
+ "runtime.env": { APP_ENV: "test", ...STRICT },
72
72
  "runtime.fastify": api,
73
73
  "runtime.logger": silentLogger
74
74
  },
@@ -54,7 +54,7 @@ async function startConsole(t) {
54
54
  inputs: {
55
55
  "auth.service": authService,
56
56
  "runtime.config": {},
57
- "runtime.env": { NODE_ENV: "test" },
57
+ "runtime.env": { APP_ENV: "test" },
58
58
  "runtime.fastify": app,
59
59
  "runtime.logger": silentLogger
60
60
  },