import { Deferred } from "applesauce-core/promise";
import { EventTemplate, verifyEvent } from "nostr-tools";
import { ISigner } from "../interop.js";
type Callback = () => void;
type DeviceOpts = {
    onConnect?: Callback;
    onDisconnect?: Callback;
    onError?: (err: Error) => void;
    onDone?: Callback;
};
/** A signer that works with [nostr-signing-device](https://github.com/lnbits/nostr-signing-device) */
export declare class SerialPortSigner implements ISigner {
    protected log: import("debug").Debugger;
    protected writer: WritableStreamDefaultWriter<string> | null;
    pubkey?: string;
    get isConnected(): boolean;
    verifyEvent: typeof verifyEvent;
    nip04: {
        encrypt: (pubkey: string, plaintext: string) => Promise<string>;
        decrypt: (pubkey: string, ciphertext: string) => Promise<string>;
    };
    constructor();
    protected lastCommand: Deferred<string> | null;
    callMethodOnDevice(method: string, params: string[], opts?: DeviceOpts): Promise<string>;
    connectToDevice({ onConnect, onDisconnect, onError, onDone }: DeviceOpts): Promise<void>;
    sendCommand(method: string, params?: string[]): Promise<void>;
    protected readFromSerialPort(reader: ReadableStreamDefaultReader<string>): (separator?: string) => Promise<{
        value: string;
        done: boolean;
    }>;
    protected parseResponse(value: string): {
        method: string;
        data: string;
    };
    nip04Encrypt(pubkey: string, text: string): Promise<string>;
    nip04Decrypt(pubkey: string, data: string): Promise<string>;
    /** Returns the public key on the device */
    getPublicKey(): Promise<string>;
    /** Sets the secret key used on the device */
    restore(secretKey: Uint8Array): Promise<void>;
    /** Requires the device to sign an event */
    signEvent(draft: EventTemplate & {
        pubkey?: string;
    }): Promise<import("nostr-tools").VerifiedEvent>;
    /** Pings to device to see if the connection is open */
    ping(): void;
    static SUPPORTED: boolean;
    static METHOD_PING: string;
    static METHOD_LOG: string;
    static METHOD_SIGN_MESSAGE: string;
    static METHOD_SHARED_SECRET: string;
    static METHOD_PUBLIC_KEY: string;
    static METHOD_RESTORE: string;
    static PUBLIC_METHODS: string[];
}
export {};
