-
Notifications
You must be signed in to change notification settings - Fork 24
/
index.d.ts
114 lines (104 loc) · 4.56 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
export class DN {
CN: string;
[key: string]: string;
}
export interface InitResultInterface {
version: string;
serialNumber?: string; // JaCarta2
label?: string; // JaCarta2, RuToken
type?: string; // JaCarta2, RuToken
flags?: { [key: string]: boolean; }; // JaCarta2
serial?: string; // RuToken
reader?: string; // RuToken
model?: string; // RuToken
}
export interface CSROptionsInterface {
pin?: string; // CryptoPro
providerType?: number; // CryptoPro
algorithm?: string; // JaCarta2, RuToken
description?: string; // JaCarta2
marker?: string; // RuToken
}
export interface CSRInterface {
csr: string;
keyPairId?: number | string; // JaCarta | RuToken
}
export interface CertificateInfoInterface {
Name: string;
Issuer: DN;
IssuerName: string;
Subject: DN;
SubjectName: string;
Version: string;
SerialNumber: string;
Thumbprint: string;
ValidFromDate: Date;
ValidToDate: Date;
HasPrivateKey: boolean;
IsValid: boolean;
Algorithm: string;
ProviderName?: string; // CryptoPro
ProviderType?: string; // CryptoPro
}
export interface CertificateInfoOptionsInterface {
checkValid?: boolean; // CryptoPro
}
export interface CertListItemInterface {
id: string;
name: string;
subject: DN;
validFrom: Date;
validTo: Date;
}
export interface SignOptionsInterface {
attached: boolean;
pin?: string; // CryptoPro
pin2?: string; // CryptoPro
}
export class CryptoPro {
init(): Promise<InitResultInterface>;
bind(userPin?: string): Promise<boolean>;
unbind(): Promise<boolean>;
generateCSR(dn: DN, ekuOids?: string[], options?: CSROptionsInterface): Promise<CSRInterface>;
writeCertificate(certBase64: string): Promise<string>;
certificateInfo(certThumbprint: string, options?: CertificateInfoOptionsInterface): Promise<CertificateInfoInterface>;
listCertificates(): Promise<CertListItemInterface[]>;
readCertificate(certThumbprint: string): Promise<string>;
signData(dataBase64: string, certThumbprint: string, options?: SignOptionsInterface): Promise<string>;
signData2(dataBase64: string, certThumbprint: string, certThumbprint2: string, options?: SignOptionsInterface): Promise<string>;
addSign(dataBase64: string, signBase64: string, certThumbprint: string, options: SignOptionsInterface): Promise<string>;
verifySign(dataBase64: string, signBase64: string, options?: SignOptionsInterface): Promise<boolean>;
encryptData(dataBase64: string, certThumbprint: string): Promise<string>;
decryptData(dataBase64: string, certThumbprint: string, pin?: string): Promise<string>;
}
export class JaCarta2 {
init(): Promise<InitResultInterface>;
bind(userPin?: string): Promise<void>;
unbind(): Promise<void>;
clean(): Promise<void>;
generateCSR(dn: DN, ekuOids?: string[], options?: CSROptionsInterface): Promise<CSRInterface>;
writeCertificate(certificate: string, keyPairId: number): Promise<number>;
certificateInfo(containerId: number, options?: CertificateInfoOptionsInterface): Promise<CertificateInfoInterface>;
listCertificates(): Promise<CertListItemInterface[]>;
readCertificate(containerId: number): Promise<string>;
signData(dataBase64: string, containerId: number, options?: SignOptionsInterface): Promise<string>;
verifySign(dataBase64: string, signBase64: string, options?: SignOptionsInterface): Promise<boolean>;
encryptData(dataBase64: string, containerId: number): Promise<string>;
decryptData(dataBase64: string, containerId: number): Promise<string>;
}
export class RuToken {
init(): Promise<InitResultInterface>;
bind(userPin?: string): Promise<boolean>;
unbind(): Promise<boolean>;
clean(): Promise<number>;
generateCSR(dn: DN, extKeyUsage?: string[], options?: CSROptionsInterface): Promise<CSRInterface>;
writeCertificate(certificate: string): Promise<string>;
certificateInfo(certId: string, options?: CertificateInfoOptionsInterface): Promise<CertificateInfoInterface>;
listCertificates(): Promise<CertListItemInterface[]>;
readCertificate(certId: string): Promise<string>;
signData(dataBase64: string, certId: string, options?: SignOptionsInterface): Promise<string>;
addSign(dataBase64: string, signBase64: string, certId: string, options?: SignOptionsInterface): Promise<string>;
verifySign(dataBase64: string, signBase64: string, options?: SignOptionsInterface): Promise<boolean>;
encryptData(dataBase64: string, certId: string): Promise<string>;
decryptData(dataBase64: string, certId: string): Promise<string>;
}