Skip to content

Commit de9b06d

Browse files
committed
upgrade to @epic-web/totp
1 parent 615ea42 commit de9b06d

File tree

9 files changed

+32
-295
lines changed

9 files changed

+32
-295
lines changed

app/routes/resources+/verify.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { ErrorList, Field } from '~/components/forms.tsx'
77
import { StatusButton } from '~/components/ui/status-button.tsx'
88
import { prisma } from '~/utils/db.server.ts'
99
import { EnsurePE, getDomainUrl, useIsSubmitting } from '~/utils/misc.tsx'
10-
import { generateTOTP, verifyTOTP } from '~/utils/totp.server.ts'
10+
import { generateTOTP, verifyTOTP } from '@epic-web/totp'
1111
import { handleVerification as handleForgotPasswordVerification } from '../_auth+/forgot-password/index.tsx'
1212
import { handleVerification as handleOnboardingVerification } from '../_auth+/onboarding.tsx'
1313
import { handleVerification as handleChangeEmailVerification } from '../settings+/profile.change-email.index/index.tsx'

app/routes/settings+/profile.two-factor.index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Icon } from '~/components/ui/icon.tsx'
44
import { StatusButton } from '~/components/ui/status-button.tsx'
55
import { requireUserId } from '~/utils/auth.server.ts'
66
import { prisma } from '~/utils/db.server.ts'
7-
import { generateTOTP } from '~/utils/totp.server.ts'
7+
import { generateTOTP } from '@epic-web/totp'
88
import { shouldRequestTwoFA } from '../resources+/login.tsx'
99
import { twoFAVerificationType } from './profile.two-factor.tsx'
1010
import { verificationType as verifyVerificationType } from './profile.two-factor.verify.tsx'

app/routes/settings+/profile.two-factor.verify.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { StatusButton } from '~/components/ui/status-button.tsx'
66
import { requireUserId } from '~/utils/auth.server.ts'
77
import { prisma } from '~/utils/db.server.ts'
88
import { getDomainUrl, invariant, invariantResponse } from '~/utils/misc.tsx'
9-
import { getTOTPAuthUri } from '~/utils/totp.server.ts'
9+
import { getTOTPAuthUri } from '@epic-web/totp'
1010
import { useUser } from '~/utils/user.ts'
1111
import {
1212
type VerificationTypes,

app/utils/totp.server.test.ts

Lines changed: 0 additions & 90 deletions
This file was deleted.

app/utils/totp.server.ts

Lines changed: 0 additions & 200 deletions
This file was deleted.

docs/decisions/014-totp.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ to implement 2FA which we'll do in the future. This also allows us to remove the
102102
`ENCRIPTION_SECRET` from the list of environment variables you need to manage.
103103
And we can swap the `encryption.server.ts` utility for a `totp.server.ts`
104104
utility which, while not simpler is a fair trade (and could definitely be
105-
developed and externalized into an open source library).
105+
developed and externalized into an open source library). **Update:** This has
106+
now been published as [@epic-web/totp](https://npm.im/@epic-web/totp).
106107

107108
This also means we now need a new table in the database. This can be designed in
108109
such a way that there's no migration cost and it's purely additive.

package-lock.json

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"dependencies": {
4141
"@conform-to/react": "^0.7.4",
4242
"@conform-to/zod": "^0.7.4",
43+
"@epic-web/totp": "^1.0.2",
4344
"@prisma/client": "^5.0.0",
4445
"@radix-ui/react-checkbox": "^1.0.4",
4546
"@radix-ui/react-dropdown-menu": "^2.0.5",
@@ -73,6 +74,7 @@
7374
"eslint-plugin-remix-react-routes": "^1.0.5",
7475
"execa": "^7.1.1",
7576
"express": "^4.18.2",
77+
"express-rate-limit": "^6.8.1",
7678
"get-port": "^7.0.0",
7779
"helmet": "^7.0.0",
7880
"intl-parse-accept-language": "^1.0.0",

0 commit comments

Comments
 (0)