-
Notifications
You must be signed in to change notification settings - Fork 0
/
subject_certificate_params.ts
67 lines (64 loc) · 1.75 KB
/
subject_certificate_params.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
import { CertificateSubject } from "../../bridge/proto/keys_entities";
/**
* Represents parameters for generating a subject certificate.
*/
export class SubjectCertificateParams {
/**
* Is the common name (CN) for the certificate. Required.
*/
commonName: string;
/**
* Is the organization (O) for the certificate. (Optional)
*/
organization?: string | undefined;
/**
* Is the organizational unit (OU) for the certificate. (Optional)
*/
organizationUnit?: string | undefined;
/**
* Is the location (L) for the certificate. (Optional)
*/
location?: string | undefined;
/**
* Is the state or province (ST) for the certificate. (Optional)
*/
state?: string | undefined;
/**
* Is the country (C) for the certificate. (Optional)
*/
country?: string | undefined;
/**
* Constructs a SubjectCertificateParams object with the specified parameters.
* @param commonName
* @param organization
* @param organizationUnit
* @param location
* @param state
* @param country
*/
constructor(
commonName: string,
organization?: string | undefined,
organizationUnit?: string | undefined,
location?: string | undefined,
state?: string | undefined,
country?: string | undefined
) {
this.commonName = commonName;
this.organization = organization;
this.organizationUnit = organizationUnit;
this.location = location;
this.state = state;
this.country = country;
}
public toProto(): CertificateSubject {
return CertificateSubject.fromPartial({
commonName: this.commonName,
organization: this.organization,
organizationalUnit: this.organizationUnit,
location: this.location,
state: this.state,
country: this.country
});
}
}