shogun-core 3.3.0 → 3.3.1

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.
Files changed (123) hide show
  1. package/dist/browser/shogun-core.js +83301 -148719
  2. package/dist/browser/shogun-core.js.map +1 -1
  3. package/dist/{src/index.js → index.js} +1 -15
  4. package/dist/types/{src/index.d.ts → index.d.ts} +0 -10
  5. package/dist/types/{src/types → types}/shogun.d.ts +2 -0
  6. package/package.json +1 -1
  7. package/dist/browser/_e6ae.shogun-core.js +0 -14
  8. package/dist/browser/_e6ae.shogun-core.js.map +0 -1
  9. package/dist/ship/examples/messenger-cli.js +0 -745
  10. package/dist/ship/examples/wallet-cli.js +0 -767
  11. package/dist/ship/implementation/SHIP_00.js +0 -478
  12. package/dist/ship/implementation/SHIP_01.js +0 -433
  13. package/dist/ship/implementation/SHIP_02.js +0 -1366
  14. package/dist/ship/implementation/SHIP_03.js +0 -855
  15. package/dist/ship/interfaces/ISHIP_00.js +0 -135
  16. package/dist/ship/interfaces/ISHIP_01.js +0 -128
  17. package/dist/ship/interfaces/ISHIP_02.js +0 -57
  18. package/dist/ship/interfaces/ISHIP_03.js +0 -61
  19. package/dist/types/ship/examples/messenger-cli.d.ts +0 -37
  20. package/dist/types/ship/examples/wallet-cli.d.ts +0 -131
  21. package/dist/types/ship/implementation/SHIP_00.d.ts +0 -113
  22. package/dist/types/ship/implementation/SHIP_01.d.ts +0 -80
  23. package/dist/types/ship/implementation/SHIP_02.d.ts +0 -297
  24. package/dist/types/ship/implementation/SHIP_03.d.ts +0 -127
  25. package/dist/types/ship/interfaces/ISHIP_00.d.ts +0 -410
  26. package/dist/types/ship/interfaces/ISHIP_01.d.ts +0 -343
  27. package/dist/types/ship/interfaces/ISHIP_02.d.ts +0 -470
  28. package/dist/types/ship/interfaces/ISHIP_03.d.ts +0 -295
  29. /package/dist/{src/config → config}/simplified-config.js +0 -0
  30. /package/dist/{src/core.js → core.js} +0 -0
  31. /package/dist/{src/examples → examples}/api-test.js +0 -0
  32. /package/dist/{src/examples → examples}/simple-api-test.js +0 -0
  33. /package/dist/{src/gundb → gundb}/api.js +0 -0
  34. /package/dist/{src/gundb → gundb}/crypto.js +0 -0
  35. /package/dist/{src/gundb → gundb}/db.js +0 -0
  36. /package/dist/{src/gundb → gundb}/derive.js +0 -0
  37. /package/dist/{src/gundb → gundb}/errors.js +0 -0
  38. /package/dist/{src/gundb → gundb}/index.js +0 -0
  39. /package/dist/{src/gundb → gundb}/rxjs.js +0 -0
  40. /package/dist/{src/gundb → gundb}/types.js +0 -0
  41. /package/dist/{src/interfaces → interfaces}/common.js +0 -0
  42. /package/dist/{src/interfaces → interfaces}/events.js +0 -0
  43. /package/dist/{src/interfaces → interfaces}/plugin.js +0 -0
  44. /package/dist/{src/interfaces → interfaces}/shogun.js +0 -0
  45. /package/dist/{src/managers → managers}/AuthManager.js +0 -0
  46. /package/dist/{src/managers → managers}/CoreInitializer.js +0 -0
  47. /package/dist/{src/managers → managers}/EventManager.js +0 -0
  48. /package/dist/{src/managers → managers}/PluginManager.js +0 -0
  49. /package/dist/{src/migration-test.js → migration-test.js} +0 -0
  50. /package/dist/{src/plugins → plugins}/base.js +0 -0
  51. /package/dist/{src/plugins → plugins}/index.js +0 -0
  52. /package/dist/{src/plugins → plugins}/nostr/index.js +0 -0
  53. /package/dist/{src/plugins → plugins}/nostr/nostrConnector.js +0 -0
  54. /package/dist/{src/plugins → plugins}/nostr/nostrConnectorPlugin.js +0 -0
  55. /package/dist/{src/plugins → plugins}/nostr/nostrSigner.js +0 -0
  56. /package/dist/{src/plugins → plugins}/nostr/types.js +0 -0
  57. /package/dist/{src/plugins → plugins}/oauth/index.js +0 -0
  58. /package/dist/{src/plugins → plugins}/oauth/oauthConnector.js +0 -0
  59. /package/dist/{src/plugins → plugins}/oauth/oauthPlugin.js +0 -0
  60. /package/dist/{src/plugins → plugins}/oauth/types.js +0 -0
  61. /package/dist/{src/plugins → plugins}/web3/index.js +0 -0
  62. /package/dist/{src/plugins → plugins}/web3/types.js +0 -0
  63. /package/dist/{src/plugins → plugins}/web3/web3Connector.js +0 -0
  64. /package/dist/{src/plugins → plugins}/web3/web3ConnectorPlugin.js +0 -0
  65. /package/dist/{src/plugins → plugins}/web3/web3Signer.js +0 -0
  66. /package/dist/{src/plugins → plugins}/webauthn/index.js +0 -0
  67. /package/dist/{src/plugins → plugins}/webauthn/types.js +0 -0
  68. /package/dist/{src/plugins → plugins}/webauthn/webauthn.js +0 -0
  69. /package/dist/{src/plugins → plugins}/webauthn/webauthnPlugin.js +0 -0
  70. /package/dist/{src/plugins → plugins}/webauthn/webauthnSigner.js +0 -0
  71. /package/dist/{src/storage → storage}/storage.js +0 -0
  72. /package/dist/types/{src/config → config}/simplified-config.d.ts +0 -0
  73. /package/dist/types/{src/core.d.ts → core.d.ts} +0 -0
  74. /package/dist/{src/types → types}/events.js +0 -0
  75. /package/dist/types/{src/examples → examples}/api-test.d.ts +0 -0
  76. /package/dist/types/{src/examples → examples}/simple-api-test.d.ts +0 -0
  77. /package/dist/types/{src/gundb → gundb}/api.d.ts +0 -0
  78. /package/dist/types/{src/gundb → gundb}/crypto.d.ts +0 -0
  79. /package/dist/types/{src/gundb → gundb}/db.d.ts +0 -0
  80. /package/dist/types/{src/gundb → gundb}/derive.d.ts +0 -0
  81. /package/dist/types/{src/gundb → gundb}/errors.d.ts +0 -0
  82. /package/dist/types/{src/gundb → gundb}/index.d.ts +0 -0
  83. /package/dist/types/{src/gundb → gundb}/rxjs.d.ts +0 -0
  84. /package/dist/types/{src/gundb → gundb}/types.d.ts +0 -0
  85. /package/dist/types/{src/interfaces → interfaces}/common.d.ts +0 -0
  86. /package/dist/types/{src/interfaces → interfaces}/events.d.ts +0 -0
  87. /package/dist/types/{src/interfaces → interfaces}/plugin.d.ts +0 -0
  88. /package/dist/types/{src/interfaces → interfaces}/shogun.d.ts +0 -0
  89. /package/dist/types/{src/managers → managers}/AuthManager.d.ts +0 -0
  90. /package/dist/types/{src/managers → managers}/CoreInitializer.d.ts +0 -0
  91. /package/dist/types/{src/managers → managers}/EventManager.d.ts +0 -0
  92. /package/dist/types/{src/managers → managers}/PluginManager.d.ts +0 -0
  93. /package/dist/types/{src/migration-test.d.ts → migration-test.d.ts} +0 -0
  94. /package/dist/types/{src/plugins → plugins}/base.d.ts +0 -0
  95. /package/dist/types/{src/plugins → plugins}/index.d.ts +0 -0
  96. /package/dist/types/{src/plugins → plugins}/nostr/index.d.ts +0 -0
  97. /package/dist/types/{src/plugins → plugins}/nostr/nostrConnector.d.ts +0 -0
  98. /package/dist/types/{src/plugins → plugins}/nostr/nostrConnectorPlugin.d.ts +0 -0
  99. /package/dist/types/{src/plugins → plugins}/nostr/nostrSigner.d.ts +0 -0
  100. /package/dist/types/{src/plugins → plugins}/nostr/types.d.ts +0 -0
  101. /package/dist/types/{src/plugins → plugins}/oauth/index.d.ts +0 -0
  102. /package/dist/types/{src/plugins → plugins}/oauth/oauthConnector.d.ts +0 -0
  103. /package/dist/types/{src/plugins → plugins}/oauth/oauthPlugin.d.ts +0 -0
  104. /package/dist/types/{src/plugins → plugins}/oauth/types.d.ts +0 -0
  105. /package/dist/types/{src/plugins → plugins}/web3/index.d.ts +0 -0
  106. /package/dist/types/{src/plugins → plugins}/web3/types.d.ts +0 -0
  107. /package/dist/types/{src/plugins → plugins}/web3/web3Connector.d.ts +0 -0
  108. /package/dist/types/{src/plugins → plugins}/web3/web3ConnectorPlugin.d.ts +0 -0
  109. /package/dist/types/{src/plugins → plugins}/web3/web3Signer.d.ts +0 -0
  110. /package/dist/types/{src/plugins → plugins}/webauthn/index.d.ts +0 -0
  111. /package/dist/types/{src/plugins → plugins}/webauthn/types.d.ts +0 -0
  112. /package/dist/types/{src/plugins → plugins}/webauthn/webauthn.d.ts +0 -0
  113. /package/dist/types/{src/plugins → plugins}/webauthn/webauthnPlugin.d.ts +0 -0
  114. /package/dist/types/{src/plugins → plugins}/webauthn/webauthnSigner.d.ts +0 -0
  115. /package/dist/{src/types → types}/shogun.js +0 -0
  116. /package/dist/types/{src/storage → storage}/storage.d.ts +0 -0
  117. /package/dist/types/{src/types → types}/events.d.ts +0 -0
  118. /package/dist/types/{src/utils → utils}/errorHandler.d.ts +0 -0
  119. /package/dist/types/{src/utils → utils}/eventEmitter.d.ts +0 -0
  120. /package/dist/types/{src/utils → utils}/validation.d.ts +0 -0
  121. /package/dist/{src/utils → utils}/errorHandler.js +0 -0
  122. /package/dist/{src/utils → utils}/eventEmitter.js +0 -0
  123. /package/dist/{src/utils → utils}/validation.js +0 -0
@@ -1,135 +0,0 @@
1
- "use strict";
2
- /**
3
- * SHIP-00: Decentralized Identity & Authentication Interface
4
- *
5
- * @title ISHIP_00 - Identity Foundation
6
- * @notice Base interface for decentralized identity in Shogun ecosystem
7
- *
8
- * ## Abstract
9
- *
10
- * This standard defines the foundational interface for identity that enables:
11
- * - Username/password authentication with deterministic key generation
12
- * - SEA key pair management (export, import, backup)
13
- * - Public key publication and discovery on GunDB
14
- * - User registry and lookup system
15
- * - Blockchain address derivation (Ethereum, Bitcoin, etc.)
16
- *
17
- * ## Specification
18
- *
19
- * Based on:
20
- * - GunDB for P2P identity storage
21
- * - SEA (Security, Encryption, Authorization) for key management
22
- * - Shogun Core DataBase API for authentication
23
- * - BIP32-like derivation for blockchain addresses
24
- *
25
- * ## Usage
26
- *
27
- * SHIP-00 serves as the foundation for all other SHIPs:
28
- * - SHIP-01 (Messaging) depends on SHIP-00 for identity
29
- * - SHIP-02 (Address Derivation) extends SHIP-00
30
- * - SHIP-03 (Multi-Modal Auth) extends SHIP-00
31
- * - SHIP-04 (File Storage) uses SHIP-00 for ACL
32
- */
33
- Object.defineProperty(exports, "__esModule", { value: true });
34
- // ============================================================================
35
- // IMPLEMENTATION EXAMPLE
36
- // ============================================================================
37
- /**
38
- * Example of how to implement ISHIP_00
39
- *
40
- * ```typescript
41
- * import { ShogunCore } from 'shogun-core';
42
- * import { ISHIP_00, SEAPair, AuthResult, SignupResult } from './interfaces/ISHIP_00';
43
- *
44
- * class IdentityManager implements ISHIP_00 {
45
- * private shogun: ShogunCore;
46
- *
47
- * constructor(config: IdentityConfig) {
48
- * this.shogun = new ShogunCore({
49
- * gunOptions: {
50
- * peers: config.peers,
51
- * radisk: config.radisk,
52
- * localStorage: config.localStorage
53
- * },
54
- * scope: config.scope
55
- * });
56
- * }
57
- *
58
- * async signup(username: string, password: string): Promise<SignupResult> {
59
- * // Use Shogun Core signUp method
60
- * const result = await this.shogun.signUp(username, password);
61
- *
62
- * if (result.success) {
63
- * // Publish public key
64
- * await this.publishPublicKey();
65
- *
66
- * // Derive Ethereum address
67
- * const derivedAddress = await this.deriveEthereumAddress(result.userPub);
68
- *
69
- * return {
70
- * success: true,
71
- * userPub: result.userPub,
72
- * username: username,
73
- * derivedAddress: derivedAddress
74
- * };
75
- * }
76
- *
77
- * return {
78
- * success: false,
79
- * error: result.error || 'Signup failed'
80
- * };
81
- * }
82
- *
83
- * async login(username: string, password: string): Promise<AuthResult> {
84
- * // Use Shogun Core login method
85
- * const result = await this.shogun.login(username, password);
86
- *
87
- * if (result.success) {
88
- * const derivedAddress = await this.deriveEthereumAddress(result.userPub);
89
- *
90
- * return {
91
- * success: true,
92
- * userPub: result.userPub,
93
- * username: username,
94
- * derivedAddress: derivedAddress
95
- * };
96
- * }
97
- *
98
- * return {
99
- * success: false,
100
- * error: result.error || 'Login failed'
101
- * };
102
- * }
103
- *
104
- * exportKeyPair(): SEAPair | null {
105
- * if (!this.isLoggedIn()) return null;
106
- *
107
- * const seaPair = (this.shogun.db.gun.user() as any)?._?.sea;
108
- * if (!seaPair) return null;
109
- *
110
- * return {
111
- * pub: seaPair.pub,
112
- * priv: seaPair.priv,
113
- * epub: seaPair.epub,
114
- * epriv: seaPair.epriv
115
- * };
116
- * }
117
- *
118
- * async getUserByAlias(username: string): Promise<UserData | null> {
119
- * // Use Shogun Core getUserByAlias method
120
- * return await this.shogun.db.getUserByAlias(username);
121
- * }
122
- *
123
- * async deriveEthereumAddress(publicKey?: string): Promise<string> {
124
- * // Use shogun-derive package
125
- * const derived = await derive(seaPair.priv, null, {
126
- * includeSecp256k1Ethereum: true
127
- * });
128
- *
129
- * return derived.secp256k1Ethereum.address;
130
- * }
131
- *
132
- * // ... implement other methods
133
- * }
134
- * ```
135
- */
@@ -1,128 +0,0 @@
1
- "use strict";
2
- /**
3
- * Shogun Messaging Protocol Interface
4
- *
5
- * @title ISHIP_01 - Decentralized Encrypted Messaging
6
- * @notice Interface for decentralized encrypted messaging on GunDB
7
- * @dev This interface depends on ISHIP_00 for identity and authentication
8
- *
9
- * ## Abstract
10
- *
11
- * This standard defines an interface for decentralized messaging that allows:
12
- * - End-to-end encrypted message sending (ECDH)
13
- * - Real-time message reception
14
- * - Decentralized message history
15
- *
16
- * ## Dependencies
17
- *
18
- * - ISHIP_00: Identity and authentication layer
19
- * - GunDB: P2P storage
20
- * - SEA: Cryptography (ECDH + AES-GCM)
21
- *
22
- * ## Specification
23
- *
24
- * Based on:
25
- * - SHIP-00 for identity management
26
- * - GunDB for P2P storage
27
- * - SEA (Security, Encryption, Authorization) for cryptography
28
- * - ECDH (Elliptic Curve Diffie-Hellman) for key agreement
29
- */
30
- Object.defineProperty(exports, "__esModule", { value: true });
31
- // ============================================================================
32
- // IMPLEMENTATION EXAMPLE
33
- // ============================================================================
34
- /**
35
- * Example of how to implement ISHIP_01 with ISHIP_00 dependency
36
- *
37
- * ```typescript
38
- * import { ISHIP_00 } from './ISHIP_00';
39
- * import { ISHIP_01, DecryptedMessage, SendMessageResult } from './ISHIP_01';
40
- *
41
- * class SecureMessagingApp implements ISHIP_01 {
42
- * constructor(private identity: ISHIP_00) {
43
- * // Verify identity is authenticated
44
- * if (!identity.isLoggedIn()) {
45
- * throw new Error('User must be authenticated');
46
- * }
47
- * }
48
- *
49
- * getIdentity(): ISHIP_00 {
50
- * return this.identity;
51
- * }
52
- *
53
- * async sendMessage(recipientUsername: string, message: string): Promise<SendMessageResult> {
54
- * // 1. Get recipient's public key from identity provider
55
- * const recipientKey = await this.identity.getPublicKey(recipientUsername);
56
- * if (!recipientKey) {
57
- * return { success: false, error: 'Recipient not found' };
58
- * }
59
- *
60
- * // 2. Get sender's key pair from identity provider
61
- * const senderPair = this.identity.getKeyPair();
62
- * if (!senderPair) {
63
- * return { success: false, error: 'Not authenticated' };
64
- * }
65
- *
66
- * // 3. Encrypt with ECDH
67
- * const encrypted = await crypto.encFor(
68
- * message,
69
- * senderPair,
70
- * { epub: recipientKey.epub }
71
- * );
72
- *
73
- * // 4. Save to GunDB
74
- * const messageId = generateId();
75
- * await gun.get('messages').get(messageId).put({
76
- * content: encrypted,
77
- * from: senderPair.pub,
78
- * to: recipientUsername,
79
- * timestamp: Date.now().toString()
80
- * });
81
- *
82
- * return { success: true, messageId };
83
- * }
84
- *
85
- * async listenForMessages(onMessage: (message: DecryptedMessage) => void): Promise<void> {
86
- * const currentUser = this.identity.getCurrentUser();
87
- * if (!currentUser) {
88
- * throw new Error('Not authenticated');
89
- * }
90
- *
91
- * gun.get('messages').map().on(async (data, key) => {
92
- * if (data && data.to === currentUser.alias) {
93
- * // Decrypt message
94
- * const senderKey = await this.identity.getPublicKey(data.from);
95
- * const receiverPair = this.identity.getKeyPair();
96
- *
97
- * if (senderKey && receiverPair) {
98
- * const decrypted = await crypto.decFrom(
99
- * data.content,
100
- * { epub: senderKey.epub },
101
- * receiverPair
102
- * );
103
- *
104
- * onMessage({
105
- * from: data.from,
106
- * content: decrypted,
107
- * timestamp: parseInt(data.timestamp)
108
- * });
109
- * }
110
- * }
111
- * });
112
- * }
113
- *
114
- * async getMessageHistory(withUsername: string): Promise<MessageHistoryEntry[]> {
115
- * // Implementation here
116
- * return [];
117
- * }
118
- * }
119
- *
120
- * // Usage
121
- * const identity = new SHIP_00(config);
122
- * await identity.login('alice', 'password123');
123
- * await identity.publishPublicKey();
124
- *
125
- * const messaging = new SecureMessagingApp(identity);
126
- * await messaging.sendMessage('bob', 'Hello Bob!');
127
- * ```
128
- */
@@ -1,57 +0,0 @@
1
- "use strict";
2
- /**
3
- * SHIP-02: Ethereum Address Derivation Interface
4
- *
5
- * @title ISHIP_02 - Deterministic Address Derivation
6
- * @notice Interface for deriving Ethereum addresses from SHIP-00 identity
7
- *
8
- * ## Abstract
9
- *
10
- * This standard extends SHIP-00 to enable:
11
- * - Deterministic Ethereum address derivation from identity keys
12
- * - BIP-32/BIP-44 hierarchical deterministic (HD) wallet support
13
- * - Stealth address generation for enhanced privacy
14
- * - Multiple address management from single identity
15
- * - Transaction signing with derived keys
16
- *
17
- * ## Specification
18
- *
19
- * Based on:
20
- * - SHIP-00 for identity foundation
21
- * - BIP-32 for hierarchical deterministic wallets
22
- * - BIP-44 for multi-account hierarchy
23
- * - Ethers.js for Ethereum operations
24
- * - ECDH for stealth address generation
25
- *
26
- * ## Dependencies
27
- *
28
- * - SHIP-00: Identity and authentication foundation
29
- * - ethers: Ethereum wallet and signing operations
30
- *
31
- * ## Usage
32
- *
33
- * SHIP-02 enables wallet functionality on top of SHIP-00 identity:
34
- * ```typescript
35
- * const identity = new SHIP_00({ gunOptions: { peers: ['...'] } });
36
- * await identity.login('alice', 'password123');
37
- *
38
- * const addressDerivation = new SHIP_02(identity);
39
- * await addressDerivation.initialize();
40
- *
41
- * const ethAddress = await addressDerivation.deriveEthereumAddress();
42
- * ```
43
- */
44
- Object.defineProperty(exports, "__esModule", { value: true });
45
- exports.SHIP_02_EventType = void 0;
46
- /**
47
- * @notice Event types for SHIP-02 wallet operations
48
- */
49
- var SHIP_02_EventType;
50
- (function (SHIP_02_EventType) {
51
- SHIP_02_EventType["WALLET_CREATED"] = "walletCreated";
52
- SHIP_02_EventType["ADDRESS_DERIVED"] = "addressDerived";
53
- SHIP_02_EventType["TRANSACTION_SIGNED"] = "transactionSigned";
54
- SHIP_02_EventType["MNEMONIC_GENERATED"] = "mnemonicGenerated";
55
- SHIP_02_EventType["SYNC_COMPLETED"] = "syncCompleted";
56
- SHIP_02_EventType["ERROR"] = "error";
57
- })(SHIP_02_EventType || (exports.SHIP_02_EventType = SHIP_02_EventType = {}));
@@ -1,61 +0,0 @@
1
- "use strict";
2
- /**
3
- * SHIP-03: Dual-Key Stealth Address Interface
4
- *
5
- * @title ISHIP_03 - Privacy-Preserving Stealth Addresses
6
- * @notice Interface for ERC-5564 compatible stealth addresses
7
- *
8
- * ## Abstract
9
- *
10
- * This standard extends SHIP-00 and SHIP-02 to enable:
11
- * - Dual-key stealth addresses (viewing + spending keys)
12
- * - ERC-5564 / Fluidkey compatibility
13
- * - Enhanced transaction privacy
14
- * - Stealth address scanning and opening
15
- * - Deterministic key derivation from SHIP-00 identity
16
- *
17
- * ## Specification
18
- *
19
- * Based on:
20
- * - SHIP-00 for identity foundation
21
- * - SHIP-02 for Ethereum address derivation
22
- * - ERC-5564 for stealth address standard
23
- * - Fluidkey Stealth Account Kit
24
- * - ECDH for shared secret derivation
25
- *
26
- * ## Key Concepts
27
- *
28
- * **Viewing Key**: Used to scan blockchain for incoming stealth payments
29
- * **Spending Key**: Used to spend funds received at stealth addresses
30
- * **Ephemeral Key**: One-time key used by sender to generate stealth address
31
- *
32
- * ## Dependencies
33
- *
34
- * - SHIP-00: Identity and authentication foundation
35
- * - SHIP-02: Ethereum wallet operations
36
- * - @fluidkey/stealth-account-kit: ERC-5564 implementation
37
- * - ethers: Ethereum operations
38
- *
39
- * ## Usage
40
- *
41
- * ```typescript
42
- * const identity = new SHIP_00({ gunOptions: { peers: ['...'] } });
43
- * await identity.login('alice', 'password123');
44
- *
45
- * const eth = new SHIP_02(identity);
46
- * await eth.initialize();
47
- *
48
- * const stealth = new SHIP_03(identity, eth);
49
- * await stealth.initialize();
50
- *
51
- * // Get stealth keys (derived from SHIP-00 identity)
52
- * const keys = await stealth.getStealthKeys();
53
- *
54
- * // Generate stealth address for recipient
55
- * const stealthAddr = await stealth.generateStealthAddress(
56
- * recipientViewingKey,
57
- * recipientSpendingKey
58
- * );
59
- * ```
60
- */
61
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,37 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Shogun Chat - CLI Interface
4
- *
5
- * End-to-end encrypted decentralized chat
6
- * Simple and functional CLI interface
7
- */
8
- export declare class MessengerCLI {
9
- private identity;
10
- private messaging;
11
- private rl;
12
- private currentUser;
13
- private recipient;
14
- private derivedAddress;
15
- private isAuthenticated;
16
- private channelToken;
17
- private currentChannel;
18
- constructor();
19
- private setupHandlers;
20
- private withTimeout;
21
- login(username: string, password: string): Promise<boolean>;
22
- private sendMessage;
23
- private onMessageReceived;
24
- private onChannelMessageReceived;
25
- private exportKeyPair;
26
- private importKeyPair;
27
- private loginWithPair;
28
- private wipeAllMessages;
29
- private handleCommand;
30
- private joinChannel;
31
- private leaveChannel;
32
- private showHelp;
33
- private showStatus;
34
- private showHeader;
35
- private updatePrompt;
36
- start(): Promise<void>;
37
- }
@@ -1,131 +0,0 @@
1
- /**
2
- * SHIP-02 Example: Ethereum Wallet CLI
3
- *
4
- * Interactive CLI demonstrating SHIP-02 HD wallet derivation
5
- * Built on top of SHIP-00 identity
6
- *
7
- * Usage:
8
- * yarn wallet <username> <password>
9
- *
10
- * Features:
11
- * - Derive Ethereum addresses from identity (no mnemonics!)
12
- * - BIP-44 HD wallet support
13
- * - Sign transactions and messages
14
- * - Export/import address book
15
- * - Gun persistence
16
- *
17
- * Note: For stealth addresses, use `yarn stealth` (SHIP-03)
18
- */
19
- declare class WalletCLI {
20
- private identity;
21
- private wallet;
22
- private rl;
23
- private username;
24
- private running;
25
- constructor(username: string, password: string);
26
- /**
27
- * Start the CLI
28
- */
29
- start(password: string): Promise<void>;
30
- /**
31
- * Authenticate user with SHIP-00
32
- */
33
- private authenticate;
34
- /**
35
- * Initialize SHIP-02 wallet
36
- */
37
- private initializeWallet;
38
- /**
39
- * Main menu loop
40
- */
41
- private mainMenu;
42
- /**
43
- * View all addresses
44
- */
45
- private viewAddresses;
46
- /**
47
- * Derive new address with custom index
48
- */
49
- private deriveNewAddress;
50
- /**
51
- * Derive BIP-44 address with custom parameters
52
- */
53
- private deriveBIP44Address;
54
- /**
55
- * Derive multiple addresses at once
56
- */
57
- private deriveMultipleAddresses;
58
- /**
59
- * Import address book
60
- */
61
- private importAddressBook;
62
- /**
63
- * Export encrypted wallet data
64
- */
65
- private exportWalletData;
66
- /**
67
- * Sync with Gun database
68
- */
69
- private syncWithGun;
70
- /**
71
- * View/Export mnemonic
72
- */
73
- private viewExportMnemonic;
74
- /**
75
- * Verify addresses match MetaMask
76
- */
77
- private verifyMetaMaskAddresses;
78
- /**
79
- * Sign message
80
- */
81
- private signMessage;
82
- /**
83
- * Sign transaction
84
- */
85
- private signTransaction;
86
- /**
87
- * Export address book
88
- */
89
- private exportAddressBook;
90
- /**
91
- * View master public key
92
- */
93
- private viewMasterPublicKey;
94
- /**
95
- * Create wallet using frontend API
96
- */
97
- private createWalletFrontendAPI;
98
- /**
99
- * Load all wallets using frontend API
100
- */
101
- private loadAllWallets;
102
- /**
103
- * View main wallet (derived from Gun keys)
104
- */
105
- private viewMainWallet;
106
- /**
107
- * Export all user data (complete backup)
108
- */
109
- private exportAllUserData;
110
- /**
111
- * Set RPC provider URL
112
- */
113
- private setRpcProvider;
114
- /**
115
- * Send transaction via RPC
116
- */
117
- private sendTransactionRPC;
118
- /**
119
- * Print header
120
- */
121
- private printHeader;
122
- /**
123
- * Prompt user for input
124
- */
125
- private prompt;
126
- /**
127
- * Cleanup and exit
128
- */
129
- private cleanup;
130
- }
131
- export { WalletCLI };
@@ -1,113 +0,0 @@
1
- /**
2
- * SHIP-00: Decentralized Identity & Authentication Implementation
3
- *
4
- * Foundation layer for the Shogun ecosystem.
5
- * Provides identity and authentication services for all other SHIPs.
6
- *
7
- * Based on:
8
- * - Shogun Core API (see ../API.md)
9
- * - GunDB for P2P identity storage
10
- * - SEA for cryptographic operations
11
- * - shogun-derive for address derivation
12
- *
13
- * Features:
14
- * ✅ Username/password authentication
15
- * ✅ SEA key pair management
16
- * ✅ Public key publication and discovery
17
- * ✅ User registry and lookup
18
- * ✅ Blockchain address derivation
19
- * ✅ Multi-device support (export/import)
20
- */
21
- import type { ISHIP_00, SignupResult, AuthResult, OperationResult, SEAPair, UserIdentity, UserData, PublicKeyData } from "../interfaces/ISHIP_00";
22
- import { ShogunCoreConfig } from "../../src/interfaces/shogun";
23
- /**
24
- * SHIP-00 Reference Implementation
25
- *
26
- * Uses Shogun Core as the underlying implementation.
27
- * This class wraps Shogun Core APIs to provide the ISHIP_00 standard interface.
28
- */
29
- declare class SHIP_00 implements ISHIP_00 {
30
- private shogun;
31
- static readonly NODES: {
32
- readonly USERS: "users";
33
- readonly PUBLIC_KEYS: "publicKeys";
34
- readonly REGISTRY: "registry";
35
- };
36
- constructor(shogunConfig: ShogunCoreConfig);
37
- /**
38
- * Register new user
39
- * Uses Shogun Core signUp method (see API.md)
40
- */
41
- signup(username: string, password: string): Promise<SignupResult>;
42
- /**
43
- * Login with username and password
44
- * Uses Shogun Core login method (see API.md)
45
- */
46
- login(username: string, password: string): Promise<AuthResult>;
47
- /**
48
- * Login with SEA Key Pair
49
- * Uses Shogun Core loginWithPair method (see API.md)
50
- */
51
- loginWithPair(seaPair: SEAPair): Promise<AuthResult>;
52
- /**
53
- * Logout
54
- * Uses Shogun Core logout method (see API.md line 325)
55
- */
56
- logout(): void;
57
- /**
58
- * Check if user is logged in
59
- * Uses Shogun Core isLoggedIn method (see API.md line 326)
60
- */
61
- isLoggedIn(): boolean;
62
- /**
63
- * Get underlying ShogunCore instance
64
- * Provides access to Gun, SEA, and crypto utilities
65
- */
66
- getShogun(): any;
67
- /**
68
- * Publish public key on GunDB
69
- * Makes user's public key discoverable by others
70
- */
71
- publishPublicKey(): Promise<OperationResult>;
72
- /**
73
- * Export current user's SEA key pair
74
- * For backup and multi-device usage
75
- * Uses Shogun Core exportPair method (see API.md line 354)
76
- */
77
- exportKeyPair(): SEAPair | null;
78
- /**
79
- * Get current user's key pair
80
- * Alias for exportKeyPair()
81
- */
82
- getKeyPair(): SEAPair | null;
83
- /**
84
- * Get user information by username
85
- * Uses Shogun Core getUserByAlias method (see API.md line 1141-1148)
86
- */
87
- getUserByAlias(username: string): Promise<UserData | null>;
88
- /**
89
- * Get user information by public key
90
- * Uses Shogun Core getUserDataByPub method (see API.md line 1150-1152)
91
- */
92
- getUserByPub(userPub: string): Promise<UserData | null>;
93
- /**
94
- * Check if user exists
95
- * Uses SimpleGunAPI userExists method (see API.md line 188)
96
- */
97
- userExists(username: string): Promise<boolean>;
98
- /**
99
- * Get public key by username
100
- */
101
- getPublicKey(username: string): Promise<PublicKeyData | null>;
102
- /**
103
- * Get current authenticated user info
104
- * Uses Shogun Core getCurrentUser method (see API.md line 429)
105
- */
106
- getCurrentUser(): UserIdentity | null;
107
- /**
108
- * Derive Ethereum address from SEA keypair
109
- * Uses shogun-derive package for deterministic derivation
110
- */
111
- deriveEthereumAddress(publicKey?: string): Promise<string>;
112
- }
113
- export { SHIP_00 };