Skip to content

Commit 04d95b2

Browse files
committed
Removed all logs and update wallet services code
1 parent 28de26b commit 04d95b2

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

demo/rn-bare-example/App.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,16 @@ export default function App() {
9595
}
9696

9797
setConsole('Launch Wallet Services');
98-
await web3auth.launchWalletServices();
98+
await web3auth.launchWalletServices({
99+
loginProvider: LOGIN_PROVIDER.EMAIL_PASSWORDLESS,
100+
redirectUrl: resolvedRedirectUrl,
101+
mfaLevel: 'default',
102+
curve: 'secp256k1',
103+
extraLoginOptions: {
104+
login_hint: email,
105+
connection: 'email',
106+
},
107+
});
99108
}
100109

101110
useEffect(() => {

src/Web3Auth.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ class Web3Auth implements IWeb3Auth {
165165
},
166166
};
167167

168+
this.initParams.redirectUrl = loginParams.redirectUrl;
169+
168170
const result = await this.openloginHandler(`${this.baseUrl}/start`, dataObject);
169171

170172
if (result.type !== "success" || !result.url) {
@@ -231,6 +233,7 @@ class Web3Auth implements IWeb3Auth {
231233
};
232234

233235
const url = `${this.walletSdkUrl}/${path}`;
236+
log.debug("url => ", url);
234237
log.debug(`[Web3Auth] config passed: ${JSON.stringify(dataObject)}`);
235238
const loginId = await this.getLoginId(dataObject);
236239

@@ -248,7 +251,6 @@ class Web3Auth implements IWeb3Auth {
248251
}
249252

250253
async enableMFA(): Promise<void> {
251-
log.debug("enableMFA_1 starts");
252254
if (!this.ready) throw InitializationError.notInitialized("Please call init first.");
253255
if (!this.sessionManager.sessionId) {
254256
throw new Error("user should be logged in.");
@@ -263,7 +265,6 @@ class Web3Auth implements IWeb3Auth {
263265
redirectUrl: this.initParams.redirectUrl,
264266
};
265267

266-
log.debug("enableMFA_2 starts");
267268
const dataObject: OpenloginSessionConfig = {
268269
actionType: OPENLOGIN_ACTIONS.ENABLE_MFA,
269270
options: this.initParams,
@@ -274,22 +275,18 @@ class Web3Auth implements IWeb3Auth {
274275
sessionId: this.sessionManager.sessionId,
275276
};
276277

277-
log.debug("enableMFA_3 starts");
278278
const result = await this.openloginHandler(`${this.baseUrl}/start`, dataObject);
279279

280-
log.debug("enableMFA_4", result);
281280
if (result.type !== "success" || !result.url) {
282281
log.error(`[Web3Auth] login flow failed with error type ${result.type}`);
283282
throw new Error(`login flow failed with error type ${result.type}`);
284283
}
285284

286-
log.debug("enableMFA_5");
287285
const { sessionId, sessionNamespace, error } = extractHashValues(result.url);
288286
if (error || !sessionId) {
289287
throw LoginError.loginFailed(error || "SessionId is missing");
290288
}
291289

292-
log.debug("enableMFA_6");
293290
if (sessionId) {
294291
await this.keyStore.set("sessionId", sessionId);
295292
this.sessionManager.sessionId = sessionId;

src/utils.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { base64toJSON } from "@toruslabs/openlogin-utils";
2-
import log from "loglevel";
32
import { URL } from "react-native-url-polyfill";
43

54
import { SessionResponse } from "./index";
@@ -46,12 +45,8 @@ export function extractHashValues(url: string): { sessionId: string | null; sess
4645
const error = params.error || null;
4746

4847
const b64Params = params.b64Params || null;
49-
log.debug("b64Params", b64Params);
5048
const sessionResponse: SessionResponse = base64toJSON(b64Params);
51-
log.debug("sessionResponse", sessionResponse);
5249
const sessionId = sessionResponse.sessionId || null;
53-
log.debug("sessionId", sessionId);
54-
log.debug("sessionId", sessionId);
5550

5651
return { sessionId, sessionNamespace, error };
5752
}

0 commit comments

Comments
 (0)