padlocal-client-ts
Version:
Padlocal ts client
33 lines (32 loc) • 1.05 kB
TypeScript
import { Bytes } from "./ByteUtils";
export declare class FileUnpacker {
private static readonly HEADER_MIN_LEN;
private readonly _aesKey;
private _buffer;
constructor(aesKey: Bytes);
/**
* @param data:
* @return true, finish unpack all data
*/
update(data: Bytes): Array<FileResponse>;
getDecryptedFileData(fileResponse: FileResponse): Bytes;
reset(): void;
private _unpackResponse;
private _unpackHeader;
private static _unpackResponseBody;
}
export declare class FileResponseHeader {
readonly headerLen: number;
readonly bodyLen: number;
constructor(headerLen: number, bodyLen: number);
}
export declare type FileResponseBody = {
[key: string]: Bytes | undefined;
};
export declare class FileResponse {
readonly header: FileResponseHeader;
readonly body: FileResponseBody;
constructor(header: FileResponseHeader, body: FileResponseBody);
static unpackInteger(data?: Bytes): number | undefined;
static unpackString(data?: Bytes): string | undefined;
}