@stacksjs/defaults 0.73.3 → 0.74.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.
@@ -2,7 +2,6 @@ import { Action } from '@stacksjs/actions'
2
2
  import { generateTwoFactorSetup, stashPendingTwoFactorSecret } from '@stacksjs/auth'
3
3
  import { config } from '@stacksjs/config'
4
4
  import { response } from '@stacksjs/router'
5
- import { toSvg } from 'ts-qr-codes'
6
5
 
7
6
  export default new Action({
8
7
  name: 'GenerateTwoFactorSecretAction',
@@ -14,7 +13,11 @@ export default new Action({
14
13
  return response.unauthorized('Unauthorized')
15
14
 
16
15
  const appName = config.app?.name || 'Stacks'
17
- const { secret, uri } = generateTwoFactorSetup(user.email ?? '', appName)
16
+
17
+ // `qr` is an SVG string of `uri`, rendered by @stacksjs/auth so an app that
18
+ // overrides this action still gets one. Clients that render their own QR
19
+ // code have `uri`; clients that offer manual entry have `secret`.
20
+ const { secret, uri, qr } = generateTwoFactorSetup(user.email ?? '', appName)
18
21
 
19
22
  // Not persisted to users.two_factor_secret until EnableTwoFactorAction
20
23
  // verifies a code produced from it — but stashed server-side now so
@@ -22,15 +25,6 @@ export default new Action({
22
25
  // two-factor.ts's doc comment for why.
23
26
  await stashPendingTwoFactorSecret(user.id as number, secret)
24
27
 
25
- // Rendered here rather than left to the client. Every authenticator flow
26
- // needs the URI as a QR code, and a caller that has to find its own
27
- // encoder either ships one to the browser or, more often, falls back to
28
- // asking the user to type a 32-character secret by hand.
29
- //
30
- // SVG so it stays sharp at any size and can be inlined into a page or an
31
- // email; the URI is still returned for clients that render their own.
32
- const qr = toSvg(uri, { size: 240, title: 'Two-factor authentication setup' })
33
-
34
28
  return response.json({ secret, uri, qr })
35
29
  },
36
30
  })
@@ -2,7 +2,7 @@
2
2
  "publisher": "Stacks",
3
3
  "name": "vscode-stacks",
4
4
  "displayName": "Stacks",
5
- "version": "0.73.3",
5
+ "version": "0.74.0",
6
6
  "description": "A modern Stacks development environment.",
7
7
  "license": "MIT",
8
8
  "funding": "https://github.com/sponsors/chrisbbreuer",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/defaults",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.73.3",
5
+ "version": "0.74.0",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/stacksjs/stacks.git",
@@ -48,14 +48,14 @@
48
48
  "default": "./dist/*.js"
49
49
  }
50
50
  },
51
+ "scripts": {
52
+ "build": "bun build.ts"
53
+ },
51
54
  "dependencies": {
52
55
  "@iconify-json/f7": "^1.2.2",
53
56
  "@iconify-json/hugeicons": "^1.2.27",
54
- "@stacksjs/mobile": "^0.73.3",
57
+ "@stacksjs/mobile": "^0.74.0",
55
58
  "@stacksjs/sanitizer": "^0.2.113",
56
59
  "ts-qr-codes": "^0.1.8"
57
- },
58
- "scripts": {
59
- "build": "bun build.ts"
60
60
  }
61
61
  }