@stacksjs/rpx 0.11.7 → 0.11.9
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.
- package/dist/bin/cli.js +144 -142
- package/dist/cert-inspect.d.ts +15 -0
- package/dist/daemon-runner.d.ts +3 -0
- package/dist/https.d.ts +32 -2
- package/dist/index.d.ts +23 -0
- package/dist/index.js +81 -78
- package/dist/macos-trust.d.ts +40 -0
- package/package.json +1 -1
- package/src/cert-inspect.ts +69 -0
- package/src/daemon-runner.ts +15 -2
- package/src/daemon.ts +29 -7
- package/src/https.ts +94 -53
- package/src/index.ts +25 -0
- package/src/macos-trust.ts +175 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalize openssl / security fingerprint output to uppercase hex without separators.
|
|
3
|
+
*/
|
|
4
|
+
export declare function normalizeSha256Fingerprint(raw: string): string;
|
|
5
|
+
export declare function readCertSha256Fingerprint(certPath: string): string | null;
|
|
6
|
+
export declare function readCertCommonName(certPath: string): string | null;
|
|
7
|
+
export declare function certIncludesSanHostnames(certPath: string, hostnames: string[]): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* True when :443 (or `port`) presents a chain trusted by `caPath` for `domain`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function verifyHttpsChain(domain: string, caPath: string, port?: number): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Parse `security find-certificate -Z` listing lines into SHA-256 hashes.
|
|
14
|
+
*/
|
|
15
|
+
export declare function parseSha256HashesFromSecurityListing(listing: string): string[];
|
package/dist/daemon-runner.d.ts
CHANGED
package/dist/https.d.ts
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { config } from './config';
|
|
2
|
+
import { MACOS_CA_TRUST_FLAGS, MACOS_SYSTEM_KEYCHAIN, getMacosLoginKeychainPath, isRootCaFingerprintInKeychains, isRootCaTrustedForSsl, pruneStaleRootCas, trustRootCaForBrowsers } from './macos-trust';
|
|
2
3
|
import type { ProxyConfigs, ProxyOption, ProxyOptions, SSLConfig, TlsConfig } from './types';
|
|
3
4
|
/**
|
|
4
5
|
* Returns the canonical Root CA cert + key paths inside `basePath`.
|
|
5
6
|
*/
|
|
6
7
|
export declare function getRootCAPaths(basePath: string): RootCAPaths;
|
|
8
|
+
/** Paths for the shared multi-host daemon cert under `~/.stacks/ssl`. */
|
|
9
|
+
export declare function getSharedDaemonCertPaths(sslDir: string): {
|
|
10
|
+
certPath: string
|
|
11
|
+
keyPath: string
|
|
12
|
+
caCertPath: string
|
|
13
|
+
rootCA: RootCAPaths
|
|
14
|
+
};
|
|
7
15
|
/**
|
|
8
16
|
* Resolves SSL paths based on configuration
|
|
9
17
|
*/
|
|
@@ -26,9 +34,11 @@ export declare function loadSSLConfig(options: ProxyOption): Promise<SSLConfig |
|
|
|
26
34
|
/**
|
|
27
35
|
* Force trust a certificate - exposing for direct use
|
|
28
36
|
*/
|
|
29
|
-
export declare function forceTrustCertificate(certPath: string): Promise<boolean>;
|
|
37
|
+
export declare function forceTrustCertificate(certPath: string, options?: { serverName?: string, verbose?: boolean }): Promise<boolean>;
|
|
30
38
|
export declare function generateCertificate(options: ProxyOptions): Promise<void>;
|
|
31
39
|
export declare function getSSLConfig(): { key: string, cert: string, ca?: string } | null;
|
|
40
|
+
/** Clear in-process TLS cache so the next generate/load picks up new files on disk. */
|
|
41
|
+
export declare function clearSslConfigCache(): void;
|
|
32
42
|
// needs to accept the options
|
|
33
43
|
export declare function checkExistingCertificates(options?: ProxyOptions): Promise<SSLConfig | null>;
|
|
34
44
|
export declare function httpsConfig(options: ProxyOption | ProxyOptions, verbose?: boolean): TlsConfig;
|
|
@@ -40,8 +50,28 @@ export declare function cleanupCertificates(domain: string, verbose?: boolean):
|
|
|
40
50
|
* Checks if a certificate is trusted by the system (macOS only for now)
|
|
41
51
|
* If options.regenerateUntrustedCerts is false, always returns true (skips trust check)
|
|
42
52
|
*/
|
|
43
|
-
export declare function isCertTrusted(certPath: string, options?: { verbose?: boolean, regenerateUntrustedCerts?: boolean }): Promise<boolean>;
|
|
53
|
+
export declare function isCertTrusted(certPath: string, options?: { verbose?: boolean, regenerateUntrustedCerts?: boolean, serverName?: string }): Promise<boolean>;
|
|
44
54
|
export declare interface RootCAPaths {
|
|
45
55
|
caCertPath: string
|
|
46
56
|
caKeyPath: string
|
|
47
57
|
}
|
|
58
|
+
export {
|
|
59
|
+
MACOS_CA_TRUST_FLAGS,
|
|
60
|
+
MACOS_SYSTEM_KEYCHAIN,
|
|
61
|
+
RPX_ROOT_CA_COMMON_NAME,
|
|
62
|
+
getMacosLoginKeychainPath,
|
|
63
|
+
getMacosTrustKeychains,
|
|
64
|
+
isRootCaFingerprintInKeychains,
|
|
65
|
+
isRootCaTrustedForSsl,
|
|
66
|
+
listCertSha256HashesByCommonName,
|
|
67
|
+
pruneStaleRootCas,
|
|
68
|
+
trustRootCaForBrowsers,
|
|
69
|
+
} from './macos-trust';
|
|
70
|
+
export {
|
|
71
|
+
certIncludesSanHostnames,
|
|
72
|
+
normalizeSha256Fingerprint,
|
|
73
|
+
parseSha256HashesFromSecurityListing,
|
|
74
|
+
readCertCommonName,
|
|
75
|
+
readCertSha256Fingerprint,
|
|
76
|
+
verifyHttpsChain,
|
|
77
|
+
} from './cert-inspect';
|
package/dist/index.d.ts
CHANGED
|
@@ -20,12 +20,35 @@ export {
|
|
|
20
20
|
export {
|
|
21
21
|
checkExistingCertificates,
|
|
22
22
|
cleanupCertificates,
|
|
23
|
+
clearSslConfigCache,
|
|
23
24
|
forceTrustCertificate,
|
|
24
25
|
generateCertificate,
|
|
26
|
+
getRootCAPaths,
|
|
27
|
+
getSharedDaemonCertPaths,
|
|
25
28
|
httpsConfig,
|
|
26
29
|
isCertTrusted,
|
|
27
30
|
loadSSLConfig,
|
|
28
31
|
} from './https';
|
|
32
|
+
export {
|
|
33
|
+
MACOS_CA_TRUST_FLAGS,
|
|
34
|
+
MACOS_SYSTEM_KEYCHAIN,
|
|
35
|
+
RPX_ROOT_CA_COMMON_NAME,
|
|
36
|
+
getMacosLoginKeychainPath,
|
|
37
|
+
getMacosTrustKeychains,
|
|
38
|
+
isRootCaFingerprintInKeychains,
|
|
39
|
+
isRootCaTrustedForSsl,
|
|
40
|
+
listCertSha256HashesByCommonName,
|
|
41
|
+
pruneStaleRootCas,
|
|
42
|
+
trustRootCaForBrowsers,
|
|
43
|
+
} from './macos-trust';
|
|
44
|
+
export {
|
|
45
|
+
certIncludesSanHostnames,
|
|
46
|
+
normalizeSha256Fingerprint,
|
|
47
|
+
parseSha256HashesFromSecurityListing,
|
|
48
|
+
readCertCommonName,
|
|
49
|
+
readCertSha256Fingerprint,
|
|
50
|
+
verifyHttpsChain,
|
|
51
|
+
} from './cert-inspect';
|
|
29
52
|
export { DefaultPortManager, findAvailablePort, isPortInUse, portManager } from './port-manager';
|
|
30
53
|
export {
|
|
31
54
|
gcStaleEntries,
|