-
Notifications
You must be signed in to change notification settings - Fork 2
/
RecordStore.d.ts
60 lines (51 loc) · 1.53 KB
/
RecordStore.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 module '@ledgerhq/hw-transport-mocker/RecordStore' {
import { Buffer } from 'buffer';
export type Queue = Array<[string, string]>;
export class RecordStore {
/**
* Create an instance of RecordStore from a string.
*
* @param {string} str The string to create the RecordStore from.
* @return {RecordStore} An instance of RecordStore;
*/
static fromString(str: string): RecordStore;
queue: Queue;
/**
* Create a new instance of the RecordStore class.
*
* @param {Queue} queue An optional queue to use.
*/
constructor(queue?: Queue);
/**
* Get whether the queue is empty.
*
* @return {boolean} TRUE if the queue is empty, FALSE otherwise
*/
isEmpty(): boolean;
/**
* Record an APDU exchange to the queue.
*
* @param {Buffer} apdu The input data.
* @param {Buffer} out The output data.
*/
recordExchange(apdu: Buffer, out: Buffer): void;
/**
* Replay a previously recorded APDU exchange. Throws an error if the queue is empty or if the
* recorded APDU is invalid.
*
* @param {Buffer} apdu The input to replay
* @return {Buffer} A Buffer with the previously recorded output data.
*/
replayExchange(apdu: Buffer): Buffer;
/**
* Ensure the queue is empty. Throws an error if the queue isn't empty.
*/
ensureQueueEmpty(): void;
/**
* Get the current queue as string.
*
* @return {string} The queue as string.
*/
toString(): string;
}
}