///
import { SrpClient } from "fast-srp-hap";
import { ParsedUrlQuery } from "querystring";
import { EventEmitter } from "./lib/EventEmitter";
import { HAPBonjourBrowser, HAPDeviceInfo } from "./lib/HAPBonjourBrowser";
import { HTTPResponse, HTTPRoutes } from "./lib/http-protocol";
import { ClientInfo } from "./storage/ClientInfo";
import { CharacteristicEventRequest, CharacteristicReadRequest, CharacteristicWriteRequest, HAPEncryptionContext } from "./types/hap-proxy";
export declare type PinProvider = (callback: (pinCode: string) => void) => void;
export declare type ClientPairSetupSession = {
initiator: HAPClientConnection;
srpClient: SrpClient;
sharedSecret: Buffer;
sessionKey: Buffer;
};
export declare type PairVerifySession = {
secretKey: Buffer;
publicKey: Buffer;
sharedSecret: Buffer;
};
export declare enum HAPClientEvents {
CONFIG_NUMBER_CHANGE = "config-number-change"
}
export declare type HAPClientEventMap = {
[HAPClientEvents.CONFIG_NUMBER_CHANGE]: (configNumber: number) => void;
};
export declare class HAPClient extends EventEmitter {
clientInfo: ClientInfo;
bonjourBrowser: HAPBonjourBrowser;
deviceInfo?: HAPDeviceInfo;
connections: HAPClientConnection[];
private pairSetupSession?;
private currentChain;
constructor(clientInfo: ClientInfo);
private deviceInfoUpdated;
newConnection(): HAPClientConnection;
ensureConnected(connection: HAPClientConnection): Promise;
checkPaired(connection: HAPClientConnection): Promise;
private sendPairM1;
private handlePairM2;
private sendPairM3;
private handlePairM4;
private sendPairM5;
private handlePairM6;
private handleDisconnected;
}
export declare enum HAPClientConnectionEvents {
EVENT_RAW = "event-raw",
DISCONNECTED = "disconnected"
}
export declare type HAPClientConnectionEventMap = {
[HAPClientConnectionEvents.EVENT_RAW]: (eventBuf: Buffer) => void;
[HAPClientConnectionEvents.DISCONNECTED]: () => void;
};
export declare class HAPClientConnection extends EventEmitter {
private socket?;
private parser;
private readonly client;
private readonly clientInfo;
private pairVerifySession?;
private pairingVerified;
encryptionContext?: HAPEncryptionContext;
private socketClosed;
private socketConnectReject?;
private httpRequestResolver?;
private connectionChain;
constructor(client: HAPClient);
ensureConnected(): Promise;
disconnect(): void;
ensurePairingVerified(): Promise;
accessories(): Promise;
getCharacteristics(characteristics: CharacteristicReadRequest[], event?: boolean, meta?: boolean, perms?: boolean, type?: boolean): Promise;
getCharacteristicsRaw(queryParams: ParsedUrlQuery): Promise;
setCharacteristics(characteristics: CharacteristicWriteRequest[], pid?: number): Promise;
setCharacteristicEvents(characteristics: CharacteristicEventRequest[], pid?: number): Promise;
setCharacteristicsRaw(writeRequest: Buffer): Promise;
prepareWrite(ttl: number, pid?: number): Promise;
prepareWriteRaw(prepareRequest: Buffer): Promise;
generatePid(): number;
resourceRaw(resourceRequest: Buffer): Promise;
/**
* Sends the request to remove a pairing. When clientId is omitted the own pairing will be removed.
*
* @param clientInfo {ClientInfo} - clientInfo of the pairing which will be removed (optional, defaults to own id)
*/
removePairing(clientInfo?: ClientInfo): Promise;
private sendPairVerifyM1;
private handlePairVerifyM2;
private sendPairVerifyM3;
private handlePairVerifyM4;
private handleIncomingData;
get(route: HTTPRoutes, queryParams?: ParsedUrlQuery, headers?: Record): Promise;
put(route: HTTPRoutes, data: Buffer, queryParams?: Record, headers?: Record): Promise;
post(route: HTTPRoutes, data: Buffer, queryParams?: Record, headers?: Record): Promise;
sendPairRequest(route: HTTPRoutes, data?: Buffer): Promise;
private sendRequest;
private handleError;
private handleClosed;
}
//# sourceMappingURL=HAPClient.d.ts.map