UNPKG

@bsv/authsocket-client

Version:
42 lines 1.67 kB
import { Socket as IoClientSocket, ManagerOptions, SocketOptions } from 'socket.io-client'; import { RequestedCertificateSet, SessionManager, Peer, WalletInterface } from '@bsv/sdk'; /** * Internal class that wraps a Socket.IO client connection with BRC-103 mutual authentication, * enabling secure and identity-aware communication with a server. */ declare class AuthSocketClientImpl { private ioSocket; private peer; connected: boolean; id: string; serverIdentityKey: string | undefined; private eventCallbacks; /** * Creates an instance of AuthSocketClient. * * @param ioSocket - The underlying Socket.IO client socket instance. * @param peer - The BRC-103 Peer instance responsible for managing authenticated * communication, including message signing and verification. */ constructor(ioSocket: IoClientSocket, peer: Peer); on(eventName: string, callback: (data?: any) => void): this; emit(eventName: string, data: any): this; disconnect(): void; private fireEventCallbacks; private encodeEventPayload; private decodeEventPayload; } /** * Factory function for creating a new AuthSocketClientImpl instance. * * @param url - The server URL * @param opts - Contains wallet, requested certificates, and other optional settings */ export declare function AuthSocketClient(url: string, opts: { wallet: WalletInterface; requestedCertificates?: RequestedCertificateSet; sessionManager?: SessionManager; managerOptions?: Partial<ManagerOptions & SocketOptions>; }): AuthSocketClientImpl; export {}; //# sourceMappingURL=AuthSocketClient.d.ts.map