-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
typedef.ts
69 lines (60 loc) · 2.07 KB
/
typedef.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
/**
* typedef.ts
*/
export type HashTypes = 'SHA-1'|'SHA-256'|'SHA-384'|'SHA-512';
export type SignatureType =
'ecdsa-with-sha256'|'ecdsa-with-sha384'|'ecdsa-with-sha512'|'ecdsa-with-sha1'|
'sha256WithRSAEncryption'|'sha384WithRSAEncryption'|'sha512WithRSAEncryption'|'sha1WithRSAEncryption'|
'rsassaPss';
/**
* @typedef {'der'|'pem'} AsnFormat - 'der' or 'pem'
*/
export type AsnFormat = 'der'|'pem';
/**
* @typedef {Buffer|Uint8Array} DER - ASN.1 DER.
*/
export type DER = Buffer|Uint8Array;
/**
* @typedef {String} PEM - ASN.1 PEM.
*/
export type PEM = string;
/**
* @typedef {Object} X509EncodingOptions - Options to generate X.509 public key certificate.
* @property {String} [signature='ecdsa-with-sha256'] - Signature algorithm like 'ecdsa-with-sha256'.
* @property {Number} [days=3650] - The number of days to expire.
* @property {X509Issuer} issuer - Object specifying the issuer of the certificate.
* @property {X509Subject} subject - Object specifying subject of the certificate.
* @property {RsaPssOptions} [pssParams={}] - RSASSA-PSS parameters.
*/
export type X509EncodingOptions = {
signature?: SignatureType,
days?: number,
issuer?: X509Issuer,
subject?: X509Subject,
pssParams?: RsaPssOptions
}
/**
* @typedef {Object} X509Issuer - An object specifying the X.509 issuer.
* @property {String} [organizationName='Self'] - Name of issuer organization.
*/
export type X509Issuer = {
organizationName?: string
}
/**
* @typedef {Object} X509Subject - An object specifying the X.509 subject.
* @property {String} [organizationName='Self'] - Name of subject organization.
*/
export type X509Subject = {
organizationName?: string
}
/**
* @typedef {Object} RsaPssOptions - RSASSA-PSS ASN.1 encoding object.
* @property {Number} [saltLength=20] - RSA-PSS param. Length of salt in octet.
* @property {String} [hash='SHA-1'] - RSA-PSS param. Name of hash algorithm like 'SHA-256'
* @property {boolean} [explicit=false] - RSA-PSS param. True if it is explicit.
*/
export type RsaPssOptions = {
saltLength?: number,
hash?: HashTypes,
explicit?: boolean
}