import 'websocket-polyfill';
import { Buff, Bytes } from '@cmdcode/buff';
import { EventEmitter } from './emitter.js';
import { NostrSub } from './sub.js';
import { SignedEvent, SignerAPI } from '@scrow/core';
import { EventFilter, EventMessage, SocketConfig, SubscribeConfig } from '../types.js';
type ReceiptEnvelope = [id: string, ok: boolean, reason: string];
export declare const SOCKET_DEFAULTS: () => SocketConfig;
export declare class NostrSocket extends EventEmitter<{
    'cancel': [id: string, sub: NostrSub, reason: string];
    'close': NostrSocket;
    'connect': NostrSocket;
    'echo': string;
    'error': Error;
    'event': EventMessage;
    'notice': string;
    'ready': NostrSocket;
    'reject': [reason: string, envelope: unknown];
    'receipt': ReceiptEnvelope;
    'subscribe': [id: string, sub: NostrSub];
}> {
    readonly _opt: SocketConfig;
    readonly _signer: SignerAPI;
    readonly _tags: string[][];
    _buffer?: ReturnType<typeof setTimeout>;
    _init: boolean;
    _outbox: SignedEvent[];
    _relay?: string;
    _secret?: Buff;
    _socket: WebSocket | null;
    _subs: Map<string, NostrSub>;
    _topic_id: string | null;
    constructor(signer: SignerAPI, options?: Partial<SocketConfig>);
    get is_connected(): boolean;
    get opt(): SocketConfig;
    get pubkey(): string;
    get is_ready(): boolean;
    get relay(): string;
    get secret(): Buff;
    get subs(): Map<string, NostrSub>;
    get socket(): WebSocket;
    get tags(): string[][];
    get topic_id(): string;
    log: {
        debug: (...s: unknown[]) => void | null;
        info: (...s: unknown[]) => void | null;
    };
    _err_handler(err: unknown): void;
    _event_handler(payload: string[]): Promise<void>;
    _msg_handler(msg: any): void | Promise<void>;
    _cancel_handler(payload: string[]): void;
    _eose_handler(payload: string[]): void;
    _open_handler(_event: unknown): void;
    _notice_handler(payload: string[]): void;
    _receipt_handler(payload: ReceiptEnvelope): void;
    _publish(events?: SignedEvent[]): Promise<void[]>;
    _subscribe(subs?: [string, NostrSub][]): Promise<void[]>;
    cancel(sub_id: string): Promise<void>;
    can_recover(event: SignedEvent): boolean;
    connect(address?: string, secret?: string): Promise<unknown>;
    close(): void;
    delete(event_id: string): void;
    get_sub(sub_id: string): NostrSub;
    on_event<T>(subject: string, handler: (msg: EventMessage<T>) => void | Promise<void>): void;
    publish(event: SignedEvent): void;
    query(address: string, filter: EventFilter): Promise<SignedEvent[]>;
    recover(event: SignedEvent): string;
    send(subject: string, body: unknown, envelope?: Partial<SignedEvent>, recovery?: boolean): Promise<unknown>;
    sign(event: Partial<SignedEvent>): SignedEvent;
    subscribe(config?: Partial<SubscribeConfig>): NostrSub;
    when_cancel(sub_id: string): Promise<unknown>;
    when_echo(event_id: string): Promise<unknown>;
    when_receipt(event_id: string): Promise<unknown>;
    when_sub(sub_id: string): Promise<unknown>;
}
export declare function encrypt_content(content: string, secret: Bytes): string;
export declare function decrypt_content(content: string, secret: Bytes): string;
export {};
