From f2abdbd54b31b7b45cd662b4d98c18fda101ac4b Mon Sep 17 00:00:00 2001 From: ieow Date: Fri, 13 Oct 2023 15:42:25 +0800 Subject: [PATCH] fix: return on redirectflow --- packages/service-provider-torus/src/TorusServiceProvider.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/service-provider-torus/src/TorusServiceProvider.ts b/packages/service-provider-torus/src/TorusServiceProvider.ts index 6abe82e0..e94d42b9 100644 --- a/packages/service-provider-torus/src/TorusServiceProvider.ts +++ b/packages/service-provider-torus/src/TorusServiceProvider.ts @@ -44,6 +44,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"); return obj; @@ -51,6 +54,9 @@ 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"); return obj;