UNPKG

mindee

Version:

Mindee Client Library for Node.js

34 lines (33 loc) 1.22 kB
import { StringDict } from "../parsing/common"; import { Buffer } from "buffer"; /** * Local response loaded from a file. * Note: Has to be initialized through init() before use. */ export declare class LocalResponse { private file; private readonly inputHandle; /** * Creates an instance of LocalResponse. */ constructor(inputFile: Buffer | string); init(): Promise<void>; /** * Returns the dictionary representation of the file. * @returns A JSON-like object. */ asDict(): StringDict; /** * Returns the HMAC signature of the local response, from the secret key provided. * @param secretKey - Secret key, either a string or a byte/byte array. * @returns The HMAC signature of the local response. */ getHmacSignature(secretKey: string | Buffer | Uint8Array): string; /** * Checks if the HMAC signature of the local response is valid. * @param secretKey - Secret key, either a string or a byte/byte array. * @param signature - The signature to be compared with. * @returns True if the HMAC signature is valid. */ isValidHmacSignature(secretKey: string | Buffer | Uint8Array, signature: string): boolean; }