forked from vgoma/crypto-pro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
certificate.ts
60 lines (49 loc) · 1.8 KB
/
certificate.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
import { ISSUER_TAGS_TRANSLATIONS, SUBJECT_TAGS_TRANSLATIONS } from '../../constants';
import { TagTranslation } from '../../helpers/_parseCertInfo';
import { exportBase64 } from './exportBase64';
import { getAlgorithm } from './getAlgorithm';
import { getCadesProp } from './getCadesProp';
import { getDecodedExtendedKeyUsage, ExtendedKeysTranslations } from './getDecodedExtendedKeyUsage';
import { getExtendedKeyUsage } from './getExtendedKeyUsage';
import { getInfo } from './getInfo';
import { hasExtendedKeyUsage } from './hasExtendedKeyUsage';
import { isValid } from './isValid';
export type CadesCertificate = any;
export class Certificate {
constructor(
public _cadesCertificate: CadesCertificate,
public name: string,
public issuerName: string,
public subjectName: string,
public thumbprint: string,
public validFrom: string,
public validTo: string,
) {}
public getOwnerInfo(): Promise<TagTranslation[]> {
return getInfo.call(this, SUBJECT_TAGS_TRANSLATIONS, 'SubjectName');
}
public getIssuerInfo(): Promise<TagTranslation[]> {
return getInfo.call(this, ISSUER_TAGS_TRANSLATIONS, 'IssuerName');
}
public getExtendedKeyUsage(): Promise<string[]> {
return getExtendedKeyUsage.call(this);
}
public getDecodedExtendedKeyUsage(): Promise<ExtendedKeysTranslations> {
return getDecodedExtendedKeyUsage.call(this);
}
public getAlgorithm(): Promise<string> {
return getAlgorithm.call(this);
}
public getCadesProp(propName): Promise<any> {
return getCadesProp.call(this, propName);
}
public isValid(): Promise<boolean> {
return isValid.call(this);
}
public exportBase64(): Promise<string> {
return exportBase64.call(this);
}
public hasExtendedKeyUsage(oids): Promise<boolean> {
return hasExtendedKeyUsage.call(this, oids);
}
}