shogun-core 3.3.0 → 3.3.2

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 (36) hide show
  1. package/dist/browser/shogun-core.js +83301 -148719
  2. package/dist/browser/shogun-core.js.map +1 -1
  3. package/dist/ship/examples/ephemeral-cli.js +234 -0
  4. package/dist/ship/examples/identity-cli.js +503 -0
  5. package/dist/ship/examples/stealth-cli.js +433 -0
  6. package/dist/ship/examples/storage-cli.js +615 -0
  7. package/dist/ship/examples/vault-cli.js +444 -0
  8. package/dist/ship/implementation/SHIP_04.js +589 -0
  9. package/dist/ship/implementation/SHIP_05.js +1064 -0
  10. package/dist/ship/implementation/SHIP_06.js +350 -0
  11. package/dist/ship/implementation/SHIP_07.js +635 -0
  12. package/dist/ship/index.js +17 -0
  13. package/dist/ship/interfaces/ISHIP_04.js +62 -0
  14. package/dist/ship/interfaces/ISHIP_05.js +59 -0
  15. package/dist/ship/interfaces/ISHIP_06.js +144 -0
  16. package/dist/ship/interfaces/ISHIP_07.js +194 -0
  17. package/dist/src/index.js +1 -15
  18. package/dist/types/ship/examples/ephemeral-cli.d.ts +13 -0
  19. package/dist/types/ship/examples/identity-cli.d.ts +40 -0
  20. package/dist/types/ship/examples/stealth-cli.d.ts +31 -0
  21. package/dist/types/ship/examples/storage-cli.d.ts +48 -0
  22. package/dist/types/ship/examples/vault-cli.d.ts +13 -0
  23. package/dist/types/ship/implementation/SHIP_04.d.ts +76 -0
  24. package/dist/types/ship/implementation/SHIP_05.d.ts +70 -0
  25. package/dist/types/ship/implementation/SHIP_06.d.ts +66 -0
  26. package/dist/types/ship/implementation/SHIP_07.d.ts +101 -0
  27. package/dist/types/ship/index.d.ts +14 -0
  28. package/dist/types/ship/interfaces/ISHIP_04.d.ts +245 -0
  29. package/dist/types/ship/interfaces/ISHIP_05.d.ts +234 -0
  30. package/dist/types/ship/interfaces/ISHIP_06.d.ts +370 -0
  31. package/dist/types/ship/interfaces/ISHIP_07.d.ts +522 -0
  32. package/dist/types/src/index.d.ts +0 -10
  33. package/dist/types/src/types/shogun.d.ts +2 -0
  34. package/package.json +1 -1
  35. package/dist/browser/_e6ae.shogun-core.js +0 -14
  36. package/dist/browser/_e6ae.shogun-core.js.map +0 -1
@@ -0,0 +1,76 @@
1
+ /**
2
+ * SHIP-04: Multi-Modal Authentication Implementation
3
+ *
4
+ * Extends SHIP-00 to provide alternative authentication methods.
5
+ * Integrates existing Shogun Core plugins for OAuth, WebAuthn, Nostr, and Web3.
6
+ *
7
+ * Based on:
8
+ * - SHIP-00 for identity foundation
9
+ * - Shogun Core Plugins (OAuth, WebAuthn, Nostr, Web3)
10
+ * - External OAuth providers (Google, GitHub, etc.)
11
+ * - WebAuthn API for biometric auth
12
+ * - Nostr protocol for decentralized social
13
+ * - Web3 providers (MetaMask, WalletConnect)
14
+ *
15
+ * Features:
16
+ * ✅ OAuth authentication (Google, GitHub, Discord, etc.)
17
+ * ✅ WebAuthn/Passkeys (biometric, hardware keys)
18
+ * ✅ Nostr protocol integration
19
+ * ✅ Web3 wallet connection (MetaMask, etc.)
20
+ * ✅ SHIP-00 compatible (all methods return SEA keypair)
21
+ * ✅ Plugin-based architecture (modular)
22
+ *
23
+ * Inclusive Hierarchy:
24
+ * SHIP-04 → depends on → SHIP-00 ✅
25
+ */
26
+ import type { ISHIP_00 } from "../interfaces/ISHIP_00";
27
+ import type { ISHIP_04, OAuthProvider, OAuthAuthResult, WebAuthnAuthResult, NostrAuthResult, Web3AuthResult, AuthMethodInfo, SHIP_04_Config } from "../interfaces/ISHIP_04";
28
+ import { AuthMethod } from "../interfaces/ISHIP_04";
29
+ /**
30
+ * SHIP-04 Reference Implementation
31
+ *
32
+ * Provides multiple authentication methods on top of SHIP-00.
33
+ * All authentication methods are converted to SHIP-00 compatible format.
34
+ */
35
+ declare class SHIP_04 implements ISHIP_04 {
36
+ private identity;
37
+ private config;
38
+ private initialized;
39
+ static readonly NODES: {
40
+ readonly AUTH_METHOD: "current_auth_method";
41
+ };
42
+ private oauthPlugin;
43
+ private webauthnPlugin;
44
+ private nostrPlugin;
45
+ private web3Plugin;
46
+ private currentAuthMethod;
47
+ constructor(identity: ISHIP_00, config?: SHIP_04_Config);
48
+ initialize(): Promise<void>;
49
+ isInitialized(): boolean;
50
+ getIdentity(): ISHIP_00;
51
+ loginWithOAuth(provider: OAuthProvider, redirectUri?: string): Promise<OAuthAuthResult>;
52
+ handleOAuthCallback(code: string, provider: OAuthProvider): Promise<OAuthAuthResult>;
53
+ isOAuthAvailable(provider?: OAuthProvider): boolean;
54
+ registerWithWebAuthn(username: string): Promise<WebAuthnAuthResult>;
55
+ loginWithWebAuthn(username: string): Promise<WebAuthnAuthResult>;
56
+ isWebAuthnAvailable(): boolean;
57
+ connectNostr(): Promise<NostrAuthResult>;
58
+ loginWithNostr(): Promise<NostrAuthResult>;
59
+ isNostrAvailable(): boolean;
60
+ connectWeb3(): Promise<Web3AuthResult>;
61
+ loginWithWeb3(message?: string): Promise<Web3AuthResult>;
62
+ isWeb3Available(): boolean;
63
+ getAvailableAuthMethods(): AuthMethodInfo[];
64
+ getCurrentAuthMethod(): AuthMethod | null;
65
+ clearAuth(): Promise<void>;
66
+ /**
67
+ * Save current auth method to Gun (optional persistence)
68
+ */
69
+ private saveAuthMethod;
70
+ /**
71
+ * Load last used auth method from Gun
72
+ */
73
+ loadAuthMethod(): Promise<AuthMethod | null>;
74
+ private ensureInitialized;
75
+ }
76
+ export { SHIP_04 };
@@ -0,0 +1,70 @@
1
+ /**
2
+ * SHIP-05: Decentralized File Storage Implementation
3
+ *
4
+ * Simple encrypted file storage on IPFS.
5
+ * Extends SHIP-00 to provide encrypted file storage capabilities.
6
+ *
7
+ * Based on:
8
+ * - SHIP-00 for identity foundation
9
+ * - IPFS for decentralized file storage
10
+ * - shogun-ipfs for IPFS operations
11
+ * - Deterministic encryption from wallet signatures
12
+ *
13
+ * Features:
14
+ * ✅ Encrypted file upload with wallet signature
15
+ * ✅ Deterministic encryption keys from wallet
16
+ * ✅ IPFS storage (Pinata, IPFS node, or custom)
17
+ * ✅ File metadata on GunDB
18
+ * ✅ File download and decryption
19
+ */
20
+ import type { ISHIP_00 } from "../interfaces/ISHIP_00";
21
+ import type { ISHIP_05, UploadResult, FileMetadata, UploadOptions, DownloadOptions, EncryptionOptions, SHIP_05_Config } from "../interfaces/ISHIP_05";
22
+ /**
23
+ * SHIP-05 Reference Implementation
24
+ *
25
+ * Provides encrypted file storage on IPFS.
26
+ * All encryption is deterministic based on wallet signatures.
27
+ */
28
+ declare class SHIP_05 implements ISHIP_05 {
29
+ private identity;
30
+ private config;
31
+ private initialized;
32
+ static readonly NODES: {
33
+ readonly USER_FILES: "user_files";
34
+ };
35
+ private ipfsStorage;
36
+ private fileCache;
37
+ constructor(identity: ISHIP_00, config?: SHIP_05_Config);
38
+ initialize(options?: SHIP_05_Config): Promise<void>;
39
+ isInitialized(): boolean;
40
+ getIdentity(): ISHIP_00;
41
+ uploadFile(file: File | Buffer, options?: UploadOptions): Promise<UploadResult>;
42
+ uploadJson(data: any, options?: UploadOptions): Promise<UploadResult>;
43
+ downloadFile(hash: string, options?: DownloadOptions): Promise<string | Blob>;
44
+ getFileMetadata(hash: string): Promise<FileMetadata | null>;
45
+ deleteFile(hash: string): Promise<{
46
+ success: boolean;
47
+ error?: string;
48
+ }>;
49
+ getUserFiles(): Promise<FileMetadata[]>;
50
+ encryptData(data: string | Buffer, options?: EncryptionOptions): Promise<string>;
51
+ decryptData(encryptedData: string, options?: EncryptionOptions): Promise<string>;
52
+ isFileAccessible(hash: string): Promise<boolean>;
53
+ getStorageStats(): Promise<{
54
+ totalFiles: number;
55
+ totalMB: number;
56
+ encryptedFiles: number;
57
+ plainFiles: number;
58
+ }>;
59
+ private ensureInitialized;
60
+ private initializeIPFS;
61
+ private uploadToIPFS;
62
+ private uploadToIPFSFallback;
63
+ private unpinFromIPFS;
64
+ private downloadFromIPFS;
65
+ private saveFileMetadata;
66
+ private removeFileMetadata;
67
+ private getUserFilesFromGun;
68
+ private fileToBase64;
69
+ }
70
+ export { SHIP_05 };
@@ -0,0 +1,66 @@
1
+ /**
2
+ * SHIP-06: Ephemeral P2P Messaging Implementation
3
+ *
4
+ * Two modes:
5
+ * 1. Standalone: new SHIP_06(gunPeers[], roomId) - NO authentication!
6
+ * - Uses ShogunCore internally with silent: true, disableAutoRecall: true
7
+ * - Zero logs, zero storage, pure relay communication
8
+ * - Room hashed with Web Crypto API SHA-256 for deterministic IDs
9
+ *
10
+ * 2. With Identity: new SHIP_06(ISHIP_00, roomId) - Authenticated sessions
11
+ * - Uses existing Gun instance from SHIP-00
12
+ * - All ShogunCore features available
13
+ *
14
+ * Architecture:
15
+ * - Gun Relay for P2P communication (no WebRTC complexity!)
16
+ * - SEA for ephemeral key generation and ECDH encryption
17
+ * - Pure relay mode: radisk: false, localStorage: false, multicast: false
18
+ */
19
+ import type { ISHIP_00 } from "../interfaces/ISHIP_00";
20
+ import type { ISHIP_06, EphemeralMessage, EphemeralConfig, PeerInfo } from "../interfaces/ISHIP_06";
21
+ import type { SEAPair } from "../interfaces/ISHIP_00";
22
+ declare class SHIP_06 implements ISHIP_06 {
23
+ private identity;
24
+ private roomId;
25
+ private config;
26
+ private connected;
27
+ private swarmId;
28
+ private myAddress;
29
+ private myPair;
30
+ private gun;
31
+ private sea;
32
+ private roomNode;
33
+ private presenceNode;
34
+ private messagesNode;
35
+ private peers;
36
+ private messageHandlers;
37
+ private encryptedMessageHandlers;
38
+ private peerSeenHandlers;
39
+ private peerLeftHandlers;
40
+ private heartbeatInterval;
41
+ private processedMessages;
42
+ constructor(identityOrPeers: ISHIP_00 | string[], roomId: string, config?: Partial<EphemeralConfig> | {
43
+ debug?: boolean;
44
+ });
45
+ getIdentity(): ISHIP_00;
46
+ connect(): Promise<void>;
47
+ disconnect(): void;
48
+ isConnected(): boolean;
49
+ getSwarmId(): string;
50
+ getAddress(): string;
51
+ private announcePresence;
52
+ private startHeartbeat;
53
+ private listenForPeers;
54
+ sendBroadcast(message: string): Promise<void>;
55
+ sendDirect(peerAddress: string, message: string): Promise<void>;
56
+ private listenForMessages;
57
+ onMessage(callback: (message: EphemeralMessage) => void): void;
58
+ onPeerSeen(callback: (address: string) => void): void;
59
+ onPeerLeft(callback: (address: string) => void): void;
60
+ onEncryptedMessage(callback: (address: string, data: any) => void): void;
61
+ getPeers(): string[];
62
+ getPeerInfo(address: string): PeerInfo | null;
63
+ getEphemeralPair(): Promise<SEAPair>;
64
+ setEphemeralPair(pair: SEAPair): Promise<void>;
65
+ }
66
+ export { SHIP_06 };
@@ -0,0 +1,101 @@
1
+ /**
2
+ * SHIP-07: Secure Vault Implementation
3
+ *
4
+ * Vault crittografato decentralizzato che dipende da SHIP-00 per l'identità.
5
+ *
6
+ * Dipendenze:
7
+ * - SHIP-00 (Identity & Authentication) - per gestione utenti e chiavi
8
+ * - GunDB - per storage decentralizzato P2P
9
+ * - SEA - per crittografia AES-256-GCM
10
+ *
11
+ * Ispirato a: https://github.com/draeder/gunsafe
12
+ */
13
+ import type { ISHIP_00 } from "../interfaces/ISHIP_00";
14
+ import type { ISHIP_07, VaultRecord, VaultResult, VaultStats, RecordMetadata, GetOptions, ListOptions, ImportOptions, ExportOptions } from "../interfaces/ISHIP_07";
15
+ /**
16
+ * SHIP-07 Reference Implementation
17
+ *
18
+ * Questa implementazione dipende da ISHIP_00 per tutte le operazioni di identità.
19
+ * Si concentra esclusivamente sulla logica del vault crittografato.
20
+ */
21
+ declare class SHIP_07 implements ISHIP_07 {
22
+ private identity;
23
+ private initialized;
24
+ private vaultNodeName;
25
+ private vaultNode;
26
+ private recordsNode;
27
+ private metadataNode;
28
+ private static readonly VAULT_VERSION;
29
+ private static readonly DEFAULT_NODE_NAME;
30
+ /**
31
+ * Constructor
32
+ * @param identity ISHIP_00 instance for identity operations
33
+ * @param vaultNodeName Optional custom vault node name
34
+ */
35
+ constructor(identity: ISHIP_00, vaultNodeName?: string);
36
+ /**
37
+ * Get identity provider
38
+ */
39
+ getIdentity(): ISHIP_00;
40
+ /**
41
+ * Initialize vault
42
+ */
43
+ initialize(): Promise<void>;
44
+ /**
45
+ * Check if vault is initialized
46
+ */
47
+ isInitialized(): boolean;
48
+ /**
49
+ * Store encrypted record in vault
50
+ */
51
+ put(name: string, data: any, metadata?: RecordMetadata): Promise<VaultResult>;
52
+ /**
53
+ * Retrieve and decrypt record from vault
54
+ */
55
+ get(name: string, options?: GetOptions): Promise<VaultRecord | null>;
56
+ /**
57
+ * Delete record from vault (soft delete)
58
+ */
59
+ delete(name?: string): Promise<VaultResult>;
60
+ /**
61
+ * List all record names in vault
62
+ */
63
+ list(options?: ListOptions): Promise<string[]>;
64
+ /**
65
+ * Check if record exists
66
+ */
67
+ exists(name: string): Promise<boolean>;
68
+ /**
69
+ * Update existing record
70
+ */
71
+ update(name: string, data: any): Promise<VaultResult>;
72
+ /**
73
+ * Export entire vault (encrypted)
74
+ */
75
+ export(password?: string, options?: ExportOptions): Promise<string>;
76
+ /**
77
+ * Import vault from backup
78
+ */
79
+ import(backupData: string, password?: string, options?: ImportOptions): Promise<VaultResult>;
80
+ /**
81
+ * Get vault statistics
82
+ */
83
+ getStats(): Promise<VaultStats>;
84
+ /**
85
+ * Clear all records (soft delete all)
86
+ */
87
+ clear(): Promise<VaultResult>;
88
+ /**
89
+ * Compact vault (remove deleted records permanently)
90
+ */
91
+ compact(): Promise<VaultResult>;
92
+ /**
93
+ * Search records by content
94
+ */
95
+ search(query: string): Promise<string[]>;
96
+ /**
97
+ * Update record count in metadata
98
+ */
99
+ private updateRecordCount;
100
+ }
101
+ export { SHIP_07 };
@@ -0,0 +1,14 @@
1
+ export { SHIP_00 } from "../ship/implementation/SHIP_00";
2
+ export type { ISHIP_00 } from "../ship/interfaces/ISHIP_00";
3
+ export { SHIP_01 } from "../ship/implementation/SHIP_01";
4
+ export type { ISHIP_01 } from "../ship/interfaces/ISHIP_01";
5
+ export { SHIP_02 } from "../ship/implementation/SHIP_02";
6
+ export type { ISHIP_02 } from "../ship/interfaces/ISHIP_02";
7
+ export { SHIP_03 } from "../ship/implementation/SHIP_03";
8
+ export type { ISHIP_03 } from "../ship/interfaces/ISHIP_03";
9
+ export { SHIP_04 } from "../ship/implementation/SHIP_04";
10
+ export type { ISHIP_04 } from "../ship/interfaces/ISHIP_04";
11
+ export { SHIP_05 } from "../ship/implementation/SHIP_05";
12
+ export type { ISHIP_05 } from "../ship/interfaces/ISHIP_05";
13
+ export { SHIP_06 } from "../ship/implementation/SHIP_06";
14
+ export type { ISHIP_06 } from "../ship/interfaces/ISHIP_06";
@@ -0,0 +1,245 @@
1
+ /**
2
+ * SHIP-04: Multi-Modal Authentication Interface
3
+ *
4
+ * @title ISHIP_04 - Alternative Authentication Methods
5
+ * @notice Interface for multi-modal authentication extending SHIP-00
6
+ *
7
+ * ## Abstract
8
+ *
9
+ * This standard extends SHIP-00 to provide multiple authentication methods:
10
+ * - OAuth (Google, GitHub, Discord, etc.)
11
+ * - WebAuthn/Passkeys (biometric authentication)
12
+ * - Nostr (decentralized social protocol)
13
+ * - Web3 (MetaMask, WalletConnect, etc.)
14
+ *
15
+ * ## Dependencies
16
+ *
17
+ * - SHIP-00: Base identity foundation
18
+ * - Shogun Core Plugins: OAuth, WebAuthn, Nostr, Web3
19
+ *
20
+ * ## Inclusive Hierarchy
21
+ *
22
+ * SHIP-04 extends SHIP-00 (✅ allowed):
23
+ * ```
24
+ * SHIP-04 (Multi-Modal Auth)
25
+ * ↓ depends on
26
+ * SHIP-00 (Identity Foundation)
27
+ * ```
28
+ *
29
+ * ## Usage
30
+ *
31
+ * ```typescript
32
+ * const identity = new SHIP_00(config);
33
+ * const multiAuth = new SHIP_04(identity);
34
+ *
35
+ * // Login with OAuth
36
+ * await multiAuth.loginWithOAuth('google');
37
+ *
38
+ * // Or WebAuthn
39
+ * await multiAuth.loginWithWebAuthn('alice');
40
+ *
41
+ * // Result is SHIP-00 compatible!
42
+ * const user = identity.getCurrentUser();
43
+ * ```
44
+ */
45
+ import type { ISHIP_00, AuthResult } from "./ISHIP_00";
46
+ /**
47
+ * Available authentication methods
48
+ * Exported as const enum to allow usage as both type and value
49
+ */
50
+ export declare const enum AuthMethod {
51
+ PASSWORD = "password",// Traditional (SHIP-00)
52
+ OAUTH = "oauth",// OAuth providers
53
+ WEBAUTHN = "webauthn",// Biometric/Passkey
54
+ NOSTR = "nostr",// Nostr protocol
55
+ WEB3 = "web3"
56
+ }
57
+ export type AuthMethodType = "password" | "oauth" | "webauthn" | "nostr" | "web3";
58
+ /**
59
+ * OAuth provider types
60
+ * Note: Must match Shogun Core plugin types
61
+ */
62
+ export type OAuthProvider = "google" | "github" | "discord" | "twitter" | "custom";
63
+ /**
64
+ * OAuth authentication result
65
+ */
66
+ export interface OAuthAuthResult extends AuthResult {
67
+ provider?: OAuthProvider;
68
+ email?: string;
69
+ profilePicture?: string;
70
+ }
71
+ /**
72
+ * WebAuthn authentication result
73
+ */
74
+ export interface WebAuthnAuthResult extends AuthResult {
75
+ credentialId?: string;
76
+ authenticatorType?: string;
77
+ }
78
+ /**
79
+ * Nostr authentication result
80
+ */
81
+ export interface NostrAuthResult extends AuthResult {
82
+ nostrPubkey?: string;
83
+ relays?: string[];
84
+ }
85
+ /**
86
+ * Web3 authentication result
87
+ */
88
+ export interface Web3AuthResult extends AuthResult {
89
+ walletAddress?: string;
90
+ chainId?: number;
91
+ walletType?: string;
92
+ }
93
+ /**
94
+ * Authentication method info
95
+ */
96
+ export interface AuthMethodInfo {
97
+ method: AuthMethod;
98
+ available: boolean;
99
+ configured: boolean;
100
+ lastUsed?: number;
101
+ }
102
+ /**
103
+ * SHIP-04 Configuration
104
+ */
105
+ export interface SHIP_04_Config {
106
+ /** Enable OAuth authentication */
107
+ enableOAuth?: boolean;
108
+ /** OAuth providers configuration */
109
+ oauthProviders?: {
110
+ [key in OAuthProvider]?: {
111
+ clientId: string;
112
+ clientSecret?: string;
113
+ redirectUri: string;
114
+ scopes?: string[];
115
+ };
116
+ };
117
+ /** Enable WebAuthn authentication */
118
+ enableWebAuthn?: boolean;
119
+ /** WebAuthn RP name */
120
+ webAuthnRpName?: string;
121
+ /** WebAuthn RP ID */
122
+ webAuthnRpId?: string;
123
+ /** Enable Nostr authentication */
124
+ enableNostr?: boolean;
125
+ /** Nostr relays */
126
+ nostrRelays?: string[];
127
+ /** Enable Web3 authentication */
128
+ enableWeb3?: boolean;
129
+ /** Preferred Web3 provider */
130
+ web3Provider?: "metamask" | "walletconnect" | "coinbase";
131
+ }
132
+ /**
133
+ * @title ISHIP_04 - Multi-Modal Authentication
134
+ * @notice Main interface for alternative authentication methods
135
+ * @dev Extends SHIP-00 with OAuth, WebAuthn, Nostr, and Web3 auth
136
+ */
137
+ export interface ISHIP_04 {
138
+ /**
139
+ * @notice Initialize multi-modal auth system
140
+ * @dev Initializes all enabled authentication plugins
141
+ * @returns Promise that resolves when initialization is complete
142
+ */
143
+ initialize(): Promise<void>;
144
+ /**
145
+ * @notice Check if system is initialized
146
+ * @returns True if initialized
147
+ */
148
+ isInitialized(): boolean;
149
+ /**
150
+ * @notice Get the underlying SHIP-00 identity provider
151
+ * @returns SHIP-00 instance
152
+ */
153
+ getIdentity(): ISHIP_00;
154
+ /**
155
+ * @notice Login with OAuth provider
156
+ * @param provider OAuth provider (google, github, etc.)
157
+ * @param redirectUri Optional redirect URI override
158
+ * @returns Promise resolving to OAuth auth result
159
+ */
160
+ loginWithOAuth(provider: OAuthProvider, redirectUri?: string): Promise<OAuthAuthResult>;
161
+ /**
162
+ * @notice Handle OAuth callback after redirect
163
+ * @param code Authorization code from OAuth provider
164
+ * @param provider OAuth provider
165
+ * @returns Promise resolving to auth result
166
+ */
167
+ handleOAuthCallback(code: string, provider: OAuthProvider): Promise<OAuthAuthResult>;
168
+ /**
169
+ * @notice Check if OAuth is available and configured
170
+ * @param provider Optional specific provider to check
171
+ * @returns True if OAuth is available
172
+ */
173
+ isOAuthAvailable(provider?: OAuthProvider): boolean;
174
+ /**
175
+ * @notice Register new user with WebAuthn
176
+ * @param username Username for the account
177
+ * @returns Promise resolving to WebAuthn auth result
178
+ */
179
+ registerWithWebAuthn(username: string): Promise<WebAuthnAuthResult>;
180
+ /**
181
+ * @notice Login with WebAuthn (biometric/passkey)
182
+ * @param username Username to authenticate
183
+ * @returns Promise resolving to WebAuthn auth result
184
+ */
185
+ loginWithWebAuthn(username: string): Promise<WebAuthnAuthResult>;
186
+ /**
187
+ * @notice Check if WebAuthn is supported
188
+ * @returns True if WebAuthn is available
189
+ */
190
+ isWebAuthnAvailable(): boolean;
191
+ /**
192
+ * @notice Connect and authenticate with Nostr
193
+ * @returns Promise resolving to Nostr auth result
194
+ */
195
+ connectNostr(): Promise<NostrAuthResult>;
196
+ /**
197
+ * @notice Login with Nostr extension (nos2x, Alby, etc.)
198
+ * @returns Promise resolving to Nostr auth result
199
+ */
200
+ loginWithNostr(): Promise<NostrAuthResult>;
201
+ /**
202
+ * @notice Check if Nostr is available
203
+ * @returns True if Nostr extension detected
204
+ */
205
+ isNostrAvailable(): boolean;
206
+ /**
207
+ * @notice Connect Web3 wallet (MetaMask, WalletConnect, etc.)
208
+ * @returns Promise resolving to Web3 auth result
209
+ */
210
+ connectWeb3(): Promise<Web3AuthResult>;
211
+ /**
212
+ * @notice Login with Web3 wallet
213
+ * @param message Optional message to sign
214
+ * @returns Promise resolving to Web3 auth result
215
+ */
216
+ loginWithWeb3(message?: string): Promise<Web3AuthResult>;
217
+ /**
218
+ * @notice Check if Web3 is available
219
+ * @returns True if Web3 provider detected
220
+ */
221
+ isWeb3Available(): boolean;
222
+ /**
223
+ * @notice Get all available authentication methods
224
+ * @returns Array of available auth methods with info
225
+ */
226
+ getAvailableAuthMethods(): AuthMethodInfo[];
227
+ /**
228
+ * @notice Get current authentication method
229
+ * @returns Current auth method or null
230
+ */
231
+ getCurrentAuthMethod(): AuthMethod | null;
232
+ /**
233
+ * @notice Clear authentication data
234
+ * @returns Promise that resolves when cleared
235
+ */
236
+ clearAuth(): Promise<void>;
237
+ }
238
+ export type SHIP_04_Events = {
239
+ oauthConnected: (result: OAuthAuthResult) => void;
240
+ webauthnRegistered: (result: WebAuthnAuthResult) => void;
241
+ nostrConnected: (result: NostrAuthResult) => void;
242
+ web3Connected: (result: Web3AuthResult) => void;
243
+ authMethodChanged: (method: AuthMethod) => void;
244
+ error: (error: Error) => void;
245
+ };