From 89ad27c239d4269efad56ba64aa67c5499df75f1 Mon Sep 17 00:00:00 2001 From: ieow Date: Fri, 13 Oct 2023 15:16:42 +0800 Subject: [PATCH] fix: return null on redirectflow --- packages/service-provider-torus/src/TorusServiceProvider.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/service-provider-torus/src/TorusServiceProvider.ts b/packages/service-provider-torus/src/TorusServiceProvider.ts index ddaede48..c9e835b4 100644 --- a/packages/service-provider-torus/src/TorusServiceProvider.ts +++ b/packages/service-provider-torus/src/TorusServiceProvider.ts @@ -147,6 +147,9 @@ class TorusServiceProvider extends ServiceProviderBase { async triggerLogin(params: SubVerifierDetails): Promise { const obj = await this.customAuthInstance.triggerLogin(params); + // incase of redirectflow which return null + if (!obj) return; + const localPrivKey = Torus.getPostboxKey(obj); this.postboxKey = new BN(localPrivKey, "hex"); const { verifier, verifierId } = obj.userInfo; @@ -158,6 +161,8 @@ class TorusServiceProvider extends ServiceProviderBase { async triggerAggregateLogin(params: AggregateLoginParams): Promise { const obj = await this.customAuthInstance.triggerAggregateLogin(params); + // incase of redirectflow which return null + if (!obj) return; const localPrivKey = Torus.getPostboxKey(obj); this.postboxKey = new BN(localPrivKey, "hex");