@mohasinac/appkit 2.4.6 → 2.4.7
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.
|
@@ -33,15 +33,20 @@ function loadDatabase() {
|
|
|
33
33
|
// 2. Real newlines (set via CLI / multiline input)
|
|
34
34
|
// 3. Windows \r\n endings (copied on Windows)
|
|
35
35
|
// 4. Wrapped in double-quotes (pasted with JSON quotes intact)
|
|
36
|
+
// 5. UTF-8 BOM prefix (PowerShell pipe encoding artefact)
|
|
37
|
+
// 6. Trailing literal \r\n (PowerShell pipe newline artefact)
|
|
36
38
|
//
|
|
37
39
|
// OpenSSL 3 (Node 18+) rejects malformed PEM — ensure the key is normalised
|
|
38
40
|
// before passing it to `cert()`.
|
|
39
41
|
//
|
|
40
42
|
function parsePrivateKey(raw) {
|
|
41
43
|
return raw
|
|
44
|
+
.replace(/^/, "") // strip UTF-8 BOM (PowerShell pipe artefact)
|
|
42
45
|
.replace(/^["']|["']$/g, "") // strip optional surrounding quotes
|
|
43
46
|
.replace(/\\n/g, "\n") // literal \n → real newline
|
|
47
|
+
.replace(/\\r/g, "") // literal \r → remove
|
|
44
48
|
.replace(/\r\n/g, "\n") // Windows CRLF → LF
|
|
49
|
+
.replace(/\r/g, "") // stray CR → remove
|
|
45
50
|
.trim();
|
|
46
51
|
}
|
|
47
52
|
function get(key) {
|