shogun-core 1.2.4 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,30 +1,32 @@
1
1
  # Shogun Core 📦
2
2
 
3
- [![npm](https://img.shields.io/badge/npm-v1.1.4-blue)](https://www.npmjs.com/package/shogun-core)
3
+ [![npm](https://img.shields.io/badge/npm-v1.2.5-blue)](https://www.npmjs.com/package/shogun-core)
4
4
  [![License](https://img.shields.io/badge/license-MIT-yellow)](https://opensource.org/licenses/MIT)
5
5
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.3.3-blue)](https://www.typescriptlang.org/)
6
6
 
7
7
  ## Overview
8
8
 
9
- Shogun SDK is a comprehensive toolkit for Web3 developers that simplifies decentralized authentication, wallet management, and data storage. It combines GunDB's decentralization with modern authentication standards and blockchain integration to provide a secure and user-friendly foundation for decentralized applications.
9
+ 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.
10
10
 
11
11
  ## Key Features
12
12
 
13
- - **[Authentication](wiki/core.md#authentication)**: Multi-method auth with WebAuthn, Ethereum wallets, and traditional approaches
14
- - **[Storage](wiki/gundb.md)**: Decentralized with GunDB, with offline resilience and real-time sync
15
- - **[Reactive Data](wiki/gundb.md#reactive-programming-with-rxjs)**: RxJS integration for real-time reactive data flows
16
- - **[Security](wiki/core.md)**: End-to-end encryption and modern security standards
13
+ - **[Multi-Method Authentication](wiki/core.md#authentication)**: Support for traditional passwords, WebAuthn biometrics, Ethereum wallets, and Nostr/Bitcoin protocols
14
+ - **[Decentralized Storage](wiki/gundb.md)**: Built on GunDB with offline resilience, real-time sync, and peer-to-peer networking
15
+ - **[Reactive Data Flows](wiki/gundb.md#reactive-programming-with-rxjs)**: RxJS integration for building responsive, real-time user interfaces
16
+ - **[Enterprise Security](wiki/core.md#security)**: End-to-end encryption, secure key management, and modern cryptographic standards
17
+ - **[Plugin Architecture](wiki/core.md#plugin-system)**: Extensible system for adding custom authentication methods and functionality
18
+ - **[Smart Contract Integration](wiki/contracts.md)**: Tools for interacting with Shogun Protocol contracts on Ethereum
17
19
 
18
20
  ## Core Components
19
21
 
20
- - **[Core SDK](wiki/core.md)**: Main SDK entry point and configuration
21
- - **[GunDB Integration](wiki/gundb.md)**: Enhanced wrapper around GunDB with additional features
22
- - **[WebAuthn](wiki/webauthn.md)**: Passwordless authentication with biometrics and security keys
23
- - **[Web3](wiki/web3.md)**: Ethereum wallet integration and authentication
24
- - **[Nostr](wiki/nostr.md)**: Bitcoin and Nostr protocol integration
22
+ - **[Core SDK](wiki/core.md)**: Main SDK entry point, configuration, and plugin management
23
+ - **[GunDB Integration](wiki/gundb.md)**: Enhanced wrapper around GunDB with direct authentication and RxJS support
24
+ - **[WebAuthn Plugin](wiki/webauthn.md)**: Passwordless authentication with biometrics and security keys
25
+ - **[Web3 Plugin](wiki/web3.md)**: Ethereum wallet integration and blockchain authentication
26
+ - **[Nostr Plugin](wiki/nostr.md)**: Bitcoin and Nostr protocol integration for decentralized identity
25
27
  - **[Contracts SDK](wiki/contracts.md)**: Tools for interacting with Shogun Protocol smart contracts
26
28
 
27
- ## Additional Plugins
29
+ ## External Plugins
28
30
 
29
31
  For extended functionality, install these separate plugins:
30
32
 
@@ -38,7 +40,7 @@ npm install shogun-core
38
40
  # or
39
41
  yarn add shogun-core
40
42
 
41
- # Optional plugins
43
+ # Optional external plugins
42
44
  npm install @shogun/bip44 @shogun/stealth-address
43
45
  ```
44
46
 
@@ -47,73 +49,135 @@ npm install @shogun/bip44 @shogun/stealth-address
47
49
  ```typescript
48
50
  import { ShogunCore } from "shogun-core";
49
51
 
50
- // Initialize for Node.js environment
52
+ // Initialize Shogun Core
51
53
  const shogun = new ShogunCore({
52
54
  peers: ["https://your-gun-peer.com/gun"],
53
- scope: "app-namespace",
55
+ scope: "my-app",
54
56
 
55
- // Enable core plugins
57
+ // Enable built-in authentication plugins
56
58
  webauthn: { enabled: true },
57
- ethereum: { enabled: true },
58
- bitcoin: { enabled: true }
59
+ web3: { enabled: true },
60
+ nostr: { enabled: true },
61
+
62
+ // Configure logging
63
+ logging: {
64
+ enabled: true,
65
+ level: "info"
66
+ }
59
67
  });
60
68
 
61
- // Authentication
69
+ // Basic authentication
62
70
  const loginResult = await shogun.login("username", "password");
71
+ if (loginResult.success) {
72
+ console.log("User logged in:", loginResult.userPub);
73
+ }
63
74
 
64
- // Access core plugins
75
+ // Access built-in plugins
65
76
  const webauthnPlugin = shogun.getPlugin("webauthn");
66
77
  const web3Plugin = shogun.getPlugin("web3");
67
78
  const nostrPlugin = shogun.getPlugin("nostr");
68
79
 
69
- // Optional: Use external plugins
80
+ // Work with decentralized data
81
+ const gundb = shogun.gundb;
82
+ await gundb.put("user/profile", { name: "John Doe", status: "online" });
83
+ const profile = await gundb.get("user/profile");
84
+
85
+ // Reactive data with RxJS
86
+ shogun.rx.observe("user/profile").subscribe(profile => {
87
+ console.log("Profile updated:", profile);
88
+ });
89
+ ```
90
+
91
+ ## Advanced Usage
92
+
93
+ ### Custom Plugin Registration
94
+
95
+ ```typescript
96
+ // Register external plugins
70
97
  import { HDWalletPlugin } from "@shogun/bip44";
71
98
  import { StealthPlugin } from "@shogun/stealth-address";
72
99
 
73
- shogun.registerPlugin(new HDWalletPlugin());
74
- shogun.registerPlugin(new StealthPlugin());
100
+ shogun.register(new HDWalletPlugin());
101
+ shogun.register(new StealthPlugin());
75
102
 
76
103
  const bip44Plugin = shogun.getPlugin("bip44");
77
104
  const stealthPlugin = shogun.getPlugin("stealth");
78
105
  ```
79
106
 
107
+ ### Event Handling
108
+
109
+ ```typescript
110
+ // Listen for authentication events
111
+ shogun.on("auth:login", (data) => {
112
+ console.log("User logged in:", data.userPub);
113
+ });
114
+
115
+ shogun.on("auth:logout", () => {
116
+ console.log("User logged out");
117
+ });
118
+
119
+ shogun.on("error", (error) => {
120
+ console.error("SDK error:", error);
121
+ });
122
+ ```
123
+
80
124
  ## Documentation
81
125
 
82
- For detailed documentation on each component, please refer to the wiki pages:
126
+ For detailed documentation on each component:
127
+
128
+ ### Core Documentation
129
+ - **[Core SDK API](wiki/core.md)** - Main SDK initialization, configuration, and authentication
130
+ - **[GunDB Integration](wiki/gundb.md)** - Decentralized database operations and reactive data
83
131
 
84
- - **[Core SDK Documentation](wiki/core.md)**
85
- - **[GunDB Integration](wiki/gundb.md)**
86
- - **[WebAuthn Plugin](wiki/webauthn.md)**
87
- - **[Web3 Plugin](wiki/web3.md)**
88
- - **[Nostr Plugin](wiki/nostr.md)**
89
- - **[Contracts SDK](wiki/contracts.md)**
132
+ ### Plugin Documentation
133
+ - **[WebAuthn Plugin](wiki/webauthn.md)** - Biometric and security key authentication
134
+ - **[Web3 Plugin](wiki/web3.md)** - Ethereum wallet integration
135
+ - **[Nostr Plugin](wiki/nostr.md)** - Bitcoin and Nostr protocol support
136
+ - **[Smart Contracts](wiki/contracts.md)** - Shogun Protocol contract interactions
90
137
 
91
- External plugin documentation:
92
- - **[BIP44 HD Wallet Plugin](https://github.com/scobru/shogun-BIP44)**
93
- - **[Stealth Address Plugin](https://github.com/scobru/shogun-stealth-address)**
138
+ ### External Plugins
139
+ - **[BIP44 HD Wallet Plugin](https://github.com/scobru/shogun-BIP44)** - Hierarchical deterministic wallet management
140
+ - **[Stealth Address Plugin](https://github.com/scobru/shogun-stealth-address)** - Privacy-enhancing address generation
94
141
 
95
- Full technical documentation is available [here](https://shogun-core-docs.vercel.app/).
142
+ ### Technical Documentation
143
+ Full API documentation is available at [shogun-core-docs.vercel.app](https://shogun-core-docs.vercel.app/).
96
144
 
97
145
  ## Use Cases
98
146
 
99
- Shogun is particularly suitable for:
147
+ Shogun Core is ideal for building:
100
148
 
101
- - **dApps**: Decentralized applications requiring user authentication and wallet management
102
- - **Web Wallets**: Implementation of crypto wallets directly in the browser
103
- - **Social dApps**: Social applications requiring decentralized storage and crypto identities
104
- - **Privacy-Focused Apps**: Applications needing stealth features and advanced privacy (with optional plugins)
105
- - **Real-time Applications**: Chat apps, live dashboards, and collaborative tools using reactive data
149
+ - **Decentralized Social Networks**: Chat apps, forums, and social platforms with user-owned data
150
+ - **Web3 Wallets**: Browser-based cryptocurrency wallets with multiple authentication options
151
+ - **Enterprise dApps**: Business applications requiring secure, decentralized data storage
152
+ - **Gaming Platforms**: Real-time multiplayer games with decentralized leaderboards and assets
153
+ - **Privacy-Focused Applications**: Apps requiring anonymous interactions and stealth features
154
+ - **Collaborative Tools**: Real-time document editing, project management, and team coordination
155
+ - **IoT and Edge Computing**: Decentralized device management and data collection
156
+
157
+ ## Browser Compatibility
158
+
159
+ Shogun Core supports all modern browsers with:
160
+ - WebAuthn API support (Chrome 67+, Firefox 60+, Safari 14+)
161
+ - WebCrypto API support
162
+ - IndexedDB support
163
+ - WebSocket support for real-time synchronization
164
+
165
+ ## Node.js Support
166
+
167
+ Full Node.js support for server-side applications, testing, and automation.
106
168
 
107
169
  ## Contributing
108
170
 
109
- Contributions are welcome! If you would like to contribute to the project, please:
171
+ We welcome contributions! Please follow our contribution guidelines:
110
172
 
111
173
  1. Fork the repository
112
- 2. Create a branch for your feature (`git checkout -b feature/amazing-feature`)
113
- 3. Commit your changes (`git commit -m 'Added amazing feature'`)
174
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
175
+ 3. Commit your changes (`git commit -m 'feat: add amazing feature'`)
114
176
  4. Push to the branch (`git push origin feature/amazing-feature`)
115
177
  5. Open a Pull Request
116
178
 
179
+ Please follow [Conventional Commits](https://conventionalcommits.org/) for commit messages.
180
+
117
181
  ## License
118
182
 
119
- MIT
183
+ MIT License - see [LICENSE](LICENSE) file for details.