From 835c5a2ce3bab1433c827af0942d781c7197e9f1 Mon Sep 17 00:00:00 2001 From: himanshuchawla009 Date: Tue, 5 Jul 2022 12:34:16 +0530 Subject: [PATCH 1/9] wip: new mfa flow --- examples/vue-example/package-lock.json | 63 +++++++++------------ examples/vue-example/package.json | 1 - examples/vue-example/src/App.vue | 13 +++++ examples/vue-example/src/lib/loginConfig.ts | 2 +- examples/vue-example/src/lib/openlogin.ts | 7 +-- packages/openlogin/src/OpenLogin.ts | 44 +++++++++++++- packages/openlogin/src/constants.ts | 3 + packages/openlogin/src/utils.ts | 7 +++ 8 files changed, 97 insertions(+), 43 deletions(-) diff --git a/examples/vue-example/package-lock.json b/examples/vue-example/package-lock.json index 5384ae35..186c9562 100644 --- a/examples/vue-example/package-lock.json +++ b/examples/vue-example/package-lock.json @@ -16,7 +16,6 @@ "@web3auth/ethereum-provider": "^1.0.0", "bs58": "^4.0.1", "core-js": "^3.15.2", - "openlogin": "file:../../packages/wrapper/", "vue": "^2.6.14", "web3": "^1.7.0" }, @@ -44,13 +43,14 @@ } }, "../../packages/openlogin": { - "version": "2.0.1", + "name": "@toruslabs/openlogin", + "version": "2.1.0", "license": "ISC", "dependencies": { "@toruslabs/eccrypto": "^1.1.8", "@toruslabs/http-helpers": "^3.0.0", - "@toruslabs/openlogin-jrpc": "^2.0.0", - "@toruslabs/openlogin-utils": "^2.0.0", + "@toruslabs/openlogin-jrpc": "^2.1.0", + "@toruslabs/openlogin-utils": "^2.1.0", "lodash.merge": "^4.6.2", "loglevel": "^1.8.0", "pump": "^3.0.0" @@ -64,6 +64,7 @@ } }, "../../packages/openlogin-ed25519": { + "name": "@toruslabs/openlogin-ed25519", "version": "2.0.0", "license": "ISC", "dependencies": { @@ -74,10 +75,11 @@ } }, "../../packages/openlogin-jrpc": { - "version": "2.0.0", + "name": "@toruslabs/openlogin-jrpc", + "version": "2.1.0", "license": "ISC", "dependencies": { - "@toruslabs/openlogin-utils": "^2.0.0", + "@toruslabs/openlogin-utils": "^2.1.0", "end-of-stream": "^1.4.4", "eth-rpc-errors": "^4.0.3", "events": "^3.3.0", @@ -97,19 +99,21 @@ } }, "../../packages/openlogin-subkey": { - "version": "2.0.0", + "name": "@toruslabs/openlogin-subkey", + "version": "2.1.0", "license": "ISC", "dependencies": { - "@toruslabs/openlogin-utils": "^2.0.0", - "bn.js": "^5.2.0", - "ffjavascript": "^0.2.54" + "@toruslabs/openlogin-utils": "^2.1.0", + "bn.js": "^5.2.1", + "ffjavascript": "^0.2.55" }, "peerDependencies": { "@babel/runtime": "7.x" } }, "../../packages/openlogin-utils": { - "version": "2.0.0", + "name": "@toruslabs/openlogin-utils", + "version": "2.1.0", "license": "ISC", "dependencies": { "base64url": "^3.0.1", @@ -125,13 +129,15 @@ } }, "../../packages/wrapper": { - "version": "2.0.1", + "name": "openlogin", + "version": "2.1.0", + "extraneous": true, "license": "ISC", "dependencies": { - "@toruslabs/openlogin": "^2.0.1", - "@toruslabs/openlogin-jrpc": "^2.0.0", - "@toruslabs/openlogin-utils": "^2.0.0", - "bn.js": "^5.2.0" + "@toruslabs/openlogin": "^2.1.0", + "@toruslabs/openlogin-jrpc": "^2.1.0", + "@toruslabs/openlogin-utils": "^2.1.0", + "bn.js": "^5.2.1" }, "peerDependencies": { "@babel/runtime": "7.x" @@ -10596,10 +10602,6 @@ "opener": "bin/opener-bin.js" } }, - "node_modules/openlogin": { - "resolved": "../../packages/wrapper", - "link": true - }, "node_modules/optionator": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", @@ -17188,8 +17190,8 @@ "requires": { "@toruslabs/eccrypto": "^1.1.8", "@toruslabs/http-helpers": "^3.0.0", - "@toruslabs/openlogin-jrpc": "^2.0.0", - "@toruslabs/openlogin-utils": "^2.0.0", + "@toruslabs/openlogin-jrpc": "^2.1.0", + "@toruslabs/openlogin-utils": "^2.1.0", "@types/lodash.merge": "^4.6.7", "@types/pump": "^1.1.1", "lodash.merge": "^4.6.2", @@ -17206,7 +17208,7 @@ "@toruslabs/openlogin-jrpc": { "version": "file:../../packages/openlogin-jrpc", "requires": { - "@toruslabs/openlogin-utils": "^2.0.0", + "@toruslabs/openlogin-utils": "^2.1.0", "@types/end-of-stream": "^1.4.1", "@types/once": "^1.4.0", "@types/pump": "^1.1.1", @@ -17223,9 +17225,9 @@ "@toruslabs/openlogin-subkey": { "version": "file:../../packages/openlogin-subkey", "requires": { - "@toruslabs/openlogin-utils": "^2.0.0", - "bn.js": "^5.2.0", - "ffjavascript": "^0.2.54" + "@toruslabs/openlogin-utils": "^2.1.0", + "bn.js": "^5.2.1", + "ffjavascript": "^0.2.55" } }, "@toruslabs/openlogin-utils": { @@ -23307,15 +23309,6 @@ "integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==", "dev": true }, - "openlogin": { - "version": "file:../../packages/wrapper", - "requires": { - "@toruslabs/openlogin": "^2.0.1", - "@toruslabs/openlogin-jrpc": "^2.0.0", - "@toruslabs/openlogin-utils": "^2.0.0", - "bn.js": "^5.2.0" - } - }, "optionator": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", diff --git a/examples/vue-example/package.json b/examples/vue-example/package.json index 1d06543f..b79f04d2 100644 --- a/examples/vue-example/package.json +++ b/examples/vue-example/package.json @@ -16,7 +16,6 @@ "@web3auth/ethereum-provider": "^1.0.0", "bs58": "^4.0.1", "core-js": "^3.15.2", - "openlogin": "file:../../packages/wrapper/", "vue": "^2.6.14", "web3": "^1.7.0" }, diff --git a/examples/vue-example/src/App.vue b/examples/vue-example/src/App.vue index 6480300b..9557bea2 100644 --- a/examples/vue-example/src/App.vue +++ b/examples/vue-example/src/App.vue @@ -31,6 +31,8 @@ + +

@@ -96,6 +98,7 @@ export default Vue.extend({ // login_hint: 'hello@yourapp.com', // }, // sessionTime: 30, //seconds + curve: "ed25519", }); if (privKey) { this.privKey = openlogin.privKey; @@ -116,6 +119,7 @@ export default Vue.extend({ mfaLevel: "mandatory", loginProvider: "", redirectUrl: `${window.origin}`, + curve: "ed25519", }); if (privKey) { this.privKey = privKey; @@ -149,6 +153,15 @@ export default Vue.extend({ const userInfo = await openlogin.getUserInfo(); this.printToConsole(userInfo); }, + async enableMfa() { + const openlogin = getOpenLoginInstance(); + await openlogin.enableMfa(); + }, + + async showSettings() { + const openlogin = getOpenLoginInstance(); + await openlogin.showSettings(); + }, getEd25519Key() { const openlogin = getOpenLoginInstance(); diff --git a/examples/vue-example/src/lib/loginConfig.ts b/examples/vue-example/src/lib/loginConfig.ts index cbf218f2..eb9f2e41 100644 --- a/examples/vue-example/src/lib/loginConfig.ts +++ b/examples/vue-example/src/lib/loginConfig.ts @@ -1,5 +1,5 @@ +import { LOGIN_PROVIDER } from "@toruslabs/openlogin"; import { LoginConfig } from "@toruslabs/openlogin-jrpc"; -import { LOGIN_PROVIDER } from "openlogin"; export default { // email_passwordless: { diff --git a/examples/vue-example/src/lib/openlogin.ts b/examples/vue-example/src/lib/openlogin.ts index decc5b60..4b395c38 100644 --- a/examples/vue-example/src/lib/openlogin.ts +++ b/examples/vue-example/src/lib/openlogin.ts @@ -1,5 +1,5 @@ +import OpenLogin from "@toruslabs/openlogin"; import { WhiteLabelData } from "@toruslabs/openlogin-jrpc"; -import OpenLogin from "openlogin"; import loginConfig from "./loginConfig"; @@ -14,10 +14,9 @@ export function getOpenLoginInstance(whiteLabel?: WhiteLabelData) { // clientId is not required for localhost, you can set it to any string // for development clientId: YOUR_PROJECT_ID, - network: "testnet", - uxMode: "redirect", + network: "development", + uxMode: "popup", whiteLabel, - loginConfig, }); } if (whiteLabel) openLoginInstance.state.whiteLabel = whiteLabel; diff --git a/packages/openlogin/src/OpenLogin.ts b/packages/openlogin/src/OpenLogin.ts index a0e149a4..725b0058 100644 --- a/packages/openlogin/src/OpenLogin.ts +++ b/packages/openlogin/src/OpenLogin.ts @@ -23,7 +23,7 @@ import { import { Modal } from "./Modal"; import OpenLoginStore from "./OpenLoginStore"; import Provider from "./Provider"; -import { awaitReq, constructURL, getHashQueryParams, getPopupFeatures, preloadIframe } from "./utils"; +import { awaitReq, constructURL, getHashQueryParams, getPopupFeatures, isNullishValue, preloadIframe } from "./utils"; preloadIframe("https://app.openlogin.com/sdk-modal"); @@ -46,6 +46,7 @@ export type OpenLoginState = { whiteLabel: WhiteLabelData; loginConfig: LoginConfig; storageServerUrl: string; + isMfaEnabled: boolean; }; class OpenLogin { @@ -110,6 +111,7 @@ class OpenLogin { support3PC: !options.no3PC, whiteLabel: options.whiteLabel, storageServerUrl: options._storageServerUrl, + isMfaEnabled: false, }; } @@ -208,6 +210,43 @@ class OpenLogin { return { privKey: this.privKey }; } + async enableMfa(): Promise { + this._syncState(await this._getData()); + const storeData = this.state.store.getStore(); + if (!this.privKey) throw new Error("Please login first."); + if (storeData.isMfaEnabled) { + throw new Error("Mfa is already enabled for this account"); + } + const params: Record = {}; + // defaults + params.redirectUrl = this.state.redirectUrl; + + await this.request({ + method: OPENLOGIN_METHOD.ENABLE_MFA, + params: [params], + startUrl: this.state.startUrl, + popupUrl: this.state.popupUrl, + allowedInteractions: [ALLOWED_INTERACTIONS.POPUP, ALLOWED_INTERACTIONS.REDIRECT], + }); + } + + async showSettings(): Promise { + this._syncState(await this._getData()); + if (!this.privKey) throw new Error("Please login first."); + + const params: Record = {}; + // defaults + params.redirectUrl = this.state.redirectUrl; + + await this.request({ + method: OPENLOGIN_METHOD.SHOW_SETTINGS, + params: [params], + startUrl: this.state.startUrl, + popupUrl: this.state.popupUrl, + allowedInteractions: [ALLOWED_INTERACTIONS.POPUP, ALLOWED_INTERACTIONS.REDIRECT], + }); + } + async logout(logoutParams: Partial & Partial = {}): Promise { const params: Record = {}; // defaults @@ -417,7 +456,7 @@ class OpenLogin { // so we don't want to overwrite the local store if privKey is available // and if latest iframe store data is not available if (newState.privKey) { - if (newState.store[key]) { + if (!isNullishValue(newState.store[key])) { this.state.store.set(key, newState.store[key]); } } else { @@ -498,6 +537,7 @@ class OpenLogin { typeOfLogin: (storeData.typeOfLogin as LOGIN_PROVIDER_TYPE | CUSTOM_LOGIN_PROVIDER_TYPE) || "", dappShare: (storeData.dappShare as string) || "", idToken: (storeData.idToken as string) || "", + isMfaEnabled: (storeData.isMfaEnabled as boolean) || false, }; return userInfo; diff --git a/packages/openlogin/src/constants.ts b/packages/openlogin/src/constants.ts index e81d18bb..9b0a0af5 100644 --- a/packages/openlogin/src/constants.ts +++ b/packages/openlogin/src/constants.ts @@ -22,6 +22,8 @@ export type UX_MODE_TYPE = typeof UX_MODE[keyof typeof UX_MODE]; export const OPENLOGIN_METHOD = { LOGIN: "openlogin_login", LOGOUT: "openlogin_logout", + ENABLE_MFA: "openlogin_enable_mfa", + SHOW_SETTINGS: "openlogin_show_settings", CHECK_3PC_SUPPORT: "openlogin_check_3PC_support", SET_PID_DATA: "openlogin_set_pid_data", GET_DATA: "openlogin_get_data", @@ -339,4 +341,5 @@ export type OpenloginUserInfo = { typeOfLogin: LOGIN_PROVIDER_TYPE | CUSTOM_LOGIN_PROVIDER_TYPE; dappShare?: string; idToken?: string; + isMfaEnabled?: boolean; }; diff --git a/packages/openlogin/src/utils.ts b/packages/openlogin/src/utils.ts index f05a5d28..e35e1a6f 100644 --- a/packages/openlogin/src/utils.ts +++ b/packages/openlogin/src/utils.ts @@ -202,3 +202,10 @@ export function getPopupFeatures(): string { const features = `titlebar=0,toolbar=0,status=0,location=0,menubar=0,height=${h / systemZoom},width=${w / systemZoom},top=${top},left=${left}`; return features; } + +export const isNullishValue = (val: unknown): boolean => { + if (val === "") return true; + if (val === null) return true; + if (val === undefined) return true; + return false; +}; From 31e603679686a95993d4cf02898b8ddab3b1f46b Mon Sep 17 00:00:00 2001 From: himanshuchawla009 Date: Sun, 10 Jul 2022 15:06:18 +0530 Subject: [PATCH 2/9] clear session id on logout --- packages/openlogin/src/OpenLogin.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/openlogin/src/OpenLogin.ts b/packages/openlogin/src/OpenLogin.ts index 725b0058..3412a8fe 100644 --- a/packages/openlogin/src/OpenLogin.ts +++ b/packages/openlogin/src/OpenLogin.ts @@ -270,6 +270,7 @@ class OpenLogin { }); this.state.privKey = ""; + this.state.store.set("sessionId", ""); return res; } From cd15f07c4aff5335ffbd0fa8051318594b62504d Mon Sep 17 00:00:00 2001 From: himanshuchawla009 Date: Sun, 10 Jul 2022 15:51:35 +0530 Subject: [PATCH 3/9] handle session expiry --- packages/openlogin-jrpc/src/utils.ts | 1 + packages/openlogin/src/OpenLogin.ts | 42 +++++++++++++++++----------- packages/openlogin/src/constants.ts | 2 ++ 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/packages/openlogin-jrpc/src/utils.ts b/packages/openlogin-jrpc/src/utils.ts index 3819feda..2adb75e3 100644 --- a/packages/openlogin-jrpc/src/utils.ts +++ b/packages/openlogin-jrpc/src/utils.ts @@ -241,4 +241,5 @@ export type SessionInfo = { _whiteLabelData?: WhiteLabelData; _loginConfig: LoginConfig; _sessionId?: string; + _isNewSession?: boolean; }; diff --git a/packages/openlogin/src/OpenLogin.ts b/packages/openlogin/src/OpenLogin.ts index 3412a8fe..a4f69c2f 100644 --- a/packages/openlogin/src/OpenLogin.ts +++ b/packages/openlogin/src/OpenLogin.ts @@ -17,6 +17,7 @@ import { OpenLoginOptions, OpenloginUserInfo, RequestParams, + SESSION_EXPIRED, UX_MODE, UX_MODE_TYPE, } from "./constants"; @@ -211,23 +212,31 @@ class OpenLogin { } async enableMfa(): Promise { - this._syncState(await this._getData()); - const storeData = this.state.store.getStore(); - if (!this.privKey) throw new Error("Please login first."); - if (storeData.isMfaEnabled) { - throw new Error("Mfa is already enabled for this account"); + try { + this._syncState(await this._getData()); + const storeData = this.state.store.getStore(); + if (!this.privKey) throw new Error("Please login first."); + if (storeData.isMfaEnabled) { + throw new Error("Mfa is already enabled for this account"); + } + const params: Record = {}; + // defaults + params.redirectUrl = this.state.redirectUrl; + + await this.request({ + method: OPENLOGIN_METHOD.ENABLE_MFA, + params: [params], + startUrl: this.state.startUrl, + popupUrl: this.state.popupUrl, + allowedInteractions: [ALLOWED_INTERACTIONS.POPUP, ALLOWED_INTERACTIONS.REDIRECT], + }); + } catch (error) { + if (error?.message === SESSION_EXPIRED) { + this._syncState(await this._getData()); + this.state.store.set("sessionId", ""); + } + throw error; } - const params: Record = {}; - // defaults - params.redirectUrl = this.state.redirectUrl; - - await this.request({ - method: OPENLOGIN_METHOD.ENABLE_MFA, - params: [params], - startUrl: this.state.startUrl, - popupUrl: this.state.popupUrl, - allowedInteractions: [ALLOWED_INTERACTIONS.POPUP, ALLOWED_INTERACTIONS.REDIRECT], - }); } async showSettings(): Promise { @@ -311,6 +320,7 @@ class OpenLogin { if (!session._sessionId) { const sessionId = randomId(); session._sessionId = sessionId as string; + session._isNewSession = true; this.state.store.set("sessionId", sessionId); } diff --git a/packages/openlogin/src/constants.ts b/packages/openlogin/src/constants.ts index 9b0a0af5..4135d47c 100644 --- a/packages/openlogin/src/constants.ts +++ b/packages/openlogin/src/constants.ts @@ -343,3 +343,5 @@ export type OpenloginUserInfo = { idToken?: string; isMfaEnabled?: boolean; }; + +export const SESSION_EXPIRED = "SESSION_EXPIRED"; From cd43039c331d4021974433294fbdb8fb0ae4c4ae Mon Sep 17 00:00:00 2001 From: himanshuchawla009 Date: Sun, 10 Jul 2022 17:58:56 +0530 Subject: [PATCH 4/9] sync state after enabling mfa --- packages/openlogin/src/OpenLogin.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/openlogin/src/OpenLogin.ts b/packages/openlogin/src/OpenLogin.ts index a4f69c2f..84c75e67 100644 --- a/packages/openlogin/src/OpenLogin.ts +++ b/packages/openlogin/src/OpenLogin.ts @@ -230,6 +230,7 @@ class OpenLogin { popupUrl: this.state.popupUrl, allowedInteractions: [ALLOWED_INTERACTIONS.POPUP, ALLOWED_INTERACTIONS.REDIRECT], }); + this._syncState(await this._getData()); } catch (error) { if (error?.message === SESSION_EXPIRED) { this._syncState(await this._getData()); From e4a2a867bd569e2fe4e59f40c8e2350ef4793f07 Mon Sep 17 00:00:00 2001 From: himanshuchawla009 Date: Wed, 13 Jul 2022 15:02:35 +0530 Subject: [PATCH 5/9] session expiry handled from settings function --- packages/openlogin/src/OpenLogin.ts | 32 ++++++++++++++++++----------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/packages/openlogin/src/OpenLogin.ts b/packages/openlogin/src/OpenLogin.ts index 84c75e67..55002567 100644 --- a/packages/openlogin/src/OpenLogin.ts +++ b/packages/openlogin/src/OpenLogin.ts @@ -241,20 +241,28 @@ class OpenLogin { } async showSettings(): Promise { - this._syncState(await this._getData()); - if (!this.privKey) throw new Error("Please login first."); + try { + this._syncState(await this._getData()); + if (!this.privKey) throw new Error("Please login first."); - const params: Record = {}; - // defaults - params.redirectUrl = this.state.redirectUrl; + const params: Record = {}; + // defaults + params.redirectUrl = this.state.redirectUrl; - await this.request({ - method: OPENLOGIN_METHOD.SHOW_SETTINGS, - params: [params], - startUrl: this.state.startUrl, - popupUrl: this.state.popupUrl, - allowedInteractions: [ALLOWED_INTERACTIONS.POPUP, ALLOWED_INTERACTIONS.REDIRECT], - }); + await this.request({ + method: OPENLOGIN_METHOD.SHOW_SETTINGS, + params: [params], + startUrl: this.state.startUrl, + popupUrl: this.state.popupUrl, + allowedInteractions: [ALLOWED_INTERACTIONS.POPUP, ALLOWED_INTERACTIONS.REDIRECT], + }); + } catch (error) { + if (error?.message === SESSION_EXPIRED) { + this._syncState(await this._getData()); + this.state.store.set("sessionId", ""); + } + throw error; + } } async logout(logoutParams: Partial & Partial = {}): Promise { From 9ca94bc48f9a04ddae91dcbc168d178625596f72 Mon Sep 17 00:00:00 2001 From: himanshuchawla009 Date: Fri, 15 Jul 2022 12:18:58 +0530 Subject: [PATCH 6/9] example fix to auto logout if session is expired --- examples/vue-example/src/App.vue | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/examples/vue-example/src/App.vue b/examples/vue-example/src/App.vue index 9557bea2..4d8e4899 100644 --- a/examples/vue-example/src/App.vue +++ b/examples/vue-example/src/App.vue @@ -155,12 +155,26 @@ export default Vue.extend({ }, async enableMfa() { const openlogin = getOpenLoginInstance(); - await openlogin.enableMfa(); + + try { + await openlogin.enableMfa(); + } catch (error) { + console.log("error", error); + } finally { + this.privKey = openlogin.privKey; + } }, async showSettings() { const openlogin = getOpenLoginInstance(); - await openlogin.showSettings(); + + try { + await openlogin.showSettings(); + } catch (error) { + console.log("error", error); + } finally { + this.privKey = openlogin.privKey; + } }, getEd25519Key() { From cabf4ef0204edd6346615cb0fa2a4dd043322626 Mon Sep 17 00:00:00 2001 From: himanshuchawla009 Date: Fri, 15 Jul 2022 14:46:27 +0530 Subject: [PATCH 7/9] 3pc check removed from get data. --- packages/openlogin/src/OpenLogin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/openlogin/src/OpenLogin.ts b/packages/openlogin/src/OpenLogin.ts index 55002567..f1e55872 100644 --- a/packages/openlogin/src/OpenLogin.ts +++ b/packages/openlogin/src/OpenLogin.ts @@ -338,7 +338,7 @@ class OpenLogin { // use JRPC where possible - if (this.state.support3PC && allowedInteractions.includes(ALLOWED_INTERACTIONS.JRPC)) { + if (allowedInteractions.includes(ALLOWED_INTERACTIONS.JRPC)) { return this._jrpcRequest[], T>({ method, params }); } From 98f3713ad83685c17cca0f35e8c06d7bd807ac52 Mon Sep 17 00:00:00 2001 From: himanshuchawla009 Date: Wed, 27 Jul 2022 01:09:28 +0800 Subject: [PATCH 8/9] minor example fixes --- examples/vue-example/src/App.vue | 2 +- examples/vue-example/src/lib/openlogin.ts | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/vue-example/src/App.vue b/examples/vue-example/src/App.vue index 4d8e4899..ed39e13b 100644 --- a/examples/vue-example/src/App.vue +++ b/examples/vue-example/src/App.vue @@ -66,7 +66,7 @@ export default Vue.extend({ }, async mounted() { this.loading = true; - const openlogin = getOpenLoginInstance(); + const openlogin = getOpenLoginInstance(whitelabel); await openlogin.init(); if (openlogin.privKey) { this.privKey = openlogin.privKey; diff --git a/examples/vue-example/src/lib/openlogin.ts b/examples/vue-example/src/lib/openlogin.ts index 4b395c38..8b7e8292 100644 --- a/examples/vue-example/src/lib/openlogin.ts +++ b/examples/vue-example/src/lib/openlogin.ts @@ -19,6 +19,5 @@ export function getOpenLoginInstance(whiteLabel?: WhiteLabelData) { whiteLabel, }); } - if (whiteLabel) openLoginInstance.state.whiteLabel = whiteLabel; return openLoginInstance; } From 47ac767bfce07d325165e5d3bbe33eb51d16a847 Mon Sep 17 00:00:00 2001 From: himanshuchawla009 Date: Tue, 8 Nov 2022 19:48:21 +0800 Subject: [PATCH 9/9] Merge branch 'master' into feat/mfa-flow --- packages/openlogin/src/interfaces.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/openlogin/src/interfaces.ts b/packages/openlogin/src/interfaces.ts index 416875a0..89f92532 100644 --- a/packages/openlogin/src/interfaces.ts +++ b/packages/openlogin/src/interfaces.ts @@ -309,4 +309,10 @@ export type OpenloginUserInfo = { * custom verifiers. */ oAuthAccessToken?: string; + + /** + * If `true` means that mfa of the account is enabled. + * + */ + isMfaEnabled: boolean; };