UNPKG

@kodeglot/node-python-eid-reader

Version:

A cross-platform Node.js package to read Belgian eID card public data using Python eidreader with automatic dependency checking

125 lines 3.57 kB
import { PcscDetector, PcscStatus } from './pcsc-detect'; /** * Interface representing Belgian eID card data */ export interface EidData { cardNumber: string; chipNumber: string; validityDateBegin: string; validityDateEnd: string; municipality: string; nationality: string; birthLocation: string; birthDate: string; name: string; firstName: string; sex: string; documentType: string; address: { streetAndNumber: string; zip: string; municipality: string; }; photo: string; } /** * Structured result for all API calls */ export interface ReaderResult<T> { success: boolean; info: string[]; error?: { message: string; code?: string; }; data?: T; } export interface EidReaderOptions { verbose?: boolean; maxRetries?: number; retryDelay?: number; pythonPath?: string; pkcs11LibPath?: string; } export declare class EidReaderError extends Error { readonly code?: string | undefined; constructor(message: string, code?: string | undefined); } export declare class EidReader { private options; private requirementsChecker; private info; constructor(options?: EidReaderOptions); private addInfo; checkRequirements(): Promise<ReaderResult<{ passed: boolean; results: any; }>>; installRequirements(): Promise<ReaderResult<{ installed: boolean; }>>; checkEidReaderAvailable(): Promise<ReaderResult<{ available: boolean; readerType?: string; }>>; checkCardInserted(): Promise<ReaderResult<{ inserted: boolean; cardInfo?: { cardNumber?: string; name?: string; }; }>>; readEidData(): Promise<ReaderResult<EidData>>; private findPythonWithEidreader; private tryPythonCommand; private setupEnvironment; private runEidReader; private parseEidreaderOutput; } export declare function readEidData(options?: EidReaderOptions): Promise<ReaderResult<EidData>>; export declare function checkRequirements(): Promise<ReaderResult<{ passed: boolean; results: any; }>>; export declare function installRequirements(): Promise<ReaderResult<{ installed: boolean; }>>; export declare function checkEidReaderAvailable(): Promise<ReaderResult<{ available: boolean; readerType?: string; }>>; export declare function checkCardInserted(): Promise<ReaderResult<{ inserted: boolean; cardInfo?: { cardNumber?: string; name?: string; }; }>>; export type { RequirementsChecker } from './requirements-checker'; /** * Create and start a PC/SC detector for real-time reader/card monitoring * @param options Configuration options * @returns Promise that resolves to a PcscDetector instance */ export declare function createPcscDetector(): Promise<PcscDetector>; /** * Get current PC/SC status (readers and cards) * @returns Promise that resolves to current PC/SC status */ export declare function getPcscStatus(): Promise<ReaderResult<PcscStatus>>; /** * Check if any PC/SC reader is available * @returns Promise that resolves to reader availability status */ export declare function isPcscReaderAvailable(): Promise<ReaderResult<{ available: boolean; }>>; /** * Check if any card is inserted in any PC/SC reader * @returns Promise that resolves to card insertion status */ export declare function isPcscCardInserted(): Promise<ReaderResult<{ inserted: boolean; readerName?: string; }>>; //# sourceMappingURL=index.d.ts.map