Merge feat/logger (#1)

Fixed encoding issue: changed from btoa(String.fromCharCode(...)) to Buffer.from().toString('base64')
Maintains persistent identity through private key storage
Provides better state management and error tracking
Supports connection acceptance/rejection flow
Properly handles node lifecycle events
Can be cleanly shut down with resource cleanup

Co-authored-by: Chris Daßler <chris.dassler@me.com>
Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
2025-09-18 15:25:17 +02:00
parent 7e46005c6f
commit 9122949a6e
2 changed files with 139 additions and 19 deletions

View File

@@ -43,6 +43,9 @@ export interface ProtocolHandler {
export interface ILibp2pComponent {
peerId: PeerId | null;
multiaddrs: Multiaddr[];
isStarted: boolean;
isStarting: boolean;
error: string | null;
start(): Promise<void>;
stop(): Promise<void>;
@@ -52,6 +55,9 @@ export interface ILibp2pComponent {
sendProtocolData(peerId: string, protocolId: string, data: Uint8Array): Promise<void>;
refreshDiscovery(): Promise<void>;
pingPeer(peerId: string): Promise<{ success: boolean; rtt?: number; peerId: string }>;
acceptConnection(peerId: string): Promise<void>;
rejectConnection(peerId: string): Promise<void>;
cleanup(): void;
addEventListener<K extends keyof Libp2pEvents>(
event: K,