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

Add support for signInMessage method #921

Open
trechriron opened this issue Sep 13, 2023 · 3 comments
Open

Add support for signInMessage method #921

trechriron opened this issue Sep 13, 2023 · 3 comments
Assignees
Labels
Emerging Tech Emerging Tech flying formation at Pagoda

Comments

@trechriron
Copy link
Collaborator

trechriron commented Sep 13, 2023

Description

This task is about adding the signInMessage method to the API of the wallet selector.

This new method/function(way) will allow dApp users to "sign-in/login" into a dApp without a contractId (without LAK) by signing a message in the wallet based on the NEP413 standard for signing messages.

Once the message is signed and verified wallet selector will set the state as "signed-in".

Kujtim Prenku
2 days ago

After the call on Thursday, these are the steps we’re working on right now:

  • The signedIn state logic will be inside the wallet selector, wallet will not be aware of this.
  • When calling signAndSendTransaction(s) if there's no contract throw "Not signedIn with a contractId."
  • Save signedMessage in localStorage to persist the accountId and publicKey that was used to sign the message
  • Create a new function in the selector API to check the sign-in type
async signInType() {
  // Returns "key" if we're signed in with signIn
  // Returns "message" if we're signedIn with signInMessage
  return "key";
}

CleanUp messages on signOut

Kujtim Prenku
August 28, 2023 at 1:24 AM

Hi @daryl Collins, I have a few questions about the implementation of this signInMessage feature:

  • Is the SignedMessage needed by the dApp developer after the user signs-in via signInMessage?
  • What happens when we try to call signAndSendTransaction(s) after we sign-in with signInMessage?
  • Will the wallets implement this method on their side? (Otherwise, the wallet is not aware we're signedin/connected)
  • We're persisting the "message", should it be removed if the user decides to signIn with a contractId?

Kujtim Prenku
August 14, 2023 at 9:50 AM

HI @jacob Nall , this is the ticket for signInMessage in our examples at the moment I am just showing a new button next to the login button, this only opens the modal and if an option is clicked it will trigger the signInMessage of that option:

PR: #883

cebc4066-2270-4e07-955d-3ab0cfaa8267

Should we inform the user what this “Sign In Message” does in a small popup before opening the wallet-selector’s modal?

@kujtimprenkuSQA
Copy link
Contributor

Moving this to "In Progress" as I will need to:

  • Improve signInMessage in the core package for browser wallets.
  • Avoid saving the signature and state we get from SignedMessage into localStorage.
  • Add support for signInMessage for MyNearWallet (since signMessage is supported on both mainnet and testnet).

@kujtimprenkuSQA
Copy link
Contributor

Moving this into Review as the above improvements have been addressed.

@kujtimprenkuSQA
Copy link
Contributor

Moving this into progress to add support for signInMessage in Sender since they implemented the signMessage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Emerging Tech Emerging Tech flying formation at Pagoda
Projects
None yet
Development

No branches or pull requests

2 participants