mirror of
https://github.com/Such-Software/wownerogue.git
synced 2026-10-17 22:31:26 +02:00
fix(smirk): grant the Nostr scope via getNostrPublicKey() before signNostrEvent()
The Smirk dapp API requires the origin to hold the Nostr scope before signNostrEvent(); without it the wallet throws 'Origin lacks the Nostr scope — call getNostrPublicKey() first'. getNostrPublicKey() establishes that grant (prompts once), so call it first in the NIP-98 path.
This commit is contained in:
@@ -141,6 +141,11 @@ const SmirkAuth = {
|
||||
* @returns {Promise<{verifyData: object, pubkey: string|null}>}
|
||||
*/
|
||||
async _verifyNip98(socketId, challenge) {
|
||||
// Grant this origin the Nostr scope first. Per the Smirk dapp API, getNostrPublicKey()
|
||||
// IS the connection for a Nostr origin (it prompts on first use); signNostrEvent() throws
|
||||
// "Origin lacks the Nostr scope — call getNostrPublicKey() first" without it.
|
||||
await window.smirk.getNostrPublicKey();
|
||||
|
||||
// Build the NIP-98 HTTP auth event. The wallet fills in pubkey/id/sig.
|
||||
const evt = {
|
||||
kind: 27235,
|
||||
|
||||
Reference in New Issue
Block a user