Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calling .login(proof-value) when already having a session will not generate a new proof #222

Open
NKCSS opened this issue May 27, 2024 · 2 comments

Comments

@NKCSS
Copy link
Contributor

NKCSS commented May 27, 2024

I encountered this while building the example application for my Labs Grant. If you would call .login(different-proof-from-initial-login), the call will just return the logged in wallet, without showing a dialogue. The .proof property will also be available, but will have the original proof, not using the nonce that was passed to the login function.

@includenull
Copy link
Member

https://github.com/worldwide-asset-exchange/waxjs/blob/develop/src/index.ts#L166-L172

public async login(nonce?: string): Promise<string> {
  if (!this.user) {
    this.receiveLogin(await this.signingApi.login(nonce));
  }
   return this.user.account;
}

It looks like if there is a current user it will just return that.
Solution would be to call WaxJS.logout() first.

I'm not sure if changing this behaviour would break anything, needs some investigation.

@NKCSS
Copy link
Contributor Author

NKCSS commented Aug 9, 2024

Yeah, could be solved on either end; calling logout before calling login with nonce on the client would solve things, otherwise, you'd need to remember the nonce that was previously passed to login, compare when called again, and clear it on logout, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants