diff options
Diffstat (limited to 'server/helpers/otp.ts')
-rw-r--r-- | server/helpers/otp.ts | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/server/helpers/otp.ts b/server/helpers/otp.ts index a13edc5e2..a32cc9621 100644 --- a/server/helpers/otp.ts +++ b/server/helpers/otp.ts | |||
@@ -1,11 +1,15 @@ | |||
1 | import { Secret, TOTP } from 'otpauth' | 1 | import { Secret, TOTP } from 'otpauth' |
2 | import { CONFIG } from '@server/initializers/config' | ||
2 | import { WEBSERVER } from '@server/initializers/constants' | 3 | import { WEBSERVER } from '@server/initializers/constants' |
4 | import { decrypt } from './peertube-crypto' | ||
3 | 5 | ||
4 | function isOTPValid (options: { | 6 | async function isOTPValid (options: { |
5 | secret: string | 7 | encryptedSecret: string |
6 | token: string | 8 | token: string |
7 | }) { | 9 | }) { |
8 | const { token, secret } = options | 10 | const { token, encryptedSecret } = options |
11 | |||
12 | const secret = await decrypt(encryptedSecret, CONFIG.SECRETS.PEERTUBE) | ||
9 | 13 | ||
10 | const totp = new TOTP({ | 14 | const totp = new TOTP({ |
11 | ...baseOTPOptions(), | 15 | ...baseOTPOptions(), |