Describe the bug
Calling lookupProfile is throwing the following error with a newly created account after BNS was restored on mainnet.
[ERROR] resolveZoneFileToProfile: error fetching token file https://gaia.blockstack.org/hub/1AZoc8UktzfawbanMDuPWGp8m3Vz1tp2nK/profile.json: Error: Token issuer public key does not match the verifying value
Error: Token issuer public key does not match the verifying value
at verifyProfileToken (/Users/leo/dev/pradel/sigle/node_modules/@stacks/auth/node_modules/@stacks/profile/dist/profileTokens.js:77:15)
at Object.extractProfile (/Users/leo/dev/pradel/sigle/node_modules/@stacks/auth/node_modules/@stacks/profile/dist/profileTokens.js:93:24)
at /Users/leo/dev/pradel/sigle/node_modules/@stacks/auth/node_modules/@stacks/profile/dist/profile.js:300:49
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
What version of Blockstack.js are you using?
1.5.0-alpha.0
Is the bug present in the Blockstack CLI, Gaia hub, Connect or Blockstack Browser?
@stacks/auth
To Reproduce
To reproduce run the following snippet:
import { lookupProfile } from '@stacks/auth';
await lookupProfile({ username: 'testusenameregistration.id.stx' });
Expected behavior
The profile should be returned.
Additional context
@hstove I tried to update the SDK after your comment https://github.com/blockstack/stacks-wallet-web/issues/946#issuecomment-828628579
@agraebe Is this something the splat team can prioritize soon to unblock @pradel with the restoration of usernames per https://github.com/blockstack/stacks-wallet-web/issues/946#issuecomment-830640990? He's been waiting patiently for BNS support this year so it'd be great to resolve his related issues promptly here.
I'll check but probably cannot get to look at it before next week. cc @zone117x @reedrosenbluth
Any update? 馃檹
@pradel looking into this!
@reedrosenbluth thanks 馃槉
I took some time and found the issue.
From my findings, the issue is coming from a difference between the old and new API.
address field as a BTC addressaddress field as a STX addressWhen you call lookupProfile, internally the verifyProfileToken function is called.
If you take a look here https://github.com/blockstack/stacks.js/blob/626c5fccb4dff213f000923ab69c7ed4f5eb48a0/packages/profile/src/profileTokens.ts#L115-L123
publicKeyOrAddress is the STX address returned by the new API and we compare it with the BTC address that we got from the public key so the check is failing.
@agraebe @reedrosenbluth here is the pr with the fix https://github.com/blockstack/stacks.js/pull/1028
thanks very much @pradel!
Most helpful comment
thanks very much @pradel!