Web3 Authentification Solution

Kate Kharitonova
MyNearWallet Blog
Published in
4 min readOct 13, 2022
Benefits and working principles described

As we discussed in our AMA on Sep 27, MyNearWallet aims to become an entry point to the NEAR protocol for absolutely everyone. Web3 authentification is a big part of this plan. It will allow verifying inside the apps via the wallet without connecting it. Like Google OAuth, but more convenient 😉

Learn more about what Web3 auth actually is and how it will work in MyNearWallet!

What is Web3 authentification?

This is the technology that allows a user to confirm that they have an access to a certain wallet account without connecting it to a needed service. Via Web3 auth, a developer can request the NEAR account private key ownership proof. Let’s see how it works in the example.

Dan wants to play a Web3 game without spending money there. In most cases, he would be asked to log in via his personal email or wallet. If he chooses the wallet option, he would need to connect it to the game on-chain. On NEAR, an app will have to generate a keypair (a private and a public key) and send a public key to a wallet. A wallet, in its turn, will have to authorize a public key by adding it on-chain. For this operation to be completed, Dan would have to wait for a long time if a network is loaded and pay gas fees. Time and money are spent just to log in, before even using the game.

To connect to the app, Dan has 3 options to choose from

Meanwhile, if Dan is using services with Web3 auth, he would just need to confirm that he has an access to the wallet off-chain. The same result could be reached by using personal email, but that would reveal his real identity to the marketplace (which is not always a desirable option in Web3).

After completing this authentification, he will not be able to buy something inside the game but can play for free on this wallet account’s behalf inside the app. The app, in its turn, can send him some reward tokens on his wallet account. Moreover, Web3 auth would allow Dan to authorize inside the Web2 applications with his wallet.

With Web3 auth, Dan can play the game for free on his wallet account’s behalf

Web3 auth benefits for users

  • As it’s off-chain, there are no gas fees, it’s completely free for a user.
  • Works fast and doesn’t depend on the network load.
  • Allows using an on-chain identity instead of a real one. Why use a real email when you can go for an anonymous wallet number?

Web3 auth benefits for developers

  • No transactions are required to verify a user on NEAR.
  • Unlike user authentification via key generation, there is no entry barrier and better conversion of users as the authentification is free.
  • It can be used for server authentification like Google OAuth.
  • No need to worry about the security of generated private key storage.
  • It can be used for back-end authentification.
  • Specifically for wallet developers: a wallet gains more functionality, it becomes an entry point to many applications and a verification tool for many users.

How will Web3 authentification work in MyNearWallet?

MyNearWallet CEO George Goshanov explains Web3 authentification’s main principles from the technical point of view:

“To begin the Web3 auth, the developer sends a verify-owner request with a message that he wants to sign. It can say anything, for instance, the word “hello”. Important to note, that it is not a transaction, just a request with a message. MyNearWallet will get this request and show the user a window saying there’s an app that requires authentification. After a user confirms the authentification, we take the “hello” message and wrap it into metadata (ex: randomly generated numbers). It’s done in order to prevent a situation when a developer sent a transaction instead of just a “hello” message. Adding metadata makes any transaction invalid. It’s a safety measure, that way a user won’t sign a transaction without knowing it. Then we sign a message wrapped in metadata with a key and return it to the app that created a request. A developer checks the message to be the same as the initial message. And if it’s really the same, it confirms that a user has access to the wallet account. That way a user validates a right to do something from the wallet account name inside an app”.

App sends the request with the message, the user (to the right) approves it, and the MyNearWallet team wraps the message in metadata, signs it, and sends it back to the app.

For more information, check these Github posts: 1 & 2. Our official documentation will be available soon.

--

--