UNPKG

1.8 kBTypeScriptView Raw
1/// <reference types="node" />
2export interface CaCertificateUpdate {
3 caCertificate: Buffer;
4}
5export interface IdentityCertificateUpdate {
6 certificate: Buffer;
7 privateKey: Buffer;
8}
9export interface CaCertificateUpdateListener {
10 (update: CaCertificateUpdate | null): void;
11}
12export interface IdentityCertificateUpdateListener {
13 (update: IdentityCertificateUpdate | null): void;
14}
15export interface CertificateProvider {
16 addCaCertificateListener(listener: CaCertificateUpdateListener): void;
17 removeCaCertificateListener(listener: CaCertificateUpdateListener): void;
18 addIdentityCertificateListener(listener: IdentityCertificateUpdateListener): void;
19 removeIdentityCertificateListener(listener: IdentityCertificateUpdateListener): void;
20}
21export interface FileWatcherCertificateProviderConfig {
22 certificateFile?: string | undefined;
23 privateKeyFile?: string | undefined;
24 caCertificateFile?: string | undefined;
25 refreshIntervalMs: number;
26}
27export declare class FileWatcherCertificateProvider implements CertificateProvider {
28 private config;
29 private refreshTimer;
30 private fileResultPromise;
31 private latestCaUpdate;
32 private caListeners;
33 private latestIdentityUpdate;
34 private identityListeners;
35 private lastUpdateTime;
36 constructor(config: FileWatcherCertificateProviderConfig);
37 private updateCertificates;
38 private maybeStartWatchingFiles;
39 private maybeStopWatchingFiles;
40 addCaCertificateListener(listener: CaCertificateUpdateListener): void;
41 removeCaCertificateListener(listener: CaCertificateUpdateListener): void;
42 addIdentityCertificateListener(listener: IdentityCertificateUpdateListener): void;
43 removeIdentityCertificateListener(listener: IdentityCertificateUpdateListener): void;
44}