forked from hanspeter1/ocsp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
90 lines (70 loc) · 2.51 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
// https://github.com/indutny/ocsp
declare module "ocsp" {
import * as Http from "http";
import * as Https from "https";
// https://github.com/indutny/ocsp#agent
class Agent extends Https.Agent {
constructor(opts?: AgentOptions);
}
interface AgentOptions extends Https.AgentOptions {
CACacheSize?: number
}
// https://github.com/indutny/ocsp#cache
class Cache {
constructor(options?: { probe?: () => any, store?: () => any, filter?: (url: string, callback: () => any) => any });
request(id: string | Buffer, options: { url: string, ocsp: Buffer }, cb: (err: Error | null, resp: Buffer) => any): void
probe(id: string, cb: (error: Error, cached: { response: any, timer: NodeJS.Timeout } | false) => any): void
}
// https://github.com/indutny/ocsp#server
let Server: IServer;
interface IServer {
create(param: {
cert: string | Buffer,
key: string | Buffer
}): ExtServer
}
interface ExtServer extends Http.Server {
addCert(serialNumber: number, status: "good" | "revoked", info?: {
revocationTime?: Date,
revocationReason?: "unspecified"
| "keyCompromise"
| "CACompromise"
| "affiliationChanged"
| "superseded"
| "cessationOfOperation"
| "certificateHold"
| "removeFromCRL"
| "privelegeWithdrawn"
| "AACompromise"
}): void
}
// https://github.com/indutny/ocsp#check
function check(options: {
cert: string | Buffer,
issuer: string | Buffer
}, cb: (err: Error, res: Http.ServerResponse) => any): void
// https://github.com/indutny/ocsp#verify
function verify(options: {
request: Http.IncomingMessage,
response: Http.ServerResponse,
issuer?: string | Buffer
}, cb: (err: Error, res: Http.ServerResponse) => any): void
// https://github.com/indutny/ocsp#requestgenerate
let request: IRequest;
interface IRequest {
generate(
cert: string | Buffer,
issuerCert: string | Buffer): Req
}
interface Req extends Http.IncomingMessage {
id: Buffer,
certID: any,
data: any,
cert: Buffer,
issuer: Buffer
}
// https://github.com/indutny/ocsp#getocspuri
function getOCSPURI(
cert: string | Buffer,
cb: (err: Error | null, uri?: string | null) => any): void
}