René's URL Explorer Experiment


Title: Implement Automatic NIP-98 HTTP Authentication · Issue #1 · JavaScriptSolidServer/podkey · GitHub

Open Graph Title: Implement Automatic NIP-98 HTTP Authentication · Issue #1 · JavaScriptSolidServer/podkey

X Title: Implement Automatic NIP-98 HTTP Authentication · Issue #1 · JavaScriptSolidServer/podkey

Description: Overview Currently, Podkey provides NIP-07 window.nostr API for websites to manually create and sign NIP-98 auth events, but it does not automatically intercept HTTP requests to add NIP-98 Authorization headers. This issue tracks the imp...

Open Graph Description: Overview Currently, Podkey provides NIP-07 window.nostr API for websites to manually create and sign NIP-98 auth events, but it does not automatically intercept HTTP requests to add NIP-98 Authoriz...

X Description: Overview Currently, Podkey provides NIP-07 window.nostr API for websites to manually create and sign NIP-98 auth events, but it does not automatically intercept HTTP requests to add NIP-98 Authoriz...

Opengraph URL: https://github.com/JavaScriptSolidServer/podkey/issues/1

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Implement Automatic NIP-98 HTTP Authentication","articleBody":"## Overview\n\nCurrently, Podkey provides NIP-07 `window.nostr` API for websites to manually create and sign NIP-98 auth events, but it does **not automatically intercept HTTP requests** to add NIP-98 Authorization headers. This issue tracks the implementation of automatic NIP-98 authentication for Solid servers and other Nostr-authenticated HTTP endpoints.\n\n## Current State\n\n- ✅ Extension has `webRequest` permission in `manifest.json`\n- ✅ Extension can sign NIP-98 events (kind 27235) via `window.nostr.signEvent()`\n- ✅ Auto-sign functionality exists for trusted origins\n- ❌ **No automatic HTTP request interception**\n- ❌ **No automatic 401 response detection and retry**\n- ❌ **No automatic Authorization header injection**\n\n## NIP-98 Specification Reference\n\n**Specification:** https://github.com/nostr-protocol/nips/blob/master/98.md\n\n### Event Structure\n\n```json\n{\n  \"kind\": 27235,\n  \"content\": \"\",\n  \"tags\": [\n    [\"u\", \"https://example.com/api/resource?query=value\"],\n    [\"method\", \"GET\"]\n  ],\n  \"created_at\": 1682327852\n}\n```\n\n### Authorization Header Format\n\n```\nAuthorization: Nostr \u003cbase64-encoded-signed-event\u003e\n```\n\n### For Requests with Body (POST, PUT, etc.)\n\nInclude a `payload` tag with SHA-256 hash of the request body.\n\n## Implementation Requirements\n\n### 1. HTTP Request Interception\n\n**Location:** `src/background.js`\n\n- Use `chrome.webRequest.onBeforeSendHeaders` to intercept outgoing requests\n- Filter requests to origins that are trusted or are known Solid servers\n- Only intercept requests to origins that have been trusted or are known Solid servers\n- Don't intercept requests that already have an `Authorization` header (unless it's a retry)\n- Cache signed auth events per request URL+method to avoid re-signing identical requests\n\n### 2. 401 Response Detection and Retry\n\n**Location:** `src/background.js`\n\n- Use `chrome.webRequest.onHeadersReceived` to detect 401 responses\n- When 401 is detected:\n  1. Check if origin is trusted\n  2. Create NIP-98 auth event for the failed request\n  3. Sign the event using existing `signEvent()` function\n  4. Retry the original request with `Authorization: Nostr \u003cbase64-event\u003e` header\n\n**Retry Logic:**\n- Only retry on **401 Unauthorized** responses\n- Consider **403 Forbidden** if it's auth-related (optional, may need user preference)\n- **Do NOT retry** on other 4xx errors (404, 400, etc.) - these are not auth issues\n- Limit retry attempts (max 1 retry per request to avoid loops)\n- Track retry state to prevent infinite loops\n\n### 3. NIP-98 Event Creation\n\n**Location:** `src/background.js` (new function)\n\n```javascript\nasync function createNip98AuthEvent(requestDetails) {\n  const event = {\n    kind: 27235,\n    content: '',\n    created_at: Math.floor(Date.now() / 1000),\n    tags: [\n      ['u', requestDetails.url],\n      ['method', requestDetails.method]\n    ]\n  };\n  \n  // If request has body, add payload tag\n  if (requestDetails.requestBody) {\n    const bodyHash = await hashRequestBody(requestDetails.requestBody);\n    event.tags.push(['payload', bodyHash]);\n  }\n  \n  return event;\n}\n```\n\n### 4. Request Body Hashing\n\n- For requests with body (POST, PUT, PATCH), compute SHA-256 hash\n- Use existing `@noble/hashes` library\n- Handle different body formats: FormData, ArrayBuffer, Blob, string\n\n### 5. Base64 Encoding\n\n- Encode signed event JSON to base64\n- Format: `Authorization: Nostr \u003cbase64-string\u003e`\n\n### 6. User Preferences\n\n- Add setting: \"Auto-authenticate HTTP requests\" (separate from event auto-sign)\n- Add setting: \"Retry on 403 Forbidden\" (optional, default false)\n- Respect existing `getAutoSign()` preference\n\n## Code Structure\n\n### WebRequest Listeners\n\n```javascript\n// Intercept outgoing requests\nchrome.webRequest.onBeforeSendHeaders.addListener(\n  interceptRequest,\n  {\n    urls: ['\u003call_urls\u003e'],\n    types: ['xmlhttprequest', 'main_frame', 'sub_frame']\n  },\n  ['requestHeaders', 'blocking']\n);\n\n// Detect 401 responses\nchrome.webRequest.onHeadersReceived.addListener(\n  handle401Response,\n  {\n    urls: ['\u003call_urls\u003e'],\n    types: ['xmlhttprequest', 'main_frame', 'sub_frame']\n  },\n  ['responseHeaders']\n);\n```\n\n## Edge Cases\n\n1. **Request Body Handling:** Different formats (FormData, Blob, ArrayBuffer, string)\n2. **URL Normalization:** Ensure `u` tag matches exactly what server expects\n3. **Timing:** `created_at` should be recent (within 60 seconds typically)\n4. **Caching:** Cache signed events per (URL, method, bodyHash) tuple\n5. **Security:** Only auto-auth for trusted origins\n6. **Performance:** Minimize blocking operations\n7. **Error Handling:** Handle signing failures gracefully\n\n## Acceptance Criteria\n\n- [ ] Extension automatically adds NIP-98 Authorization header to requests from trusted origins\n- [ ] Extension detects 401 responses and retries with NIP-98 auth\n- [ ] NIP-98 events are correctly formatted per specification\n- [ ] Request bodies are hashed and included in `payload` tag when present\n- [ ] Only 401 (and optionally 403) responses trigger retry\n- [ ] User preferences (auto-sign, trusted origins) are respected\n- [ ] No infinite retry loops\n- [ ] Works with GET, POST, PUT, DELETE, PATCH methods\n- [ ] Handles various request body formats correctly\n- [ ] Unit tests pass\n- [ ] Integration tests pass\n\n## References\n\n- [NIP-98 Specification](https://github.com/nostr-protocol/nips/blob/master/98.md)\n- [Chrome WebRequest API](https://developer.chrome.com/docs/extensions/reference/webRequest/)\n- [Solid Project Authentication](https://solidproject.org/TR/oidc)","author":{"url":"https://github.com/melvincarvalho","@type":"Person","name":"melvincarvalho"},"datePublished":"2026-01-05T17:17:02.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/1/podkey/issues/1"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:955275e1-fcf8-0925-aa3b-d7ae8fb160e2
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9EA6:2CD505:F8EB5B:156900E:69776C0E
html-safe-nonce7f1c5d91ccbfe7329e117b7082b8585604c111df7df2a98b5712fe5bd2ac9129
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RUE2OjJDRDUwNTpGOEVCNUI6MTU2OTAwRTo2OTc3NkMwRSIsInZpc2l0b3JfaWQiOiI0NzA5MjM3Nzg0MTg5NTYxODcwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacd7ebbda6cd74fffc8f1a7a9145d3003d9f302f742c806ebe32347635ce2b7c0a
hovercard-subject-tagissue:3782252841
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/JavaScriptSolidServer/podkey/1/issue_layout
twitter:imagehttps://opengraph.githubassets.com/2dc94e22b2de95eb42dee3c04fcb022d31f7f1223745f1472f65f09b3e79333e/JavaScriptSolidServer/podkey/issues/1
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/2dc94e22b2de95eb42dee3c04fcb022d31f7f1223745f1472f65f09b3e79333e/JavaScriptSolidServer/podkey/issues/1
og:image:altOverview Currently, Podkey provides NIP-07 window.nostr API for websites to manually create and sign NIP-98 auth events, but it does not automatically intercept HTTP requests to add NIP-98 Authoriz...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemelvincarvalho
hostnamegithub.com
expected-hostnamegithub.com
None425384cc392ce2ddd1a7a0c1e7043ab4192d4c04452a2ed7f2f38d2fa9293b5a
turbo-cache-controlno-preview
go-importgithub.com/JavaScriptSolidServer/podkey git https://github.com/JavaScriptSolidServer/podkey.git
octolytics-dimension-user_id205442424
octolytics-dimension-user_loginJavaScriptSolidServer
octolytics-dimension-repository_id1128353485
octolytics-dimension-repository_nwoJavaScriptSolidServer/podkey
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1128353485
octolytics-dimension-repository_network_root_nwoJavaScriptSolidServer/podkey
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release72de26f7ca9bdb0559ebf1e63e6c685ee2c520ce
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/JavaScriptSolidServer/podkey/issues/1#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FJavaScriptSolidServer%2Fpodkey%2Fissues%2F1
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FJavaScriptSolidServer%2Fpodkey%2Fissues%2F1
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=JavaScriptSolidServer%2Fpodkey
Reloadhttps://github.com/JavaScriptSolidServer/podkey/issues/1
Reloadhttps://github.com/JavaScriptSolidServer/podkey/issues/1
Reloadhttps://github.com/JavaScriptSolidServer/podkey/issues/1
JavaScriptSolidServer https://github.com/JavaScriptSolidServer
podkeyhttps://github.com/JavaScriptSolidServer/podkey
Notifications https://github.com/login?return_to=%2FJavaScriptSolidServer%2Fpodkey
Fork 0 https://github.com/login?return_to=%2FJavaScriptSolidServer%2Fpodkey
Star 1 https://github.com/login?return_to=%2FJavaScriptSolidServer%2Fpodkey
Code https://github.com/JavaScriptSolidServer/podkey
Issues 1 https://github.com/JavaScriptSolidServer/podkey/issues
Pull requests 0 https://github.com/JavaScriptSolidServer/podkey/pulls
Actions https://github.com/JavaScriptSolidServer/podkey/actions
Projects 0 https://github.com/JavaScriptSolidServer/podkey/projects
Security 0 https://github.com/JavaScriptSolidServer/podkey/security
Insights https://github.com/JavaScriptSolidServer/podkey/pulse
Code https://github.com/JavaScriptSolidServer/podkey
Issues https://github.com/JavaScriptSolidServer/podkey/issues
Pull requests https://github.com/JavaScriptSolidServer/podkey/pulls
Actions https://github.com/JavaScriptSolidServer/podkey/actions
Projects https://github.com/JavaScriptSolidServer/podkey/projects
Security https://github.com/JavaScriptSolidServer/podkey/security
Insights https://github.com/JavaScriptSolidServer/podkey/pulse
New issuehttps://github.com/login?return_to=https://github.com/JavaScriptSolidServer/podkey/issues/1
New issuehttps://github.com/login?return_to=https://github.com/JavaScriptSolidServer/podkey/issues/1
Implement Automatic NIP-98 HTTP Authenticationhttps://github.com/JavaScriptSolidServer/podkey/issues/1#top
enhancementNew feature or requesthttps://github.com/JavaScriptSolidServer/podkey/issues?q=state%3Aopen%20label%3A%22enhancement%22
https://github.com/melvincarvalho
https://github.com/melvincarvalho
melvincarvalhohttps://github.com/melvincarvalho
on Jan 5, 2026https://github.com/JavaScriptSolidServer/podkey/issues/1#issue-3782252841
https://github.com/nostr-protocol/nips/blob/master/98.mdhttps://github.com/nostr-protocol/nips/blob/master/98.md
NIP-98 Specificationhttps://github.com/nostr-protocol/nips/blob/master/98.md
Chrome WebRequest APIhttps://developer.chrome.com/docs/extensions/reference/webRequest/
Solid Project Authenticationhttps://solidproject.org/TR/oidc
enhancementNew feature or requesthttps://github.com/JavaScriptSolidServer/podkey/issues?q=state%3Aopen%20label%3A%22enhancement%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.