podkey

πŸ”‘ Podkey

Browser extension for did:nostr and Solid authentication

Version License NIP-07 Test Page

Podkey is a beautiful, secure browser extension for did:nostr and Solid authentication. It provides a NIP-07-compatible Nostr wallet that enables seamless authentication to Solid pods using did:nostr identities, while remaining fully compatible with the broader Nostr ecosystem.

image

✨ What Makes Podkey Different

Better than nos2x

did:nostr & Solid Superpowers

πŸš€ Quick Start

Installation

  1. Clone the repository:

    git clone https://github.com/JavaScriptSolidServer/podkey.git
    cd podkey
    
  2. Install dependencies:

    npm install
    
  3. Build the extension:

    npm run build
    
  4. Load in Chrome:

    • Open chrome://extensions/
    • Enable β€œDeveloper mode” (top-right toggle)
    • Click β€œLoad unpacked”
    • Select the podkey directory
  5. Test it:

    • Visit the test page to verify everything works
    • Click the Podkey icon to generate or import a key

🎯 Features

Core Functionality

Roadmap

πŸ“š Usage

Basic API

// Check if Podkey is available
if (window.nostr) {
  // Get your public key
  const pubkey = await window.nostr.getPublicKey()
  console.log('Your public key:', pubkey)

  // Sign an event
  const event = {
    kind: 1,
    created_at: Math.floor(Date.now() / 1000),
    tags: [],
    content: 'Hello from Podkey! πŸ”‘'
  }

  const signed = await window.nostr.signEvent(event)
  console.log('Signed event:', signed)
}

Testing

Visit the interactive test page to:

πŸ—οΈ Architecture

Components

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Browser Extension (Podkey)             β”‚
β”‚                                         β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  Popup UI (popup/)                β”‚  β”‚
β”‚  β”‚  - Key generation/import          β”‚  β”‚
β”‚  β”‚  - Trust management               β”‚  β”‚
β”‚  β”‚  - Settings & identity display    β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                                         β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  Background Worker (src/)         β”‚  β”‚
β”‚  β”‚  - Key storage (storage.js)       β”‚  β”‚
β”‚  β”‚  - Event signing (crypto.js)      β”‚  β”‚
β”‚  β”‚  - Permission management          β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                                         β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  Content Script (src/injected.js)β”‚  β”‚
β”‚  β”‚  - Injects window.nostr           β”‚  β”‚
β”‚  β”‚  - Bridges page ↔ extension       β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Security Model

πŸ› οΈ Development

Project Structure

podkey/
β”œβ”€β”€ manifest.json          # Extension manifest (MV3)
β”œβ”€β”€ package.json           # npm package configuration
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ background.js      # Service worker (message handling)
β”‚   β”œβ”€β”€ crypto.js          # Key generation & signing
β”‚   β”œβ”€β”€ storage.js         # Secure key storage
β”‚   β”œβ”€β”€ injected.js        # Content script (page bridge)
β”‚   └── nostr-provider.js  # window.nostr implementation
β”œβ”€β”€ popup/
β”‚   β”œβ”€β”€ popup.html         # Popup UI structure
β”‚   β”œβ”€β”€ popup.css          # Beautiful styling
β”‚   └── popup.js           # Popup logic
β”œβ”€β”€ test-page/
β”‚   └── index.html         # Interactive test page
β”œβ”€β”€ scripts/
β”‚   └── bundle.js          # Build script for dependencies
└── icons/                 # Extension icons

Tech Stack

Building

# Install dependencies
npm install

# Build the extension (bundles dependencies)
npm run build

# Lint code
npm run lint

# Run tests
npm test

Testing

  1. Build the extension:

    npm run build
    
  2. Load in Chrome (see Installation above)

  3. Visit the test page:

    • Local: Open test-page/index.html in your browser
    • Online: https://javascriptsolidserver.github.io/podkey/test-page/
  4. Check the console for any errors

πŸ” did:nostr Identity

Podkey is built for did:nostr and Solid authentication. All public keys are proper 64-character hexadecimal strings, making them fully compatible with the did:nostr specification:

const pubkey = await window.nostr.getPublicKey()
const did = `did:nostr:${pubkey}`
// did:nostr:3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d

This enables:

πŸ“– API Reference

window.nostr.getPublicKey()

Returns the user’s public key (64-char hex).

const pubkey = await window.nostr.getPublicKey()

window.nostr.signEvent(event)

Signs a Nostr event. Shows permission prompt if origin is not trusted.

const signed = await window.nostr.signEvent({
  kind: 1,
  created_at: Math.floor(Date.now() / 1000),
  tags: [],
  content: 'Hello!'
})

window.nostr.getRelays()

Returns relay configuration (coming soon).

const relays = await window.nostr.getRelays()

🀝 Contributing

We love contributions! Here’s how to get started:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Add tests if applicable
  5. Ensure tests pass (npm test)
  6. Commit (git commit -m 'Add amazing feature')
  7. Push (git push origin feature/amazing-feature)
  8. Open a Pull Request

Contribution Ideas

πŸ› Troubleshooting

Extension doesn’t show up

window.nostr is undefined

Events not signing

Build errors

πŸ“„ License

AGPL-3.0 License - see LICENSE for details

πŸ™ Acknowledgments


Made with πŸ”‘ by the JavaScriptSolidServer team

Podkey v0.0.7 - Your keys, your identity, your data