@alchemy.run/acme 0.0.0 → 2.0.0-beta.84
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/LICENSE +201 -0
- package/README.md +48 -4
- package/lib/Account.d.ts +121 -0
- package/lib/Account.d.ts.map +1 -0
- package/lib/Account.js +163 -0
- package/lib/Account.js.map +1 -0
- package/lib/Certificate.d.ts +138 -0
- package/lib/Certificate.d.ts.map +1 -0
- package/lib/Certificate.js +157 -0
- package/lib/Certificate.js.map +1 -0
- package/lib/CertificateAuthority.d.ts +25 -0
- package/lib/CertificateAuthority.d.ts.map +1 -0
- package/lib/CertificateAuthority.js +22 -0
- package/lib/CertificateAuthority.js.map +1 -0
- package/lib/Client.d.ts +89 -0
- package/lib/Client.d.ts.map +1 -0
- package/lib/Client.js +237 -0
- package/lib/Client.js.map +1 -0
- package/lib/Der.d.ts +43 -0
- package/lib/Der.d.ts.map +1 -0
- package/lib/Der.js +138 -0
- package/lib/Der.js.map +1 -0
- package/lib/Dns.d.ts +59 -0
- package/lib/Dns.d.ts.map +1 -0
- package/lib/Dns.js +104 -0
- package/lib/Dns.js.map +1 -0
- package/lib/DnsSolver.d.ts +60 -0
- package/lib/DnsSolver.d.ts.map +1 -0
- package/lib/DnsSolver.js +48 -0
- package/lib/DnsSolver.js.map +1 -0
- package/lib/Errors.d.ts +93 -0
- package/lib/Errors.d.ts.map +1 -0
- package/lib/Errors.js +51 -0
- package/lib/Errors.js.map +1 -0
- package/lib/IssueCertificate.d.ts +76 -0
- package/lib/IssueCertificate.d.ts.map +1 -0
- package/lib/IssueCertificate.js +3 -0
- package/lib/IssueCertificate.js.map +1 -0
- package/lib/IssueCertificateHttp.d.ts +24 -0
- package/lib/IssueCertificateHttp.d.ts.map +1 -0
- package/lib/IssueCertificateHttp.js +56 -0
- package/lib/IssueCertificateHttp.js.map +1 -0
- package/lib/Pki.d.ts +56 -0
- package/lib/Pki.d.ts.map +1 -0
- package/lib/Pki.js +182 -0
- package/lib/Pki.js.map +1 -0
- package/lib/Providers.d.ts +30 -0
- package/lib/Providers.d.ts.map +1 -0
- package/lib/Providers.js +31 -0
- package/lib/Providers.js.map +1 -0
- package/lib/index.d.ts +12 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +12 -0
- package/lib/index.js.map +1 -0
- package/package.json +47 -3
- package/src/Account.ts +256 -0
- package/src/Certificate.ts +272 -0
- package/src/CertificateAuthority.ts +41 -0
- package/src/Client.ts +405 -0
- package/src/Der.ts +157 -0
- package/src/Dns.ts +227 -0
- package/src/DnsSolver.ts +109 -0
- package/src/Errors.ts +90 -0
- package/src/IssueCertificate.ts +89 -0
- package/src/IssueCertificateHttp.ts +67 -0
- package/src/Pki.ts +275 -0
- package/src/Providers.ts +39 -0
- package/src/index.ts +11 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,9 +1,53 @@
|
|
|
1
1
|
# @alchemy.run/acme
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
ACME certificates for [Alchemy](https://alchemy.run). Issue and renew TLS certificates from Let's Encrypt, ZeroSSL, Google Trust Services, or any ACME CA, independently of where you host, at deploy time or from inside an application.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
```sh
|
|
6
|
+
npm install alchemy @alchemy.run/acme @alchemy.run/cloudflare effect
|
|
7
|
+
```
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
An account and a certificate validated through a Cloudflare DNS zone:
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
```typescript
|
|
12
|
+
// alchemy.run.ts
|
|
13
|
+
import * as Alchemy from "alchemy";
|
|
14
|
+
import * as ACME from "@alchemy.run/acme";
|
|
15
|
+
import * as Cloudflare from "@alchemy.run/cloudflare";
|
|
16
|
+
import * as Config from "effect/Config";
|
|
17
|
+
import * as Effect from "effect/Effect";
|
|
18
|
+
import * as Layer from "effect/Layer";
|
|
19
|
+
|
|
20
|
+
export default Alchemy.Stack(
|
|
21
|
+
"Certificates",
|
|
22
|
+
{
|
|
23
|
+
providers: Layer.mergeAll(ACME.providers(), Cloudflare.providers()),
|
|
24
|
+
state: Alchemy.localState(),
|
|
25
|
+
},
|
|
26
|
+
Effect.gen(function* () {
|
|
27
|
+
const account = yield* ACME.Account("Issuer", {
|
|
28
|
+
ca: ACME.LetsEncryptStaging,
|
|
29
|
+
contact: ["mailto:ops@example.com"],
|
|
30
|
+
termsOfServiceAgreed: true,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const certificate = yield* ACME.Certificate("Site", {
|
|
34
|
+
account,
|
|
35
|
+
identifiers: ["example.com"],
|
|
36
|
+
solver: Cloudflare.ACME.ZoneSolver({
|
|
37
|
+
zoneId: Config.String("CLOUDFLARE_ZONE_ID"),
|
|
38
|
+
}),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
return { serial: certificate.serial, expires: certificate.notAfter };
|
|
42
|
+
}),
|
|
43
|
+
);
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Each deploy checks the certificate and renews it once it enters its renewal window. There is no background timer, so redeploy on a schedule.
|
|
47
|
+
|
|
48
|
+
## Learn more
|
|
49
|
+
|
|
50
|
+
- [ACME on alchemy.run](https://alchemy.run/acme)
|
|
51
|
+
- [Getting started](https://alchemy.run/acme/getting-started)
|
|
52
|
+
- [Certificate authorities](https://alchemy.run/acme/certificate-authorities)
|
|
53
|
+
- [Renewal](https://alchemy.run/acme/renewal)
|
package/lib/Account.d.ts
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import * as Provider from "alchemy/Provider";
|
|
2
|
+
import { Resource } from "alchemy/Resource";
|
|
3
|
+
import * as Redacted from "effect/Redacted";
|
|
4
|
+
import type { CertificateAuthority } from "./CertificateAuthority.ts";
|
|
5
|
+
import type { KeyAlgorithm } from "./Pki.ts";
|
|
6
|
+
import type { Providers } from "./Providers.ts";
|
|
7
|
+
export interface ExternalAccountBinding {
|
|
8
|
+
/** The key id the CA issued (ZeroSSL: `eab_kid`). */
|
|
9
|
+
keyId: string;
|
|
10
|
+
/** The base64url HMAC key the CA issued (ZeroSSL: `eab_hmac_key`). */
|
|
11
|
+
hmacKey: Redacted.Redacted<string> | string;
|
|
12
|
+
}
|
|
13
|
+
export interface AccountProps {
|
|
14
|
+
/**
|
|
15
|
+
* The certificate authority: a preset ({@link LetsEncrypt},
|
|
16
|
+
* {@link ZeroSSL}, …) or `{ directoryUrl }`. Changing it replaces the
|
|
17
|
+
* account.
|
|
18
|
+
*/
|
|
19
|
+
ca: CertificateAuthority;
|
|
20
|
+
/**
|
|
21
|
+
* Contact URLs (`mailto:…`) the CA notifies about expiry and incidents.
|
|
22
|
+
* Updated in place.
|
|
23
|
+
*/
|
|
24
|
+
contact?: string[];
|
|
25
|
+
/**
|
|
26
|
+
* You must agree to the CA's terms of service. Explicit on purpose —
|
|
27
|
+
* never defaulted.
|
|
28
|
+
*/
|
|
29
|
+
termsOfServiceAgreed: true;
|
|
30
|
+
/**
|
|
31
|
+
* External Account Binding for CAs that require one (ZeroSSL, Google
|
|
32
|
+
* Trust Services). Changing the key id replaces the account.
|
|
33
|
+
*/
|
|
34
|
+
eab?: ExternalAccountBinding;
|
|
35
|
+
/**
|
|
36
|
+
* Account key algorithm. Changing it replaces the account.
|
|
37
|
+
* @default "ES256"
|
|
38
|
+
*/
|
|
39
|
+
keyAlgorithm?: KeyAlgorithm;
|
|
40
|
+
}
|
|
41
|
+
export interface Account extends Resource<"ACME.Account", AccountProps, {
|
|
42
|
+
/** The CA's directory URL. */
|
|
43
|
+
directoryUrl: string;
|
|
44
|
+
/** PEM root trusted for the CA's HTTPS endpoint (private CAs only). */
|
|
45
|
+
trustedRoot: string | undefined;
|
|
46
|
+
/** The account URL the CA assigned — the `kid` on every later request. */
|
|
47
|
+
accountUrl: string;
|
|
48
|
+
/** Observed account status (`valid`, `deactivated`, `revoked`). */
|
|
49
|
+
status: string;
|
|
50
|
+
/** Observed contact URLs. */
|
|
51
|
+
contact: string[];
|
|
52
|
+
/** Account key algorithm. */
|
|
53
|
+
keyAlgorithm: KeyAlgorithm;
|
|
54
|
+
/** The account's private JWK (JSON). Sensitive; persisted in stack state. */
|
|
55
|
+
privateKey: Redacted.Redacted<string>;
|
|
56
|
+
}, never, Providers> {
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* An ACME account with a certificate authority — the identity that every
|
|
60
|
+
* {@link Certificate} and every runtime {@link IssueCertificate} call
|
|
61
|
+
* signs with. One per CA per stack.
|
|
62
|
+
*
|
|
63
|
+
* The account key is generated on first reconcile and persisted as a
|
|
64
|
+
* redacted value alongside the CA's account URL. Protect the state store
|
|
65
|
+
* as secret material; redaction alone does not encrypt the storage backend.
|
|
66
|
+
*
|
|
67
|
+
* ### Let's Encrypt
|
|
68
|
+
* **Example:** An account with Let's Encrypt
|
|
69
|
+
* ```typescript
|
|
70
|
+
* export const LetsEncrypt = ACME.Account("LetsEncrypt", {
|
|
71
|
+
* ca: ACME.LetsEncrypt,
|
|
72
|
+
* contact: ["mailto:ops@example.com"],
|
|
73
|
+
* termsOfServiceAgreed: true,
|
|
74
|
+
* });
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* ### External Account Binding
|
|
78
|
+
* ZeroSSL and Google Trust Services bind ACME accounts to an existing
|
|
79
|
+
* customer account with a key id + HMAC pair from their dashboard (ZeroSSL
|
|
80
|
+
* also mints them over its REST API — see `@distilled.cloud/zerossl`).
|
|
81
|
+
*
|
|
82
|
+
* **Example:** ZeroSSL
|
|
83
|
+
* ```typescript
|
|
84
|
+
* export const ZeroSsl = ACME.Account("ZeroSSL", {
|
|
85
|
+
* ca: ACME.ZeroSSL,
|
|
86
|
+
* eab: {
|
|
87
|
+
* keyId: Config.String("ZEROSSL_EAB_KID"),
|
|
88
|
+
* hmacKey: Config.Redacted("ZEROSSL_EAB_HMAC_KEY"),
|
|
89
|
+
* },
|
|
90
|
+
* termsOfServiceAgreed: true,
|
|
91
|
+
* });
|
|
92
|
+
* ```
|
|
93
|
+
*
|
|
94
|
+
* ### Private CAs
|
|
95
|
+
* A private CA (Pebble, step-ca) whose HTTPS certificate is not publicly
|
|
96
|
+
* trusted passes its root as `trustedRoot`.
|
|
97
|
+
*
|
|
98
|
+
* **Example:** Pebble
|
|
99
|
+
* ```typescript
|
|
100
|
+
* export const Pebble = ACME.Account("Pebble", {
|
|
101
|
+
* ca: { directoryUrl: "https://localhost:14000/dir", trustedRoot: pebbleRootPem },
|
|
102
|
+
* termsOfServiceAgreed: true,
|
|
103
|
+
* });
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* @resource
|
|
107
|
+
* @product Account
|
|
108
|
+
* @category Certificates
|
|
109
|
+
*/
|
|
110
|
+
export declare const Account: import("alchemy/Resource").ResourceClass<Account>;
|
|
111
|
+
declare const AccountUrlMissing_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
112
|
+
readonly _tag: "ACME.AccountUrlMissing";
|
|
113
|
+
} & Readonly<A>;
|
|
114
|
+
/** The CA answered `newAccount` without a `Location`, so the account has no URL. */
|
|
115
|
+
export declare class AccountUrlMissing extends AccountUrlMissing_base<{
|
|
116
|
+
readonly directoryUrl: string;
|
|
117
|
+
}> {
|
|
118
|
+
}
|
|
119
|
+
export declare const AccountProvider: () => import("effect/Layer").Layer<Provider.Provider<Account>, never, never>;
|
|
120
|
+
export {};
|
|
121
|
+
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AE,YAAY,CAAC;IAC3B,6EAA6E;IAC7E,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;CACvC,EACD,KAAK,EACL,SAAS,CACV;CAAG;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,eAAO,MAAM,OAAO,mDAAoC,CAAC;;;;AAEzD,oFAAoF;AACpF,qBAAa,iBAAkB,SAAQ,uBAA2C;IAChF,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B,CAAC;CAAG;AA2CL,eAAO,MAAM,eAAe,8EAmFxB,CAAC"}
|
package/lib/Account.js
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import * as Acme from "@distilled.cloud/acme";
|
|
2
|
+
import * as acme from "@distilled.cloud/acme/acme";
|
|
3
|
+
import { isResolved } from "alchemy/Diff";
|
|
4
|
+
import * as Provider from "alchemy/Provider";
|
|
5
|
+
import { Resource } from "alchemy/Resource";
|
|
6
|
+
import * as Data from "effect/Data";
|
|
7
|
+
import * as Effect from "effect/Effect";
|
|
8
|
+
import * as Redacted from "effect/Redacted";
|
|
9
|
+
import { accountLayer } from "./Client.js";
|
|
10
|
+
/**
|
|
11
|
+
* An ACME account with a certificate authority — the identity that every
|
|
12
|
+
* {@link Certificate} and every runtime {@link IssueCertificate} call
|
|
13
|
+
* signs with. One per CA per stack.
|
|
14
|
+
*
|
|
15
|
+
* The account key is generated on first reconcile and persisted as a
|
|
16
|
+
* redacted value alongside the CA's account URL. Protect the state store
|
|
17
|
+
* as secret material; redaction alone does not encrypt the storage backend.
|
|
18
|
+
*
|
|
19
|
+
* ### Let's Encrypt
|
|
20
|
+
* **Example:** An account with Let's Encrypt
|
|
21
|
+
* ```typescript
|
|
22
|
+
* export const LetsEncrypt = ACME.Account("LetsEncrypt", {
|
|
23
|
+
* ca: ACME.LetsEncrypt,
|
|
24
|
+
* contact: ["mailto:ops@example.com"],
|
|
25
|
+
* termsOfServiceAgreed: true,
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* ### External Account Binding
|
|
30
|
+
* ZeroSSL and Google Trust Services bind ACME accounts to an existing
|
|
31
|
+
* customer account with a key id + HMAC pair from their dashboard (ZeroSSL
|
|
32
|
+
* also mints them over its REST API — see `@distilled.cloud/zerossl`).
|
|
33
|
+
*
|
|
34
|
+
* **Example:** ZeroSSL
|
|
35
|
+
* ```typescript
|
|
36
|
+
* export const ZeroSsl = ACME.Account("ZeroSSL", {
|
|
37
|
+
* ca: ACME.ZeroSSL,
|
|
38
|
+
* eab: {
|
|
39
|
+
* keyId: Config.String("ZEROSSL_EAB_KID"),
|
|
40
|
+
* hmacKey: Config.Redacted("ZEROSSL_EAB_HMAC_KEY"),
|
|
41
|
+
* },
|
|
42
|
+
* termsOfServiceAgreed: true,
|
|
43
|
+
* });
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* ### Private CAs
|
|
47
|
+
* A private CA (Pebble, step-ca) whose HTTPS certificate is not publicly
|
|
48
|
+
* trusted passes its root as `trustedRoot`.
|
|
49
|
+
*
|
|
50
|
+
* **Example:** Pebble
|
|
51
|
+
* ```typescript
|
|
52
|
+
* export const Pebble = ACME.Account("Pebble", {
|
|
53
|
+
* ca: { directoryUrl: "https://localhost:14000/dir", trustedRoot: pebbleRootPem },
|
|
54
|
+
* termsOfServiceAgreed: true,
|
|
55
|
+
* });
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @resource
|
|
59
|
+
* @product Account
|
|
60
|
+
* @category Certificates
|
|
61
|
+
*/
|
|
62
|
+
export const Account = Resource("ACME.Account");
|
|
63
|
+
/** The CA answered `newAccount` without a `Location`, so the account has no URL. */
|
|
64
|
+
export class AccountUrlMissing extends Data.TaggedError("ACME.AccountUrlMissing") {
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Normalize to exactly one `Redacted` layer: a value that already came
|
|
68
|
+
* redacted (an SDK's sensitive field) wrapped again by the caller would
|
|
69
|
+
* otherwise sign with an object instead of the key.
|
|
70
|
+
*/
|
|
71
|
+
const unwrap = (value) => {
|
|
72
|
+
let inner = value;
|
|
73
|
+
while (Redacted.isRedacted(inner))
|
|
74
|
+
inner = Redacted.value(inner);
|
|
75
|
+
return Redacted.make(String(inner));
|
|
76
|
+
};
|
|
77
|
+
const credentialsOf = (props, accountKey, accountUrl) => ({
|
|
78
|
+
ca: props.ca,
|
|
79
|
+
accountKey,
|
|
80
|
+
accountUrl,
|
|
81
|
+
externalAccountBinding: props.eab === undefined
|
|
82
|
+
? undefined
|
|
83
|
+
: { keyId: props.eab.keyId, hmacKey: unwrap(props.eab.hmacKey) },
|
|
84
|
+
});
|
|
85
|
+
/** `newAccount` with `onlyReturnExisting` — the account, or `undefined`. */
|
|
86
|
+
const observeAccount = (credentials) => acme.newAccount({ onlyReturnExisting: true }).pipe(Effect.catchTag("AcmeAccountDoesNotExist", () => Effect.succeed(undefined)), Effect.provide(accountLayer(credentials)));
|
|
87
|
+
const sameContacts = (a, b) => {
|
|
88
|
+
const left = [...(a ?? [])].sort();
|
|
89
|
+
const right = [...(b ?? [])].sort();
|
|
90
|
+
return left.length === right.length && left.every((v, i) => v === right[i]);
|
|
91
|
+
};
|
|
92
|
+
export const AccountProvider = () => Provider.succeed(Account, {
|
|
93
|
+
stables: ["directoryUrl", "accountUrl", "keyAlgorithm", "privateKey"],
|
|
94
|
+
diff: Effect.fn(function* ({ news, olds, output }) {
|
|
95
|
+
if (news === undefined || !isResolved(news) || output === undefined) {
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
if (news.ca.directoryUrl !== output.directoryUrl ||
|
|
99
|
+
(news.keyAlgorithm ?? "ES256") !== output.keyAlgorithm ||
|
|
100
|
+
news.eab?.keyId !== olds?.eab?.keyId) {
|
|
101
|
+
return { action: "replace" };
|
|
102
|
+
}
|
|
103
|
+
return undefined;
|
|
104
|
+
}),
|
|
105
|
+
read: Effect.fn(function* ({ olds, output }) {
|
|
106
|
+
if (output === undefined || olds === undefined)
|
|
107
|
+
return undefined;
|
|
108
|
+
const credentials = credentialsOf(olds, output.privateKey, output.accountUrl);
|
|
109
|
+
const existing = yield* observeAccount(credentials);
|
|
110
|
+
if (existing === undefined)
|
|
111
|
+
return undefined;
|
|
112
|
+
return {
|
|
113
|
+
...output,
|
|
114
|
+
status: existing.status,
|
|
115
|
+
contact: existing.contact ?? [],
|
|
116
|
+
};
|
|
117
|
+
}),
|
|
118
|
+
reconcile: Effect.fn(function* ({ news, output }) {
|
|
119
|
+
const keyAlgorithm = news.keyAlgorithm ?? "ES256";
|
|
120
|
+
// Observe: the key is the identity; keep it across reconciles.
|
|
121
|
+
const accountKey = output?.privateKey ?? (yield* Acme.Jose.generateAccountKey(keyAlgorithm));
|
|
122
|
+
const credentials = credentialsOf(news, accountKey, output?.accountUrl);
|
|
123
|
+
let account = yield* observeAccount(credentials);
|
|
124
|
+
// Repeating newAccount with the same key returns the existing account.
|
|
125
|
+
if (account === undefined) {
|
|
126
|
+
account = yield* acme
|
|
127
|
+
.newAccount({
|
|
128
|
+
contact: news.contact,
|
|
129
|
+
termsOfServiceAgreed: true,
|
|
130
|
+
})
|
|
131
|
+
.pipe(Effect.provide(accountLayer(credentials)));
|
|
132
|
+
}
|
|
133
|
+
const accountUrl = account.location ?? output?.accountUrl;
|
|
134
|
+
if (accountUrl === undefined) {
|
|
135
|
+
return yield* new AccountUrlMissing({
|
|
136
|
+
directoryUrl: news.ca.directoryUrl,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
// Sync: contacts are the only mutable aspect.
|
|
140
|
+
const withKid = accountLayer(credentialsOf(news, accountKey, accountUrl));
|
|
141
|
+
if (!sameContacts(news.contact, account.contact)) {
|
|
142
|
+
account = yield* acme
|
|
143
|
+
.updateAccount({ url: accountUrl, contact: news.contact ?? [] })
|
|
144
|
+
.pipe(Effect.provide(withKid));
|
|
145
|
+
}
|
|
146
|
+
return {
|
|
147
|
+
directoryUrl: news.ca.directoryUrl,
|
|
148
|
+
trustedRoot: news.ca.trustedRoot,
|
|
149
|
+
accountUrl,
|
|
150
|
+
status: account.status,
|
|
151
|
+
contact: account.contact ?? [],
|
|
152
|
+
keyAlgorithm,
|
|
153
|
+
privateKey: accountKey,
|
|
154
|
+
};
|
|
155
|
+
}),
|
|
156
|
+
delete: Effect.fn(function* ({ olds, output }) {
|
|
157
|
+
const credentials = credentialsOf(olds, output.privateKey, output.accountUrl);
|
|
158
|
+
// Deactivation is permanent and idempotent: a deactivated account
|
|
159
|
+
// answers `unauthorized`, a purged one `accountDoesNotExist`.
|
|
160
|
+
yield* acme.updateAccount({ url: output.accountUrl, status: "deactivated" }).pipe(Effect.catchTag(["AcmeAccountDoesNotExist", "AcmeUnauthorized"], () => Effect.succeed(undefined)), Effect.provide(accountLayer(credentials)));
|
|
161
|
+
}),
|
|
162
|
+
});
|
|
163
|
+
//# sourceMappingURL=Account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Account.js","sourceRoot":"","sources":["../src/Account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAC9C,OAAO,KAAK,IAAI,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AACpC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,YAAY,EAA2B,MAAM,aAAa,CAAC;AA+DpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,MAAM,CAAC,MAAM,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