-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.d.ts
60 lines (46 loc) · 1.06 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
declare interface Apdu {
Cla : number;
Ins : number;
P1 : number;
P2 : number;
Le : number;
Lc : number;
}
declare interface ApduResponse {
SW : Array<number>;
Data? : Array<number>;
}
declare enum CardEvent {
Inserted,
Removed
}
declare enum MemoryCardTypes {
SLE5528 = 0x05,
SLE5542 = 0x06
}
declare enum PINStatus {
NOT_VERIFIED,
OK,
WRONG,
LOCKED
}
declare class SmartCard {
constructor(_atr : Array<number>, _protocol: number, _isMemoryCard : boolean);
atr : Array<number>;
protocol : number;
isMemoryCard : boolean;
}
declare class Reader {
constructor(_pcscReader : any);
name : string;
sendApdu(card : SmartCard, cmd : Apdu, dataIn : Array<number>, timeout? : number) : Promise<ApduResponse>;
close();
}
declare class TsCard {
static instance : TsCard
detectReader(timeout? : number) : Promise<Reader>;
insertCard(timeout? : number) : Promise<[boolean,SmartCard?]>;
removeCard(timeout? : number) : Promise<boolean>;
onCardEvent(f : (event: CardEvent, card: SmartCard, e : Error) => void);
close();
}