2fa
2fa copied to clipboard
How to verify Backup Codes for pattern 'xxxx-xxxx-xxxx'
verifyHOTP generates code in xxxxxx format
backup codes are in xxxx-xxxx-xxxx format
No method for verifying them is available.
How to do that?
Currently, the only solution I can think of is to hash the backup codes using bcrypt and store them in DB, and when the user logs in using the code, compare it via bcrypt.compareSync method
Currently, the only solution I can think of is to hash the backup codes using bcrypt and store them in DB, and when the user logs in using the code, compare it via
bcrypt.compareSyncmethod
Yes, that's what I'm thinking. The recovery codes provided in this library are just utility functions.