From 789ce2aa9d771774b653d6d40ccc5f5b42fdb49f Mon Sep 17 00:00:00 2001 From: Agusx1211 Date: Fri, 29 Sep 2023 17:10:33 +0000 Subject: [PATCH] Fix send signer address --- packages/waas/src/sequence.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/waas/src/sequence.ts b/packages/waas/src/sequence.ts index f1f699342..77e655a81 100644 --- a/packages/waas/src/sequence.ts +++ b/packages/waas/src/sequence.ts @@ -71,6 +71,16 @@ export class Sequence { } } + public async getSignerAddress() { + const signerPk = await this.signer.get() + if (!signerPk) { + throw new Error('No signer') + } + + const signer = new ethers.Wallet(signerPk) + return signer.address + } + /** * This method will initiate a sign-in process with the waas API. It must be performed * when the user wants to sign in to the app, in parallel with the authentication of the @@ -225,14 +235,14 @@ export class Sequence { async validateSession(): Promise> { const packet = { code: 'validateSession', - session: await this.getWalletAddress() + session: await this.getSignerAddress() } as ValidateSessionPacket return this.buildPayload(packet) } async isSessionValid(): Promise { - const sessionAddress = await this.getWalletAddress() + const sessionAddress = await this.getSignerAddress() const guardClient = new Guard(this.guardUrl, fetch) try {