Skip to content

Commit

Permalink
Merge pull request #100 from supertokens/feat/mfa
Browse files Browse the repository at this point in the history
feat: add mfa support
  • Loading branch information
rishabhpoddar authored Mar 7, 2024
2 parents 13d4362 + 300b562 commit d093c79
Show file tree
Hide file tree
Showing 76 changed files with 3,381 additions and 73 deletions.
74 changes: 74 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,80 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [unreleased]

## [0.10.0] - 2024-03-03

### Overview

#### Introducing multi-factor authentication

With this release, we are introducing MultiFactorAuthentication and TOTP, this will let you:

- require (2FA or MFA) during sign in
- make use of our TOTP

Check our [guide](https://supertokens.com/docs/thirdpartyemailpassword/common-customizations/multi-factor-auth/overview) for more information.

### Changes

- Added support for FDI 1.19 (Node SDK>= 17.0.0), but keeping support FDI version 1.17 and 1.18 (node >= 15.0.0, golang>=0.13, python>=0.15.0)
- Added the `MultiFactorAuth` and `TOTP` recipes. To start using them you'll need compatible versions:
- Core>=8.0.0
- supertokens-node>=17.0.0
- supertokens-website>=18.0.0
- supertokens-web-js>=0.10.0
- supertokens-auth-react>=0.39.0

### Breaking changes

- Added `firstFactors` into the return type of `getLoginMethods` and removed the enabled flags of different login methods.
- For older FDI versions, the firstFactors array will be calculated based on those enabled flags.

### Migration guide

#### getLoginMethods interface change

If you used to use the enabled flags in getLoginMethods:

Before:

```ts
async function checkLoginMethods() {
const loginMethods = await Multitenancy.getLoginMethods();
if (loginMethods.thirdParty.enabled) {
// custom logic
}
if (loginMethods.emailPassword.enabled) {
// custom logic
}
if (loginMethods.passwordless.enabled) {
// custom logic
}
}
```

After:

```ts
async function checkLoginMethods() {
const loginMethods = await Multitenancy.getLoginMethods();
if (loginMethods.firstFactors.includes("thirdparty")) {
// custom logic
}
if (loginMethods.firstFactors.includes("emailpassword")) {
// custom logic
}

if (
loginMethods.firstFactors.includes("otp-email") ||
loginMethods.firstFactors.includes("otp-phone") ||
loginMethods.firstFactors.includes("link-email") ||
loginMethods.firstFactors.includes("link-phone")
) {
// custom logic
}
}
```

## [0.9.1] - 2024-02-07

### Changes
Expand Down
2 changes: 1 addition & 1 deletion bundle/emailpassword.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle/emailverification.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions bundle/multifactorauth.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle/multitenancy.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle/passwordless.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle/session.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle/supertokens.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle/thirdparty.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle/thirdpartyemailpassword.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle/thirdpartypasswordless.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions bundle/totp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle/userroles.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion frontendDriverInterfaceSupported.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_comment": "contains a list of frontend-backend interface versions that this package supports",
"versions": ["1.17", "1.18"]
"versions": ["1.17", "1.18", "1.19"]
}
1 change: 1 addition & 0 deletions lib/build/recipe/emailverification/constants.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions lib/build/recipe/emailverification/constants.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/build/recipe/emailverification/emailVerificationClaim.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions lib/build/recipe/multifactorauth/index.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 64 additions & 0 deletions lib/build/recipe/multifactorauth/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions lib/build/recipe/multifactorauth/multiFactorAuthClaim.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d093c79

Please sign in to comment.