Shogun SDK Documentation v1.1.4 - v1.4.2

Shogun Core 📦

npm License TypeScript

Shogun Core is a comprehensive SDK for building decentralized applications (dApps) that simplifies authentication, wallet management, and decentralized data storage. It combines GunDB's peer-to-peer networking with modern authentication standards and blockchain integration to provide a secure, user-friendly foundation for Web3 applications.

  • Multi-Method Authentication: Support for traditional passwords, WebAuthn biometrics, Ethereum wallets, and Nostr/Bitcoin protocols
  • Decentralized Storage: Built on GunDB with offline resilience, real-time sync, and peer-to-peer networking
  • Reactive Data Flows: RxJS integration for building responsive, real-time user interfaces
  • Enterprise Security: End-to-end encryption, secure key management, and modern cryptographic standards
  • Plugin Architecture: Extensible system for adding custom authentication methods and functionality
  • Core SDK: Main SDK entry point, configuration, and plugin management
  • GunDB Integration: Enhanced wrapper around GunDB with direct authentication and RxJS support
  • WebAuthn Plugin: Passwordless authentication with biometrics and security keys
  • Web3 Plugin: Ethereum wallet integration and blockchain authentication
  • Nostr Plugin: Bitcoin and Nostr protocol integration for decentralized identity
npm install shogun-core
# or
yarn add shogun-core
import { ShogunCore } from "shogun-core";

// Initialize Shogun Core
const shogun = new ShogunCore({
peers: ["https://your-gun-peer.com/gun"],
scope: "my-app",

// Configure logging
logging: {
enabled: true,
level: "info"
}
});

// Basic authentication
const loginResult = await shogun.login("username", "password");
if (loginResult.success) {
console.log("User logged in:", loginResult.userPub);
}

// Access built-in plugins
const webauthnPlugin = shogun.getPlugin("webauthn");
const web3Plugin = shogun.getPlugin("web3");
const nostrPlugin = shogun.getPlugin("nostr");

// Work with decentralized data
const gundb = shogun.gundb;
await gundb.put("user/profile", { name: "John Doe", status: "online" });
const profile = await gundb.get("user/profile");

// Reactive data with RxJS
shogun.observe("user/profile").subscribe(profile => {
console.log("Profile updated:", profile);
});
// Listen for authentication events
shogun.on("auth:login", (data) => {
console.log("User logged in:", data.userPub);
});

shogun.on("auth:logout", () => {
console.log("User logged out");
});

shogun.on("error", (error) => {
console.error("SDK error:", error);
});

For detailed documentation on each component:

  • Core SDK API - Main SDK initialization, configuration, and authentication
  • GunDB Integration - Decentralized database operations and reactive data

Full API documentation is available in the /docs directory after building.

Shogun Core is ideal for building:

  • Decentralized Social Networks: Chat apps, forums, and social platforms with user-owned data
  • Web3 Wallets: Browser-based cryptocurrency wallets with multiple authentication options
  • Enterprise dApps: Business applications requiring secure, decentralized data storage
  • Gaming Platforms: Real-time multiplayer games with decentralized leaderboards and assets
  • Privacy-Focused Applications: Apps requiring anonymous interactions and privacy features
  • Collaborative Tools: Real-time document editing, project management, and team coordination

Shogun Core supports all modern browsers with:

  • WebAuthn API support (Chrome 67+, Firefox 60+, Safari 14+)
  • WebCrypto API support
  • IndexedDB support
  • WebSocket support for real-time synchronization

Full Node.js support for server-side applications, testing, and automation.

We welcome contributions! Please follow our contribution guidelines:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Please follow Conventional Commits for commit messages.

MIT License - see LICENSE file for details.