diff options
Diffstat (limited to 'packages/shared/src/stores/Certificate.ts')
-rw-r--r-- | packages/shared/src/stores/Certificate.ts | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/packages/shared/src/stores/Certificate.ts b/packages/shared/src/stores/Certificate.ts new file mode 100644 index 0000000..363406d --- /dev/null +++ b/packages/shared/src/stores/Certificate.ts | |||
@@ -0,0 +1,62 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2022 Kristóf Marussy <kristof@marussy.com> | ||
3 | * | ||
4 | * This file is part of Sophie. | ||
5 | * | ||
6 | * Sophie is free software: you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU Affero General Public License as | ||
8 | * published by the Free Software Foundation, version 3. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU Affero General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU Affero General Public License | ||
16 | * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
17 | * | ||
18 | * SPDX-License-Identifier: AGPL-3.0-only | ||
19 | */ | ||
20 | |||
21 | import { IAnyModelType, Instance, SnapshotIn, types } from 'mobx-state-tree'; | ||
22 | |||
23 | const CertificatePrincipal = /* @__PURE__ */ (() => | ||
24 | types.model('CertificatePrincipal', { | ||
25 | commonName: types.string, | ||
26 | organizations: types.array(types.string), | ||
27 | organizationUnits: types.array(types.string), | ||
28 | locality: types.string, | ||
29 | state: types.string, | ||
30 | country: types.string, | ||
31 | }))(); | ||
32 | |||
33 | /* | ||
34 | eslint-disable-next-line @typescript-eslint/no-redeclare -- | ||
35 | Intentionally naming the type the same as the store definition. | ||
36 | */ | ||
37 | export interface CertificatePrincipal | ||
38 | extends Instance<typeof CertificatePrincipal> {} | ||
39 | |||
40 | const Certificate = /* @__PURE__ */ (() => | ||
41 | types.model('Certificate', { | ||
42 | data: types.string, | ||
43 | issuer: CertificatePrincipal, | ||
44 | issuerName: types.string, | ||
45 | issuerCert: types.maybe(types.late((): IAnyModelType => Certificate)), | ||
46 | subject: CertificatePrincipal, | ||
47 | subjectName: types.string, | ||
48 | serialNumber: types.string, | ||
49 | validStart: types.number, | ||
50 | validExpiry: types.number, | ||
51 | fingerprint: types.string, | ||
52 | }))(); | ||
53 | |||
54 | /* | ||
55 | eslint-disable-next-line @typescript-eslint/no-redeclare -- | ||
56 | Intentionally naming the type the same as the store definition. | ||
57 | */ | ||
58 | interface Certificate extends Instance<typeof Certificate> {} | ||
59 | |||
60 | export default Certificate; | ||
61 | |||
62 | export interface CertificateSnapshotIn extends SnapshotIn<typeof Certificate> {} | ||