-
Notifications
You must be signed in to change notification settings - Fork 316
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
[Fix/1144] Populate username field in auth response #1154
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/blockstack/stacks-js/F1Ltmo1LzEb9xjLzhFcD5ajip3sB |
Codecov Report
@@ Coverage Diff @@
## master #1154 +/- ##
==========================================
+ Coverage 62.03% 62.07% +0.04%
==========================================
Files 122 122
Lines 8315 8322 +7
Branches 1534 1537 +3
==========================================
+ Hits 5158 5166 +8
+ Misses 3052 3051 -1
Partials 105 105
Continue to review full report at Codecov.
|
@@ -347,6 +347,16 @@ export class UserSession { | |||
userData.profile = tokenPayload.profile; | |||
} | |||
|
|||
const address = userData.profile?.stxAddress?.mainnet; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does it work with testnet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The handlePendingSignIn
function is already configured with mainnet
. It does not have any testnet param. So the implementation is aligned with existing auth flow. User may also set coreNode
url there.
Secondly
When we try to get bnsLookupUrl from testnet it will give you bnsLookupUrl of mainnet.
Here is code sample:
import { StacksTestnet } from '@stacks/network';
void (async () => {
const n = new StacksTestnet();
console.log(n.bnsLookupUrl);
})();
Output: https://stacks-node-api.mainnet.stacks.co
Reason: Refer to this commit: fix: use only mainnet URLs during auth BNS checks
1434262
This proves to use only mainet urls for auth BNS checks.
In case if we add network parameter in handlePendingSignIn
then it will return mainet bnsLookupUrl on both testnet and mainnet as the reason is mentioned above.
Other than that if you want to purpose different thoughts then most welcome.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hard coded URLs are only fallback. Here the user does not have a chance to use testnet.
@kyranjamie @friedger Share your thoughts on this pr for further action items. Thanks 🙏 |
Shouldn't this issue be solved in wallet.js on the authenticator? |
@friedger Thanks for the review. |
@ahsan-javaid Somewhere around here:
Newly created accounts are not populated, this should be changed, also it is never checked whether the user has registered a name by now. The client should be able to trust the authenticator that the authenticator knows about registered usernames. If the auth response does not contain the username, the client can savely assume that the user does not have a username or that the user does not want to the app to use it. IMHO. |
Closing based on friedger comment to handle this on wallet repo. |
Description
This PR fixes the issue of empty username field in the auth response.
For details refer to issue #1144
Type of Change
Does this introduce a breaking change?
No
Are documentation updates required?
No
Testing information
Provide context on how tests should be performed.
npm run test
passed successfullyChecklist
npm run test
passes