The best way to control Claude Code, Codex and more from any computer or phone

main
ts 90 lines 3.14 KB
Raw
1 import * as Data from "effect/Data";
2
3 /** A problem the CA attached to an order or one of its identifiers. */
4 export interface IdentifierProblem {
5 /** The identifier the problem concerns, when the CA said. */
6 readonly identifier?: string | undefined;
7 /** The `urn:ietf:params:acme:error:*` type. */
8 readonly type?: string | undefined;
9 /** Human-readable detail from the CA. */
10 readonly detail?: string | undefined;
11 }
12
13 /**
14 * The CA moved the order to `invalid`. Carries the problem documents the
15 * order and its authorizations reported, one per failed identifier where
16 * the CA said which.
17 */
18 export class OrderInvalid extends Data.TaggedError("ACME.OrderInvalid")<{
19 readonly orderUrl: string;
20 readonly problems: ReadonlyArray<IdentifierProblem>;
21 }> {
22 override get message() {
23 const details = this.problems
24 .map((p) => [p.identifier, p.type, p.detail].filter(Boolean).join(": "))
25 .join("; ");
26 return `ACME order ${this.orderUrl} is invalid${details ? `: ${details}` : ""}`;
27 }
28 }
29
30 /** The CA rejected the DNS-01 challenge for one identifier. */
31 export class ChallengeFailed extends Data.TaggedError("ACME.ChallengeFailed")<{
32 readonly identifier: string;
33 readonly type?: string | undefined;
34 readonly detail?: string | undefined;
35 }> {
36 override get message() {
37 return `DNS-01 challenge for ${this.identifier} failed${this.detail ? `: ${this.detail}` : ""}`;
38 }
39 }
40
41 /** The CA offered no `dns-01` challenge for an identifier. */
42 export class ChallengeUnsupported extends Data.TaggedError("ACME.ChallengeUnsupported")<{
43 readonly identifier: string;
44 readonly offered: ReadonlyArray<string>;
45 }> {
46 override get message() {
47 return `The CA offered no dns-01 challenge for ${this.identifier} (offered: ${this.offered.join(", ") || "none"})`;
48 }
49 }
50
51 /** The order never reached a terminal state within the polling budget. */
52 export class OrderTimeout extends Data.TaggedError("ACME.OrderTimeout")<{
53 readonly orderUrl: string;
54 readonly status: string;
55 }> {
56 override get message() {
57 return `ACME order ${this.orderUrl} is still "${this.status}" after the polling budget`;
58 }
59 }
60
61 /** The `_acme-challenge` TXT record never became visible to public resolvers. */
62 export class DnsPropagationTimeout extends Data.TaggedError("ACME.DnsPropagationTimeout")<{
63 readonly fqdn: string;
64 readonly value: string;
65 }> {
66 override get message() {
67 return `TXT ${this.fqdn} did not propagate within the wait budget`;
68 }
69 }
70
71 /** A DNS solver could not publish or remove a challenge record. */
72 export class DnsSolverError extends Data.TaggedError("ACME.DnsSolverError")<{
73 readonly message: string;
74 readonly cause?: unknown;
75 }> {}
76
77 /** A solver descriptor names a `type` no registered DNS provider handles. */
78 export class DnsSolverNotRegistered extends Data.TaggedError("ACME.DnsSolverNotRegistered")<{
79 readonly type: string;
80 }> {
81 override get message() {
82 return `No DNS-01 solver is registered for "${this.type}". Include ACME.providers() in the stack.`;
83 }
84 }
85
86 /** Key generation, CSR encoding or certificate parsing failed. */
87 export class PkiError extends Data.TaggedError("ACME.PkiError")<{
88 readonly message: string;
89 readonly cause?: unknown;
90 }> {}