sliftutils 1.2.38 → 1.2.39
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/index.d.ts +17 -0
- package/misc/https/httpsCerts.d.ts +17 -0
- package/misc/https/httpsCerts.ts +4 -4
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -156,6 +156,11 @@ declare module "sliftutils/misc/https/dns" {
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
declare module "sliftutils/misc/https/httpsCerts" {
|
|
159
|
+
/// <reference path="node-forge-ed25519.d.ts" />
|
|
160
|
+
/// <reference path="../../storage/storage.d.ts" />
|
|
161
|
+
/// <reference types="node" />
|
|
162
|
+
/// <reference types="node" />
|
|
163
|
+
import * as forge from "node-forge";
|
|
159
164
|
/** NOTE: We also generate the domain *.domain */
|
|
160
165
|
export declare const getHTTPSCert: {
|
|
161
166
|
(key: string): Promise<{
|
|
@@ -174,6 +179,18 @@ declare module "sliftutils/misc/https/httpsCerts" {
|
|
|
174
179
|
cert: string;
|
|
175
180
|
}> | undefined;
|
|
176
181
|
};
|
|
182
|
+
export declare const getAccountKey: (domain: string) => Promise<string>;
|
|
183
|
+
export declare function parseCert(PEMorDER: string | Buffer): forge.pki.Certificate;
|
|
184
|
+
export declare function normalizeCertToPEM(PEMorDER: string | Buffer): string;
|
|
185
|
+
export declare function generateCert(config: {
|
|
186
|
+
accountKey: string;
|
|
187
|
+
domain: string;
|
|
188
|
+
altDomains?: string[];
|
|
189
|
+
}): Promise<{
|
|
190
|
+
domains: string[];
|
|
191
|
+
key: string;
|
|
192
|
+
cert: string;
|
|
193
|
+
}>;
|
|
177
194
|
|
|
178
195
|
}
|
|
179
196
|
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/// <reference path="node-forge-ed25519.d.ts" />
|
|
2
|
+
/// <reference path="../../storage/storage.d.ts" />
|
|
3
|
+
/// <reference types="node" />
|
|
4
|
+
/// <reference types="node" />
|
|
5
|
+
import * as forge from "node-forge";
|
|
1
6
|
/** NOTE: We also generate the domain *.domain */
|
|
2
7
|
export declare const getHTTPSCert: {
|
|
3
8
|
(key: string): Promise<{
|
|
@@ -16,3 +21,15 @@ export declare const getHTTPSCert: {
|
|
|
16
21
|
cert: string;
|
|
17
22
|
}> | undefined;
|
|
18
23
|
};
|
|
24
|
+
export declare const getAccountKey: (domain: string) => Promise<string>;
|
|
25
|
+
export declare function parseCert(PEMorDER: string | Buffer): forge.pki.Certificate;
|
|
26
|
+
export declare function normalizeCertToPEM(PEMorDER: string | Buffer): string;
|
|
27
|
+
export declare function generateCert(config: {
|
|
28
|
+
accountKey: string;
|
|
29
|
+
domain: string;
|
|
30
|
+
altDomains?: string[];
|
|
31
|
+
}): Promise<{
|
|
32
|
+
domains: string[];
|
|
33
|
+
key: string;
|
|
34
|
+
cert: string;
|
|
35
|
+
}>;
|
package/misc/https/httpsCerts.ts
CHANGED
|
@@ -91,7 +91,7 @@ export const getHTTPSCert = cache(async (domain: string): Promise<{ key: string;
|
|
|
91
91
|
});
|
|
92
92
|
|
|
93
93
|
|
|
94
|
-
const getAccountKey = async function getAccountKey(domain: string) {
|
|
94
|
+
export const getAccountKey = async function getAccountKey(domain: string) {
|
|
95
95
|
let accountKey = getKeyStore<string>(domain, "letsEncryptAccountKey");
|
|
96
96
|
let secret = await accountKey.get();
|
|
97
97
|
if (!secret) {
|
|
@@ -105,11 +105,11 @@ const getAccountKey = async function getAccountKey(domain: string) {
|
|
|
105
105
|
};
|
|
106
106
|
|
|
107
107
|
|
|
108
|
-
function parseCert(PEMorDER: string | Buffer) {
|
|
108
|
+
export function parseCert(PEMorDER: string | Buffer) {
|
|
109
109
|
return forge.pki.certificateFromPem(normalizeCertToPEM(PEMorDER));
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
function normalizeCertToPEM(PEMorDER: string | Buffer): string {
|
|
112
|
+
export function normalizeCertToPEM(PEMorDER: string | Buffer): string {
|
|
113
113
|
if (PEMorDER.toString().startsWith("-----BEGIN CERTIFICATE-----")) {
|
|
114
114
|
return PEMorDER.toString();
|
|
115
115
|
}
|
|
@@ -118,7 +118,7 @@ function normalizeCertToPEM(PEMorDER: string | Buffer): string {
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
|
|
121
|
-
async function generateCert(config: {
|
|
121
|
+
export async function generateCert(config: {
|
|
122
122
|
accountKey: string;
|
|
123
123
|
domain: string;
|
|
124
124
|
altDomains?: string[];
|