Skip to content

alltheseas/Bugstr-TS

Repository files navigation

Bugstr-TS (POC)

🚧 Proceed with caution: Bugstr-TS is proof of concept stage, and has not been reviewed by a professional developer 🚧

Minimal browser SDK for sending crash reports as NIP-17 giftwrapped DMs using nostr-tools. Ships:

  • init – configure Bugstr (developer npub, relays, env/release, redaction, confirm hook)

  • captureException – build payload, redact, confirm with user, and send via NIP-17

  • Window hooks (error/unhandledrejection) wired automatically after init

    image

Install

npm install bugstr-ts

Usage

import { init, captureException } from "bugstr-ts";

init({
  developerPubkey: "npub1...", // target npub for NIP-17 DM
  relays: ["wss://relay.damus.io", "wss://nos.lol"],
  environment: "development",
  release: "dev",
  // Optional: beforeSend, confirmSend, redactPatterns
});

// Manual capture
captureException(new Error("bugstr test crash"));

Defaults

  • Redaction: cashu tokens, LN invoices, npub/nsec, mint URLs.
  • Confirm prompt: window.confirm if no confirmSend provided.
  • NIP-17 delivery: nip44 seal and giftwrap, publishes to relays in order, stops after first OK.

Manual testing in the browser

After calling init, run in devtools:

window.dispatchEvent(new ErrorEvent("error", { error: new Error("bugstr test crash") }));

Expect a confirm dialog. On OK, console logs:

  • Bugstr: user confirmed send
  • Bugstr: send completed (received OK from 1 relay, last=<relay>) And the target npub should receive a NIP-17 DM containing the JSON payload (minified stack).

Redaction check:

window.dispatchEvent(new ErrorEvent("error", { error: new Error("cashuA123 npub1abc lnbc1xyz") }));

Payload should show [redacted] in place of secrets.

Scripts

  • npm run build – tsup ESM+CJS + types
  • npm run test – vitest (unit tests TBD)
  • npm run lint

Notes

  • Browser-first; relies on nostr-tools nip44 and Relay.connect.
  • Early return/guard clauses used to avoid deep nesting.

Other Operating Systems

For Android utilize https://github.com/alltheseas/bugstr

About

typescript bugstr

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published