UNPKG

sunmi-device-sdk

Version:

JavaScript SDK for Sunmi card readers and printers

47 lines (46 loc) 1.82 kB
/** * Sunmi Card Reader API * Provides methods to interact with Sunmi device card readers */ import { MifareKeyType, CardReadResult } from './types'; export declare class SunmiCardReader { /** * Start reading a card * @param cardTypes Array of card types to detect (e.g., ['mifare', 'ic']) * @returns Promise resolving to card information */ static startReadCard(cardTypes: string[]): Promise<CardReadResult>; /** * Authenticate a Mifare card block * @param blockKey The authentication key (hex string) * @param keyType Key type (A or B) * @param blockToRead Block number to authenticate * @returns Promise resolving when authentication succeeds */ static authMifare(blockKey: string, keyType: MifareKeyType, blockToRead: number): Promise<void>; /** * Read a block from an authenticated Mifare card * @param blockToRead Block number to read * @returns Promise resolving to the block data (hex string) */ static readBlockMifare(blockToRead: number): Promise<string>; /** * Write data to a Mifare card block * @param blockToWrite Block number to write to * @param stringToWrite Data to write (hex string, must be 16 bytes) * @returns Promise resolving when write completes */ static writeBlockMifare(blockToWrite: number, stringToWrite: string): Promise<void>; /** * Set PIN status * @param pinToEdit PIN identifier * @param statusResolved New status * @returns Promise resolving when PIN status is updated */ static setPinStatus(pinToEdit: string, statusResolved: boolean): Promise<void>; /** * Cancel an ongoing card reading operation * @returns Promise resolving when operation is cancelled */ static cancelCheckCard(): Promise<void>; }