|
1 | 1 | import type { DeepPartial, FileSystem } from '../types'; |
2 | | -import type { RecoveryCode, Key, PrivateKey } from '../keys/types'; |
3 | | -import type { PasswordMemLimit, PasswordOpsLimit } from '../keys/types'; |
| 2 | +import type { RecoveryCode, Key, KeysOptions } from '../keys/types'; |
4 | 3 | import path from 'path'; |
5 | 4 | import Logger from '@matrixai/logger'; |
6 | 5 | import { DB } from '@matrixai/db'; |
7 | | -import * as bootstrapErrors from './errors'; |
8 | 6 | import TaskManager from '../tasks/TaskManager'; |
9 | | -import { IdentitiesManager } from '../identities'; |
10 | | -import { SessionManager } from '../sessions'; |
11 | | -import { Status } from '../status'; |
12 | | -import { Schema } from '../schema'; |
13 | | -import { Sigchain } from '../sigchain'; |
14 | | -import { ACL } from '../acl'; |
15 | | -import { GestaltGraph } from '../gestalts'; |
16 | | -import { KeyRing, CertManager } from '../keys'; |
17 | | -import { NodeGraph, NodeManager } from '../nodes'; |
18 | | -import { VaultManager } from '../vaults'; |
19 | | -import { NotificationsManager } from '../notifications'; |
20 | | -import { mkdirExists } from '../utils'; |
| 7 | +import IdentitiesManager from '../identities/IdentitiesManager'; |
| 8 | +import SessionManager from '../sessions/SessionManager'; |
| 9 | +import Status from '../status/Status'; |
| 10 | +import Schema from '../schema/Schema'; |
| 11 | +import Sigchain from '../sigchain/Sigchain'; |
| 12 | +import ACL from '../acl/ACL'; |
| 13 | +import GestaltGraph from '../gestalts/GestaltGraph'; |
| 14 | +import KeyRing from '../keys/KeyRing'; |
| 15 | +import CertManager from '../keys/CertManager'; |
| 16 | +import * as keysUtils from '../keys/utils'; |
| 17 | +import NodeGraph from '../nodes/NodeGraph'; |
| 18 | +import NodeManager from '../nodes/NodeManager'; |
| 19 | +import VaultManager from '../vaults/VaultManager'; |
| 20 | +import NotificationsManager from '../notifications/NotificationsManager'; |
21 | 21 | import config from '../config'; |
22 | 22 | import * as utils from '../utils'; |
23 | | -import * as keysUtils from '../keys/utils'; |
24 | 23 | import * as errors from '../errors'; |
| 24 | +import * as bootstrapErrors from './errors'; |
25 | 25 |
|
26 | 26 | type BootstrapOptions = { |
27 | 27 | nodePath: string; |
28 | | - keys: { |
29 | | - recoveryCode: RecoveryCode; |
30 | | - privateKey: PrivateKey; |
31 | | - privateKeyPath: string; |
32 | | - passwordOpsLimit: PasswordOpsLimit; |
33 | | - passwordMemLimit: PasswordMemLimit; |
34 | | - strictMemoryLock: boolean; |
35 | | - certDuration: number; |
36 | | - }; |
| 28 | + keys: KeysOptions; |
37 | 29 | }; |
38 | 30 |
|
39 | 31 | /** |
@@ -68,7 +60,7 @@ async function bootstrapState({ |
68 | 60 | if (optionsDefaulted.nodePath == null) { |
69 | 61 | throw new errors.ErrorUtilsNodePath(); |
70 | 62 | } |
71 | | - await mkdirExists(fs, optionsDefaulted.nodePath); |
| 63 | + await utils.mkdirExists(fs, optionsDefaulted.nodePath); |
72 | 64 | // Setup node path and sub paths |
73 | 65 | const statusPath = path.join( |
74 | 66 | optionsDefaulted.nodePath, |
@@ -112,14 +104,7 @@ async function bootstrapState({ |
112 | 104 | const keyRing = await KeyRing.createKeyRing({ |
113 | 105 | keysPath, |
114 | 106 | password, |
115 | | - options: { |
116 | | - recoveryCode: optionsDefaulted.recoveryCode, |
117 | | - privateKey: optionsDefaulted.privateKey, |
118 | | - privateKeyPath: optionsDefaulted.privateKeyPath, |
119 | | - passwordOpsLimit: optionsDefaulted.passwordOpsLimit, |
120 | | - passwordMemLimit: optionsDefaulted.passwordMemLimit, |
121 | | - strictMemoryLock: optionsDefaulted.strictMemoryLock, |
122 | | - }, |
| 107 | + options: optionsDefaulted.keys, |
123 | 108 | fs, |
124 | 109 | logger: logger.getChild(KeyRing.name), |
125 | 110 | fresh, |
@@ -156,9 +141,7 @@ async function bootstrapState({ |
156 | 141 | keyRing, |
157 | 142 | db, |
158 | 143 | taskManager, |
159 | | - options: { |
160 | | - certDuration: optionsDefaulted.certDuration, |
161 | | - }, |
| 144 | + options: optionsDefaulted.keys, |
162 | 145 | fresh, |
163 | 146 | logger, |
164 | 147 | }); |
|
0 commit comments