23 lines
825 B
TypeScript
23 lines
825 B
TypeScript
import { CertificateDownloader } from './CertificateDownloader';
|
|
import { RuleDownloader } from './RuleDownloader';
|
|
import {DCC} from 'dcc-utils';
|
|
import fs from 'fs';
|
|
|
|
export default class Verifier {
|
|
static certDownloader: CertificateDownloader;
|
|
static ruleDownloader: RuleDownloader;
|
|
static certificateList: any;
|
|
|
|
static async setup():Promise<void> {
|
|
Verifier.certDownloader = CertificateDownloader.getCertificateDownloader();
|
|
Verifier.ruleDownloader = RuleDownloader.getRuleDownloader();
|
|
Verifier.certificateList = await Verifier.certDownloader.getCertificates()
|
|
}
|
|
|
|
static async checkCertificate(certificate:string): Promise<unknown>{
|
|
const dcc = await DCC.fromRaw(certificate);
|
|
const certCheck = await dcc.checkSignatureWithKeysList(Verifier.certificateList);
|
|
return certCheck;
|
|
}
|
|
}
|