@webda/core 4.0.0-beta.6 → 4.0.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/README.md +6 -5
  2. package/lib/application/application.d.ts +18 -0
  3. package/lib/application/application.d.ts.map +1 -1
  4. package/lib/application/application.js +49 -11
  5. package/lib/application/application.js.map +1 -1
  6. package/lib/application/iconfiguration.d.ts +31 -0
  7. package/lib/application/iconfiguration.d.ts.map +1 -1
  8. package/lib/application/iconfiguration.js.map +1 -1
  9. package/lib/application/unpackedapplication.d.ts.map +1 -1
  10. package/lib/application/unpackedapplication.js +7 -5
  11. package/lib/application/unpackedapplication.js.map +1 -1
  12. package/lib/bin/cli-phase.d.ts +18 -2
  13. package/lib/bin/cli-phase.d.ts.map +1 -1
  14. package/lib/bin/cli-phase.js +25 -0
  15. package/lib/bin/cli-phase.js.map +1 -1
  16. package/lib/bin/cli.d.ts +8 -0
  17. package/lib/bin/cli.d.ts.map +1 -1
  18. package/lib/bin/cli.js +94 -35
  19. package/lib/bin/cli.js.map +1 -1
  20. package/lib/configurations/configuration.service.d.ts +7 -0
  21. package/lib/configurations/configuration.service.d.ts.map +1 -1
  22. package/lib/configurations/configuration.service.js +18 -5
  23. package/lib/configurations/configuration.service.js.map +1 -1
  24. package/lib/configurations/kubernetesconfiguration.service.d.ts.map +1 -1
  25. package/lib/configurations/kubernetesconfiguration.service.js +1 -4
  26. package/lib/configurations/kubernetesconfiguration.service.js.map +1 -1
  27. package/lib/contexts/httpcontext.d.ts +15 -1
  28. package/lib/contexts/httpcontext.d.ts.map +1 -1
  29. package/lib/contexts/httpcontext.js +61 -19
  30. package/lib/contexts/httpcontext.js.map +1 -1
  31. package/lib/contexts/operationcontext.d.ts +6 -0
  32. package/lib/contexts/operationcontext.d.ts.map +1 -1
  33. package/lib/contexts/operationcontext.js +16 -2
  34. package/lib/contexts/operationcontext.js.map +1 -1
  35. package/lib/contexts/restcontext.d.ts +110 -0
  36. package/lib/contexts/restcontext.d.ts.map +1 -0
  37. package/lib/contexts/restcontext.js +247 -0
  38. package/lib/contexts/restcontext.js.map +1 -0
  39. package/lib/contexts/streamingcontext.d.ts +71 -0
  40. package/lib/contexts/streamingcontext.d.ts.map +1 -0
  41. package/lib/contexts/streamingcontext.js +93 -0
  42. package/lib/contexts/streamingcontext.js.map +1 -0
  43. package/lib/contexts/webcontext.d.ts +20 -0
  44. package/lib/contexts/webcontext.d.ts.map +1 -1
  45. package/lib/contexts/webcontext.js +43 -10
  46. package/lib/contexts/webcontext.js.map +1 -1
  47. package/lib/contexts/websocketcontext.d.ts +39 -0
  48. package/lib/contexts/websocketcontext.d.ts.map +1 -0
  49. package/lib/contexts/websocketcontext.js +67 -0
  50. package/lib/contexts/websocketcontext.js.map +1 -0
  51. package/lib/core/asyncqueue.d.ts +50 -0
  52. package/lib/core/asyncqueue.d.ts.map +1 -0
  53. package/lib/core/asyncqueue.js +96 -0
  54. package/lib/core/asyncqueue.js.map +1 -0
  55. package/lib/core/core.d.ts +18 -0
  56. package/lib/core/core.d.ts.map +1 -1
  57. package/lib/core/core.js +72 -7
  58. package/lib/core/core.js.map +1 -1
  59. package/lib/core/icore.d.ts +14 -1
  60. package/lib/core/icore.d.ts.map +1 -1
  61. package/lib/core/icore.js.map +1 -1
  62. package/lib/core/instancestorage.d.ts +1 -0
  63. package/lib/core/instancestorage.d.ts.map +1 -1
  64. package/lib/core/instancestorage.js +1 -0
  65. package/lib/core/instancestorage.js.map +1 -1
  66. package/lib/core/operations.d.ts +49 -6
  67. package/lib/core/operations.d.ts.map +1 -1
  68. package/lib/core/operations.js +187 -24
  69. package/lib/core/operations.js.map +1 -1
  70. package/lib/deployers/git.d.ts +4 -2
  71. package/lib/deployers/git.d.ts.map +1 -1
  72. package/lib/deployers/git.js +44 -5
  73. package/lib/deployers/git.js.map +1 -1
  74. package/lib/errors/errors.d.ts +15 -0
  75. package/lib/errors/errors.d.ts.map +1 -1
  76. package/lib/errors/errors.js +20 -0
  77. package/lib/errors/errors.js.map +1 -1
  78. package/lib/index.d.ts +5 -0
  79. package/lib/index.d.ts.map +1 -1
  80. package/lib/index.js +5 -0
  81. package/lib/index.js.map +1 -1
  82. package/lib/rest/restoperationstransport.service.d.ts +108 -0
  83. package/lib/rest/restoperationstransport.service.d.ts.map +1 -1
  84. package/lib/rest/restoperationstransport.service.js +360 -10
  85. package/lib/rest/restoperationstransport.service.js.map +1 -1
  86. package/lib/rest/router.service.d.ts +1 -1
  87. package/lib/rest/router.service.d.ts.map +1 -1
  88. package/lib/rest/router.service.js +5 -2
  89. package/lib/rest/router.service.js.map +1 -1
  90. package/lib/services/authenticatedencryption.d.ts +25 -0
  91. package/lib/services/authenticatedencryption.d.ts.map +1 -0
  92. package/lib/services/authenticatedencryption.js +56 -0
  93. package/lib/services/authenticatedencryption.js.map +1 -0
  94. package/lib/services/binary.service.d.ts +1 -1
  95. package/lib/services/binary.service.d.ts.map +1 -1
  96. package/lib/services/binary.service.js.map +1 -1
  97. package/lib/services/cloudbinary.d.ts.map +1 -1
  98. package/lib/services/cloudbinary.js +3 -2
  99. package/lib/services/cloudbinary.js.map +1 -1
  100. package/lib/services/command.d.ts +7 -1
  101. package/lib/services/command.d.ts.map +1 -1
  102. package/lib/services/command.js +4 -0
  103. package/lib/services/command.js.map +1 -1
  104. package/lib/services/cryptoservice.service.d.ts +405 -25
  105. package/lib/services/cryptoservice.service.d.ts.map +1 -1
  106. package/lib/services/cryptoservice.service.js +779 -72
  107. package/lib/services/cryptoservice.service.js.map +1 -1
  108. package/lib/services/httpserver.service.d.ts.map +1 -1
  109. package/lib/services/httpserver.service.js +20 -9
  110. package/lib/services/httpserver.service.js.map +1 -1
  111. package/lib/services/icryptoservice.d.ts +11 -0
  112. package/lib/services/icryptoservice.d.ts.map +1 -1
  113. package/lib/services/icryptoservice.js +2 -0
  114. package/lib/services/icryptoservice.js.map +1 -1
  115. package/lib/services/mailer.service.d.ts +4 -0
  116. package/lib/services/mailer.service.d.ts.map +1 -1
  117. package/lib/services/mailer.service.js +7 -1
  118. package/lib/services/mailer.service.js.map +1 -1
  119. package/lib/services/operationstransport.d.ts +13 -0
  120. package/lib/services/operationstransport.d.ts.map +1 -1
  121. package/lib/services/operationstransport.js +28 -6
  122. package/lib/services/operationstransport.js.map +1 -1
  123. package/lib/services/pki.encrypter.d.ts +214 -0
  124. package/lib/services/pki.encrypter.d.ts.map +1 -0
  125. package/lib/services/pki.encrypter.js +350 -0
  126. package/lib/services/pki.encrypter.js.map +1 -0
  127. package/lib/services/secretscheck.d.ts +120 -0
  128. package/lib/services/secretscheck.d.ts.map +1 -0
  129. package/lib/services/secretscheck.js +322 -0
  130. package/lib/services/secretscheck.js.map +1 -0
  131. package/lib/services/servicecommands.d.ts +8 -4
  132. package/lib/services/servicecommands.d.ts.map +1 -1
  133. package/lib/services/servicecommands.js +14 -5
  134. package/lib/services/servicecommands.js.map +1 -1
  135. package/lib/session/manager.model.d.ts +3 -1
  136. package/lib/session/manager.model.d.ts.map +1 -1
  137. package/lib/session/manager.model.js +6 -3
  138. package/lib/session/manager.model.js.map +1 -1
  139. package/lib/test/objects.d.ts.map +1 -1
  140. package/lib/test/objects.js +3 -1
  141. package/lib/test/objects.js.map +1 -1
  142. package/package.json +12 -11
  143. package/webda.module.json +135 -41
@@ -25,8 +25,10 @@ export interface CommandOptions {
25
25
  * - `"initialized"` (default): runs after `Core.init()` — full runtime including service.init() (DB, network).
26
26
  * - `"resolved"`: runs after `Core.resolve()` only — services are constructed and resolve()d but init() is skipped.
27
27
  * Use for build-time codegen hooks that shouldn't touch the network.
28
+ * - `"application"`: runs with the loaded application only — no Core, no service, the configuration is not
29
+ * decrypted. The method must be static. Use for tooling on the configuration files, like `webda config encrypt`.
28
30
  */
29
- phase?: "resolved" | "initialized";
31
+ phase?: "application" | "resolved" | "initialized";
30
32
  }
31
33
  /**
32
34
  * Declare a CLI command on a service method.
@@ -39,6 +41,10 @@ export interface CommandOptions {
39
41
  * - JSDoc `@description` on parameter provides help text for the flag
40
42
  * - JSDoc `@deprecated` on parameter marks the flag as deprecated
41
43
  *
44
+ * A handler returning a number sets the process exit code (the highest one when
45
+ * several services run the command); any other result exits with `0`. Log counts
46
+ * rather than returning them.
47
+ *
42
48
  * Multiple services can declare the same command name — they all run in
43
49
  * dependency-graph order. Use `--service=ServiceName` to filter at invocation.
44
50
  *
@@ -1 +1 @@
1
- {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/services/command.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,UAAU,GAAG,aAAa,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,eAAO,MAAM,OAAO;;;CAgBnB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,IAAI,CAAC,cAAc,EAAE,OAAO,CAAuB,4GAExF"}
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/services/command.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,aAAa,GAAG,UAAU,GAAG,aAAa,CAAC;CACpD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,eAAO,MAAM,OAAO;;;CAgBnB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,IAAI,CAAC,cAAc,EAAE,OAAO,CAAuB,4GAExF"}
@@ -10,6 +10,10 @@ import { createMethodDecorator } from "@webda/tsc-esm";
10
10
  * - JSDoc `@description` on parameter provides help text for the flag
11
11
  * - JSDoc `@deprecated` on parameter marks the flag as deprecated
12
12
  *
13
+ * A handler returning a number sets the process exit code (the highest one when
14
+ * several services run the command); any other result exits with `0`. Log counts
15
+ * rather than returning them.
16
+ *
13
17
  * Multiple services can declare the same command name — they all run in
14
18
  * dependency-graph order. Use `--service=ServiceName` to filter at invocation.
15
19
  *
@@ -1 +1 @@
1
- {"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/services/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAiCvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,qBAAqB,CAC1C,CACE,KAAU,EACV,OAAoC,EACpC,IAAY,EACZ,OAAO,GAAmB,EAAE,WAAW,EAAE,EAAE,EAAE,EAC7C,EAAE;IACF,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;IACzC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAW,CAAC,IAAI,CAAC;QACjD,IAAI;QACJ,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,MAAM,EAAE,OAAO,CAAC,IAAI;QACpB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,KAAK,EAAE,OAAO,CAAC,KAAK;KACrB,CAAC,CAAC;AACL,CAAC,CACF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,YAAY,CAAC,OAAO,GAAkC,EAAE,WAAW,EAAE,EAAE,EAAE;IACvF,OAAO,OAAO,CAAC,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;AAC7D,CAAC"}
1
+ {"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/services/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAmCvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,qBAAqB,CAC1C,CACE,KAAU,EACV,OAAoC,EACpC,IAAY,EACZ,OAAO,GAAmB,EAAE,WAAW,EAAE,EAAE,EAAE,EAC7C,EAAE;IACF,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;IACzC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAW,CAAC,IAAI,CAAC;QACjD,IAAI;QACJ,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,MAAM,EAAE,OAAO,CAAC,IAAI;QACpB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,KAAK,EAAE,OAAO,CAAC,KAAK;KACrB,CAAC,CAAC;AACL,CAAC,CACF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,YAAY,CAAC,OAAO,GAAkC,EAAE,WAAW,EAAE,EAAE,EAAE;IACvF,OAAO,OAAO,CAAC,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;AAC7D,CAAC"}
@@ -1,23 +1,58 @@
1
1
  import * as util from "util";
2
2
  import { CryptoServiceParameters, JWTOptions, KeysDefinition } from "./icryptoservice.js";
3
+ import { AuthenticatedEncryption } from "./authenticatedencryption.js";
4
+ import { PkiKeyring } from "./pki.encrypter.js";
5
+ import type { ConfigurationEncryption } from "../application/iconfiguration.js";
3
6
  import { Service } from "./service.js";
4
7
  import { OperationContext } from "../contexts/operationcontext.js";
5
- /** Wraps a secret string value, masking it in logs and inspect output */
8
+ import { type SecretFinding } from "./secretscheck.js";
9
+ /**
10
+ * A secret value decrypted from a `crypt:<encrypter>:<data>` configuration string
11
+ *
12
+ * The plain value is only available through {@link SecretString.getValue}: string
13
+ * conversion, `JSON.stringify` and `util.inspect` all return a mask, so the secret
14
+ * does not leak into logs, configuration dumps or serialized services.
15
+ *
16
+ * In a service parameters class, type a secret field as `string | SecretString`
17
+ * and read it with {@link SecretString.from}.
18
+ *
19
+ * `@secret` marks every property typed with this class as a secret in the generated
20
+ * schema (`x-webda-secret`), so `webda config encrypt` encrypts it and `--check` reports it when it is not encrypted.
21
+ *
22
+ * @type string
23
+ * @secret
24
+ */
6
25
  export declare class SecretString {
7
- protected str: string;
8
- protected encrypter: string;
26
+ #private;
27
+ /**
28
+ * Name of the encrypter that decrypted the value
29
+ */
30
+ readonly encrypter: string;
9
31
  /** Create a new SecretString
10
32
  * @param str - the secret value
11
- * @param encrypter - the encrypter service name
33
+ * @param encrypter - the encrypter name
12
34
  */
13
35
  constructor(str: string, encrypter: string);
14
36
  /**
15
37
  * Extract the plain string value, warning if the string is not encrypted
16
- * @param value - the value to set
17
- * @param path - the path
18
- * @returns the result string
38
+ *
39
+ * The warning never contains the value itself, only the optional path.
40
+ *
41
+ * @param value - the secret, or a plain string
42
+ * @param path - the configuration path of the value, used in the warning
43
+ * @returns the plain value
19
44
  */
20
45
  static from(value: string | SecretString, path?: string): string;
46
+ /**
47
+ * Replace every SecretString in a structure by its plain value
48
+ *
49
+ * Use it to pass a configuration object holding secrets to a third-party client
50
+ * that expects plain strings. The structure is copied, not modified.
51
+ *
52
+ * @param value - the structure to unwrap
53
+ * @returns a copy with plain values
54
+ */
55
+ static unwrap<T = any>(value: T): T;
21
56
  /**
22
57
  * Get the underlying secret value
23
58
  * @returns the result string
@@ -28,6 +63,11 @@ export declare class SecretString {
28
63
  * @returns the result string
29
64
  */
30
65
  toString(): string;
66
+ /**
67
+ * Return a masked representation to prevent secret leakage through JSON
68
+ * @returns the result string
69
+ */
70
+ toJSON(): string;
31
71
  /**
32
72
  * Custom inspect handler to mask the secret in Node.js util.inspect
33
73
  * @param depth - the depth level
@@ -37,6 +77,68 @@ export declare class SecretString {
37
77
  */
38
78
  [util.inspect.custom](depth: any, options: any, inspect: any): string;
39
79
  }
80
+ /**
81
+ * A parsed encrypted or to-encrypt configuration value
82
+ */
83
+ export interface EncryptedValue {
84
+ mode: "encrypt" | "crypt";
85
+ /**
86
+ * `sencrypt:` or `scrypt:`: decrypted to a plain string instead of a SecretString
87
+ */
88
+ plain: boolean;
89
+ /**
90
+ * Encrypter name, undefined for `encrypt:<value>` when no default encrypter is set
91
+ */
92
+ encrypter: string | undefined;
93
+ data: string;
94
+ /**
95
+ * The encrypter is written in the value, false when the default encrypter is used
96
+ */
97
+ explicit: boolean;
98
+ }
99
+ /**
100
+ * Parse an encrypted or to-encrypt configuration value
101
+ *
102
+ * `crypt:` and `scrypt:` values always name their encrypter. For `encrypt:` and `sencrypt:`, the
103
+ * first segment is the encrypter when it is a registered encrypter name: otherwise the whole
104
+ * remainder is the plain value, encrypted by the default encrypter.
105
+ *
106
+ * @param value - the configuration value
107
+ * @param defaultEncrypter - the encrypter of `encrypt:<value>`
108
+ * @returns undefined if the value is not an encryption string
109
+ */
110
+ export declare function parseEncryptedValue(value: string, defaultEncrypter?: string): EncryptedValue | undefined;
111
+ /**
112
+ * Options of the configuration encryption and decryption
113
+ */
114
+ export interface ConfigurationEncryptionOptions {
115
+ /**
116
+ * The encryption settings, `parameters.configurationEncryption`
117
+ *
118
+ * Read from `data.parameters.configurationEncryption` when not given
119
+ */
120
+ settings?: ConfigurationEncryption;
121
+ /**
122
+ * The application path, relative paths of the encrypters resolve against it
123
+ */
124
+ appPath?: string;
125
+ }
126
+ /**
127
+ * State of one encryption or decryption pass
128
+ */
129
+ interface EncryptionPass {
130
+ settings: ConfigurationEncryption;
131
+ context: EncrypterContext;
132
+ /**
133
+ * Encrypters already configured in this pass
134
+ */
135
+ configured: Set<string>;
136
+ /**
137
+ * Encrypter to re-encrypt the encrypted values with
138
+ */
139
+ migrate?: string;
140
+ upgrade?: boolean;
141
+ }
40
142
  export type KeysRegistry = {
41
143
  /**
42
144
  * Contains the instanceId of the last
@@ -56,20 +158,60 @@ export type KeysRegistry = {
56
158
  */
57
159
  current: string;
58
160
  };
161
+ /**
162
+ * Context given to {@link StringEncrypter.configure}
163
+ */
164
+ export interface EncrypterContext {
165
+ /**
166
+ * Absolute application path, so relative key paths resolve against it
167
+ */
168
+ appPath: string;
169
+ /**
170
+ * "encrypt" when called from `webda config encrypt`, "decrypt" at runtime
171
+ */
172
+ mode: "encrypt" | "decrypt";
173
+ }
59
174
  /**
60
175
  * Encrypt/Decrypt string
176
+ *
177
+ * The encrypted output is stored after `crypt:<encrypter>:` in a configuration file:
178
+ * it must be a single-line string.
61
179
  */
62
180
  export interface StringEncrypter {
181
+ /**
182
+ * Optional: receive `parameters.configurationEncryption.encrypters[<name>]`
183
+ * before the first encrypt or decrypt of a configuration
184
+ *
185
+ * It can be called again when the configuration changes.
186
+ *
187
+ * @param options - the encrypter options, an empty object if not set
188
+ * @param context - the application path and the mode
189
+ */
190
+ configure?(options: any, context: EncrypterContext): void | Promise<void>;
191
+ /**
192
+ * Optional: tell if an encrypted value must be re-encrypted by `webda config encrypt --upgrade`
193
+ *
194
+ * Every value is re-encrypted when it is not implemented.
195
+ *
196
+ * @param data - the encrypted value
197
+ * @returns true to re-encrypt it
198
+ */
199
+ needsUpgrade?(data: string): boolean;
63
200
  /**
64
201
  * Encrypt a string
65
- * @param data
66
- * @returns
202
+ * @param data - the plain value
203
+ * @param options - encrypter specific options
204
+ * @returns the encrypted value
67
205
  */
68
206
  encrypt(data: string, options?: any): Promise<string>;
69
207
  /**
70
208
  * Decrypt a string
71
- * @param data
72
- * @returns
209
+ *
210
+ * It must throw if the data cannot be decrypted, never return garbage.
211
+ *
212
+ * @param data - the encrypted value
213
+ * @param options - encrypter specific options
214
+ * @returns the plain value
73
215
  */
74
216
  decrypt(data: string, options?: any): Promise<string>;
75
217
  }
@@ -80,15 +222,30 @@ export declare class CryptoService<T extends CryptoServiceParameters = CryptoSer
80
222
  private static encrypters;
81
223
  /**
82
224
  * Register an encrypter for configuration
83
- * @param name - the name to use
225
+ *
226
+ * Values written as `encrypt:<name>:<plain>` are then encrypted by it with `webda config encrypt`,
227
+ * and `crypt:<name>:<data>` values are decrypted by it when the configuration is loaded.
228
+ *
229
+ * Register it as a side effect of a module that the application loads (a Modda file), so it is
230
+ * available before the services are created.
231
+ *
232
+ * @param name - the name to use, letters, digits, `_`, `-` and `.` only
84
233
  * @param encrypter - the encrypter implementation
85
- * @param encrypter.encrypt - the encrypter.encrypt
86
- * @param encrypter.decrypt - the encrypter.decrypt
87
234
  */
88
- static registerEncrypter(name: string, encrypter: {
89
- encrypt: (data: string) => Promise<string>;
90
- decrypt: (data: string) => Promise<string>;
91
- }): void;
235
+ static registerEncrypter(name: string, encrypter: StringEncrypter): void;
236
+ /**
237
+ * Get a registered encrypter
238
+ * @param name - the encrypter name
239
+ * @returns the encrypter or undefined
240
+ */
241
+ static getEncrypter(name: string): StringEncrypter | undefined;
242
+ /**
243
+ * Get the encrypter for a value, with a helpful error if missing
244
+ * @param name - the encrypter name
245
+ * @param path - the configuration path, for the error message
246
+ * @returns the encrypter
247
+ */
248
+ protected static requireEncrypter(name: string, path: (string | number)[]): StringEncrypter;
92
249
  currentSymetricKey: string;
93
250
  currentAsymetricKey: {
94
251
  publicKey: string;
@@ -196,17 +353,233 @@ export declare class CryptoService<T extends CryptoServiceParameters = CryptoSer
196
353
  */
197
354
  getJWTHeader(token: string): any;
198
355
  /**
199
- * Encrypt configuration
200
- * @param data - the data to process
201
- * @returns the result
356
+ * Start an encryption or decryption pass
357
+ * @param data - the configuration
358
+ * @param options - the options
359
+ * @param path - the path of data
360
+ * @param mode - encrypt or decrypt
361
+ * @returns the pass
362
+ */
363
+ protected static startPass(data: any, options: ConfigurationEncryptionOptions, path: (string | number)[], mode: "encrypt" | "decrypt"): EncryptionPass;
364
+ /**
365
+ * Get an encrypter, configured for this pass
366
+ * @param name - the encrypter name
367
+ * @param pass - the current pass
368
+ * @param path - the configuration path, for messages
369
+ * @returns the encrypter
202
370
  */
203
- static encryptConfiguration(data: any): Promise<any>;
371
+ protected static useEncrypter(name: string, pass: EncryptionPass, path: (string | number)[]): Promise<StringEncrypter>;
204
372
  /**
373
+ * Encrypt the `encrypt:[<encrypter>:]<plain>` and `sencrypt:[<encrypter>:]<plain>` values of a configuration
205
374
  *
206
- * @param data - the data to process
207
- * @returns the result
375
+ * The structure is modified in place, so a comment-preserving document loaded with
376
+ * `FileUtils.load` can be saved back with its comments.
377
+ *
378
+ * `encrypt:<plain>` uses the default encrypter, `parameters.configurationEncryption.default`. The output
379
+ * always names its encrypter.
380
+ *
381
+ * @param data - the configuration, or a single value
382
+ * @param options - options
383
+ * @param options.migrate - also re-encrypt the already encrypted values with this encrypter, with the
384
+ * default encrypter when `""`, or with their own encrypter when `true` (same as `upgrade`)
385
+ * @param options.upgrade - also re-encrypt the already encrypted values with their own encrypter, to its
386
+ * current format or key
387
+ * @param path - the path of data, for error messages
388
+ * @returns the encrypted data
389
+ */
390
+ static encryptConfiguration(data: any, options?: {
391
+ migrate?: string | boolean;
392
+ upgrade?: boolean;
393
+ } & ConfigurationEncryptionOptions, path?: (string | number)[]): Promise<any>;
394
+ /**
395
+ * Encrypt the values of a configuration, see {@link encryptConfiguration}
396
+ * @param data - the configuration, or a single value
397
+ * @param pass - the current pass
398
+ * @param path - the path of data
399
+ * @returns the encrypted data
400
+ */
401
+ protected static encryptValues(data: any, pass: EncryptionPass, path: (string | number)[]): Promise<any>;
402
+ /**
403
+ * Decrypt one value with an encrypter, with a message that never contains the value
404
+ * @param encrypter - the encrypter name
405
+ * @param data - the encrypted data
406
+ * @param path - the configuration path
407
+ * @param pass - the current pass, to configure the encrypter
408
+ * @returns the plain value
208
409
  */
209
- static decryptConfiguration(data: any): Promise<any>;
410
+ protected static decryptValue(encrypter: string, data: string, path: (string | number)[], pass?: EncryptionPass): Promise<string>;
411
+ /**
412
+ * Decrypt the `crypt:` and `scrypt:` values of a configuration
413
+ *
414
+ * - `crypt:<encrypter>:<data>` becomes a {@link SecretString}
415
+ * - `scrypt:<encrypter>:<data>` becomes a plain string, for a module that cannot handle SecretString
416
+ *
417
+ * The input is not modified: a decrypted copy is returned. Only plain objects and
418
+ * arrays are traversed.
419
+ *
420
+ * A value still marked `encrypt:` is kept as is, with a warning.
421
+ *
422
+ * @param data - the configuration, or a single value
423
+ * @param path - the path of data, for messages
424
+ * @param options - the encryption settings and the application path
425
+ * @returns the decrypted copy
426
+ */
427
+ static decryptConfiguration(data: any, path?: (string | number)[], options?: ConfigurationEncryptionOptions): Promise<any>;
428
+ /**
429
+ * Decrypt the values of a configuration, see {@link decryptConfiguration}
430
+ * @param data - the configuration, or a single value
431
+ * @param pass - the current pass
432
+ * @param path - the path of data
433
+ * @returns the decrypted copy
434
+ */
435
+ protected static decryptValues(data: any, pass: EncryptionPass, path: (string | number)[]): Promise<any>;
436
+ /**
437
+ * Get the encryption settings of the application, merged with the ones of a configuration file
438
+ * @param data - the configuration file content
439
+ * @returns the settings
440
+ */
441
+ protected static getEncryptionSettings(data?: any): ConfigurationEncryption;
442
+ /**
443
+ * Encrypt the marked values of a configuration file, keeping its comments
444
+ *
445
+ * Prefix a value with `encrypt:[<encrypter>:]` (SecretString once decrypted) or
446
+ * `sencrypt:[<encrypter>:]` (plain string once decrypted) then run this command.
447
+ *
448
+ * @param file - the configuration file (json, jsonc or yaml) to update
449
+ * @param migrate - re-encrypt the already encrypted values with this encrypter, the default one when empty
450
+ * @param upgrade - re-encrypt the already encrypted values with their own encrypter, to its current format or key
451
+ * @returns the number of values changed
452
+ */
453
+ encryptConfigurationFile(file: string, migrate?: string, upgrade?: boolean): Promise<number>;
454
+ /**
455
+ * Encrypt the secrets of the configuration files, keeping their comments, or check them
456
+ *
457
+ * Encrypts the values marked `encrypt:` or `sencrypt:`, and the plain values of the secret fields: the fields
458
+ * typed `SecretString` or tagged `@secret` in their service parameters, marked `x-webda-secret` in the compiled
459
+ * schemas. The plain secrets are encrypted with the default encrypter.
460
+ *
461
+ * Without `file`, it updates the application configuration and the file of the selected deployment.
462
+ *
463
+ * With `check`, nothing is written: it fails when a secret is not encrypted. It needs no key, so it runs in CI.
464
+ * Only the paths are reported, never the values.
465
+ *
466
+ * It only needs the loaded application: the configuration is not decrypted and no service is created.
467
+ *
468
+ * @param file - the configuration file (json, jsonc or yaml) to update
469
+ * @param migrate - re-encrypt the already encrypted values with this encrypter, the default one when empty
470
+ * @param upgrade - re-encrypt the already encrypted values with their own encrypter, to its current format or key
471
+ * @param check - only check that the secrets are encrypted, write nothing
472
+ * @param strict - with check, report the values still marked `encrypt:` as failures
473
+ * @param format - with check, output format: text or json
474
+ * @param none - with check, accept the values kept in clear text with `crypt:none:`, false to fail on them
475
+ * @param exclude - secret paths to leave alone, comma-separated: not checked, not auto-encrypted
476
+ * @returns with check, 1 when a secret is not encrypted, otherwise 0
477
+ */
478
+ static encryptConfigurationFile(
479
+ /** @alias f @description Configuration file to update (json, jsonc or yaml), the application and deployment files by default */
480
+ file?: string,
481
+ /** @description Re-encrypt the already encrypted values with this encrypter, the default one when empty */
482
+ migrate?: string,
483
+ /** @description Re-encrypt the already encrypted values with their own encrypter, to its current format or key */
484
+ upgrade?: boolean,
485
+ /** @description Only check that the secrets are encrypted, write nothing and fail if one is not */
486
+ check?: boolean,
487
+ /** @description With --check, report the values marked encrypt: as failures */
488
+ strict?: boolean,
489
+ /** @description With --check, output format: text or json */
490
+ format?: "text" | "json",
491
+ /** @description With --check, accept the values kept in clear text with crypt:none: (--no-none to fail on them) */
492
+ none?: boolean,
493
+ /** @description Secret paths to leave alone, comma-separated (services.demo.password, units[*].token, $.parameters.**) */
494
+ exclude?: string): Promise<number>;
495
+ /**
496
+ * The configuration files to encrypt or check
497
+ * @param file - the file given on the command line
498
+ * @returns the absolute paths: the file, or the application configuration and the selected deployment file
499
+ */
500
+ protected static getConfigurationFiles(file?: string): string[];
501
+ /**
502
+ * Check that the secrets of configuration files are encrypted
503
+ * @param files - the files to check
504
+ * @param options - check options
505
+ * @param options.strict - report the values still marked `encrypt:` as failures
506
+ * @param options.format - output format: text or json
507
+ * @param options.none - accept the values kept in clear text with `crypt:none:`
508
+ * @param options.exclude - secret paths not checked, comma-separated
509
+ * @returns 1 when a secret is not encrypted, 0 otherwise
510
+ */
511
+ protected static checkFiles(files: string[], options?: {
512
+ strict?: boolean;
513
+ format?: "text" | "json";
514
+ none?: boolean;
515
+ exclude?: string;
516
+ }): number;
517
+ /**
518
+ * Find the unencrypted secrets of a configuration or deployment file
519
+ *
520
+ * A service the file overrides without its type takes the type of the application configuration, and the
521
+ * file `parameters` are also checked against the services of the application.
522
+ *
523
+ * @param data - the file content, as plain JSON
524
+ * @param exclude - secret paths to leave out, comma-separated patterns, see {@link secretPathExcluder}
525
+ * @returns the findings, with their location in data, without the values
526
+ */
527
+ static findFileSecrets(data: any, exclude?: string | string[]): SecretFinding[];
528
+ /**
529
+ * Encrypt the secrets of a configuration file, keeping its comments
530
+ *
531
+ * The values marked `encrypt:` or `sencrypt:`, and the plain values of the secret fields, with the default
532
+ * encrypter.
533
+ *
534
+ * @param file - the configuration file (json, jsonc or yaml) to update
535
+ * @param migrate - re-encrypt the already encrypted values with this encrypter, the default one when empty
536
+ * @param upgrade - re-encrypt the already encrypted values with their own encrypter, to its current format or key
537
+ * @param exclude - secret paths not auto-encrypted, comma-separated patterns, see {@link secretPathExcluder}
538
+ * @returns the number of values changed
539
+ */
540
+ static encryptFile(file: string, migrate?: string, upgrade?: boolean, exclude?: string | string[]): Promise<number>;
541
+ /**
542
+ * Get the keyring of the `pki` encrypter, as configured for the application
543
+ * @param data - a configuration file content, its settings override the application ones
544
+ * @returns the keyring
545
+ */
546
+ protected static getPkiKeyring(data?: any): PkiKeyring;
547
+ /**
548
+ * Generate a key pair for the `pki` encrypter
549
+ *
550
+ * The public key is written in the public keys directory, to commit. The private key is written
551
+ * outside of it, to store in the runtime secrets (a Kubernetes Secret for example), never in the repository.
552
+ *
553
+ * @param kid - the key id
554
+ * @param bits - the RSA modulus length
555
+ * @param out - the private key file
556
+ * @returns the written files
557
+ */
558
+ static pkiGenerate(
559
+ /** @description Key id, for example 2026-10 */
560
+ kid: string,
561
+ /** @description RSA modulus length */
562
+ bits?: number,
563
+ /** @description Private key file, ./<kid>.pem by default */
564
+ out?: string): Promise<{
565
+ publicKey: string;
566
+ privateKey: string;
567
+ }>;
568
+ /**
569
+ * List the public keys of the `pki` encrypter and the number of values encrypted with each key in a file
570
+ *
571
+ * A key with no value left can be retired.
572
+ *
573
+ * @param file - the configuration file to inspect
574
+ * @returns the active key, the public keys and the values count by kid
575
+ */
576
+ static pkiList(
577
+ /** @alias f @description Configuration file to inspect (json, jsonc or yaml) */
578
+ file: string): Promise<{
579
+ activeKey?: string;
580
+ publicKeys: string[];
581
+ values: Record<string, number>;
582
+ }>;
210
583
  /**
211
584
  * Decrypt data
212
585
  * @param token - the token
@@ -226,6 +599,13 @@ export declare class CryptoService<T extends CryptoServiceParameters = CryptoSer
226
599
  */
227
600
  rotate(): Promise<void>;
228
601
  }
602
+ /**
603
+ * Prefix of the current encrypted format of the built-in encrypters
604
+ *
605
+ * Legacy values (AES-256-CTR, unauthenticated) have no prefix: base64 never contains `:`.
606
+ */
607
+ export declare const ENCRYPTION_FORMAT_V2 = "v2:";
608
+ export { AuthenticatedEncryption };
229
609
  export default CryptoService;
230
610
  /**
231
611
  * Return the CryptoService
@@ -1 +1 @@
1
- {"version":3,"file":"cryptoservice.service.d.ts","sourceRoot":"","sources":["../../src/services/cryptoservice.service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B,OAAO,EAAE,uBAAuB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;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