@agent-custody/receipts 0.16.10 → 0.16.12
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/README.md +32 -12
- package/dist/approval-requests.d.ts +114 -0
- package/dist/approval-requests.js +198 -0
- package/dist/approval.d.ts +8 -0
- package/dist/approval.js +10 -3
- package/dist/check.js +14 -0
- package/dist/cli.js +184 -5
- package/dist/completeness.d.ts +11 -2
- package/dist/completeness.js +45 -9
- package/dist/config.d.ts +6 -0
- package/dist/config.js +19 -1
- package/dist/console-page.js +87 -2
- package/dist/console.js +72 -0
- package/dist/crypto.d.ts +2 -0
- package/dist/crypto.js +2 -1
- package/dist/delegation.d.ts +1 -1
- package/dist/delegation.js +19 -2
- package/dist/did-key.d.ts +2 -0
- package/dist/did-key.js +21 -1
- package/dist/door-app.js +1 -1
- package/dist/door-core.d.ts +385 -0
- package/dist/door-core.js +757 -0
- package/dist/door-error-rates.d.ts +102 -0
- package/dist/door-error-rates.js +178 -0
- package/dist/door-form.d.ts +7 -2
- package/dist/door-form.js +52 -4
- package/dist/door-measure.d.ts +153 -0
- package/dist/door-measure.js +325 -0
- package/dist/door-signals.d.ts +414 -0
- package/dist/door-signals.js +555 -0
- package/dist/door-test-set.d.ts +43 -0
- package/dist/door-test-set.js +117 -0
- package/dist/door-worker.d.ts +148 -0
- package/dist/door-worker.js +283 -0
- package/dist/door.d.ts +11 -293
- package/dist/door.js +45 -755
- package/dist/gateway-http.d.ts +1 -6
- package/dist/gateway-http.js +2 -19
- package/dist/gateway.js +24 -3
- package/dist/grant-header.d.ts +8 -0
- package/dist/grant-header.js +19 -0
- package/dist/index.d.ts +11 -2
- package/dist/index.js +6 -1
- package/dist/issue.d.ts +2 -16
- package/dist/issue.js +2 -12
- package/dist/lock.d.ts +5 -0
- package/dist/lock.js +1 -1
- package/dist/log-http.d.ts +37 -0
- package/dist/log-http.js +74 -0
- package/dist/log-sink.d.ts +3 -37
- package/dist/log-sink.js +5 -71
- package/dist/log.d.ts +2 -27
- package/dist/log.js +2 -173
- package/dist/merkle.d.ts +27 -0
- package/dist/merkle.js +175 -0
- package/dist/object-issuer.d.ts +29 -0
- package/dist/object-issuer.js +172 -0
- package/dist/receipt-pending.d.ts +16 -0
- package/dist/receipt-pending.js +14 -0
- package/dist/web-bot-auth.d.ts +26 -6
- package/dist/web-bot-auth.js +116 -56
- package/docs/approvals.md +33 -0
- package/docs/completeness.md +44 -5
- package/docs/console.md +11 -4
- package/docs/door-error-rates.md +490 -0
- package/docs/door-languages.md +3 -1
- package/docs/door-middleware.md +6 -1
- package/docs/door-quickstart.md +53 -17
- package/docs/door-signals.md +117 -7
- package/docs/door-worker.md +94 -0
- package/docs/door.md +41 -12
- package/docs/github-action.md +2 -2
- package/docs/tutorials.md +6 -0
- package/docs/verification.md +1 -1
- package/package.json +4 -1
- package/vectors/audit.json +27 -27
- package/vectors/canonical.json +5 -5
- package/vectors/receipts.json +1645 -1549
package/dist/door.d.ts
CHANGED
|
@@ -1,230 +1,10 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type { DoorConfig
|
|
3
|
-
import { type Envelope, type PublicKeyRef } from "./crypto.ts";
|
|
4
|
-
import { type Delegation } from "./delegation.ts";
|
|
1
|
+
import { type IncomingMessage, type ServerResponse } from "node:http";
|
|
2
|
+
import type { DoorConfig } from "./config.ts";
|
|
5
3
|
import { type FlushResult } from "./issue.ts";
|
|
6
|
-
import { type SignatureCheck, type SignedRequest } from "./web-bot-auth.ts";
|
|
7
|
-
import { type ArrivalPartner } from "./door-partner.ts";
|
|
8
4
|
import { type LogSink } from "./log-sink.ts";
|
|
9
5
|
import { type ReceiptExporter } from "./otel.ts";
|
|
10
|
-
import type
|
|
11
|
-
export
|
|
12
|
-
/** on every answer the door gives: the receipt that records the decision */
|
|
13
|
-
export declare const RECEIPT_HEADER = "x-agent-custody-receipt";
|
|
14
|
-
/** on every answer: `verified`, `claimed`, or `unknown`, what the door made of the arrival */
|
|
15
|
-
export declare const CLASS_HEADER = "x-agent-custody-class";
|
|
16
|
-
/** the fact the door records for every arrival, and the policy reads as `context.facts.arrival` */
|
|
17
|
-
export declare const ARRIVAL_FACT = "arrival";
|
|
18
|
-
/** the header an agent may use to name itself without a grant; recorded as claimed, never checked */
|
|
19
|
-
export declare const AGENT_HEADER = "x-agent-custody-agent";
|
|
20
|
-
/** in authz mode: the original request's method and target, as nginx `auth_request` and Envoy `ext_authz` are configured to send them */
|
|
21
|
-
export declare const ORIGINAL_METHOD_HEADER = "x-original-method";
|
|
22
|
-
export declare const ORIGINAL_URI_HEADER = "x-original-uri";
|
|
23
|
-
/** the reason an allowed authz receipt carries: the door decided, and the proxy, not the door, relays */
|
|
24
|
-
export declare const AUTHZ_ALLOWED_REASON = "allowed; the door answered the proxy's authz check and relays nothing: the proxy relays the request, and the door sees neither its body nor the origin's answer";
|
|
25
|
-
export type ArrivalClass = "verified" | "claimed" | "unknown";
|
|
26
|
-
/** What the door observed about one arrival. Every field is the door's own observation; none is the caller's claim about itself except `declared`, which says so. */
|
|
27
|
-
export interface Arrival {
|
|
28
|
-
class: ArrivalClass;
|
|
29
|
-
/** the agent named in a verified grant, else the signature agent of a verified signature, else the name the caller declared, else "unknown" */
|
|
30
|
-
subject: string;
|
|
31
|
-
/**
|
|
32
|
-
* What became of the grant header: a trusted grant in scope for this route, one out of scope, one that did not verify,
|
|
33
|
-
* one revoked (`revoked`: it, or a grant above it in its chain, is in `revokedGrants`, or that file cannot be read),
|
|
34
|
-
* one presented by another agent (`wrong-sender`: the request is signed by a signature agent the grant does not name),
|
|
35
|
-
* or none.
|
|
36
|
-
*/
|
|
37
|
-
grant: "verified" | "out-of-scope" | "invalid" | "revoked" | "wrong-sender" | "absent";
|
|
38
|
-
grantError?: string;
|
|
39
|
-
/** What became of an RFC 9421 signature tagged `web-bot-auth`: see `SignatureCheck`. `unchecked` when the door has no `webBotAuth` config */
|
|
40
|
-
signature: SignatureCheck["outcome"];
|
|
41
|
-
/** the `Signature-Agent` origin; checked only when `signature` is `verified` */
|
|
42
|
-
signatureAgent?: string;
|
|
43
|
-
/** the signature's keyid, the RFC 7638 thumbprint of the agent's key; checked only when `signature` is `verified` */
|
|
44
|
-
signatureKeyid?: string;
|
|
45
|
-
signatureError?: string;
|
|
46
|
-
/** the agent name from the `x-agent-custody-agent` header, when sent; a claim */
|
|
47
|
-
declared?: string;
|
|
48
|
-
remote: string;
|
|
49
|
-
method: string;
|
|
50
|
-
path: string;
|
|
51
|
-
route: string;
|
|
52
|
-
/** how often this source has arrived lately, counted by this door process; set by the door, absent from `classifyArrival` alone */
|
|
53
|
-
rate?: ArrivalRate;
|
|
54
|
-
/** what became of the challenge token, when the door is configured to challenge; absent otherwise, and from `classifyArrival` alone */
|
|
55
|
-
challenge?: ArrivalChallenge;
|
|
56
|
-
/** what became of the question to the partner engine, when the door asks one about this route; absent otherwise, and from `classifyArrival` alone. The verdict itself is the `partner` fact, present only when `outcome` is `verified` */
|
|
57
|
-
partner?: ArrivalPartner;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* The outcome of a human challenge. `passed`: the provider confirmed the token, so the provider judged a person present
|
|
61
|
-
* at the time it was solved. `failed`: the provider refused it, with its error codes. `unavailable`: the provider did
|
|
62
|
-
* not answer in time. `absent`: no token was sent. A passed challenge does not change `class`: it says nothing about who
|
|
63
|
-
* the arrival is, only that a provider's test was passed in front of it.
|
|
64
|
-
*/
|
|
65
|
-
export interface ArrivalChallenge {
|
|
66
|
-
provider: "turnstile" | "hcaptcha";
|
|
67
|
-
outcome: "passed" | "failed" | "unavailable" | "absent";
|
|
68
|
-
error?: string;
|
|
69
|
-
}
|
|
70
|
-
/** a provider token is about 2 KB; a longer value is refused as failed without calling the provider */
|
|
71
|
-
export declare const MAX_CHALLENGE_TOKEN = 4096;
|
|
72
|
-
export interface ChallengeCheck {
|
|
73
|
-
provider: "turnstile" | "hcaptcha";
|
|
74
|
-
secret: string;
|
|
75
|
-
token: string;
|
|
76
|
-
/** the client's address, sent as `remoteip` only when the door knows it is the client's and not a proxy's */
|
|
77
|
-
remoteIp?: string;
|
|
78
|
-
/** the hostnames of the pages that render the widget, lowercase */
|
|
79
|
-
hostnames: string[];
|
|
80
|
-
/** the widget's action, when one is required (Turnstile) */
|
|
81
|
-
action?: string;
|
|
82
|
-
/** the public site key; sent to hCaptcha, whose secret belongs to the account, so a token from another of its site keys is refused */
|
|
83
|
-
siteKey?: string;
|
|
84
|
-
timeoutMs: number;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Asks the provider whether the token is good. The token and the secret go to the provider only; neither is recorded,
|
|
88
|
-
* and a redirect is never followed, since it would resend both to the Location's host. `success` is not enough: the
|
|
89
|
-
* token must have been issued on one of the site's own hostnames, and for the configured action, or a token solved on
|
|
90
|
-
* another site with this site key, or for another widget, would pass.
|
|
91
|
-
*/
|
|
92
|
-
export declare function verifyChallengeToken(check: ChallengeCheck, f: typeof fetch): Promise<ArrivalChallenge>;
|
|
93
|
-
/**
|
|
94
|
-
* Arrivals from one source in the last 10 seconds (`burst`) and 60 seconds (`minute`), this one included, whatever the
|
|
95
|
-
* policy decided about them. The source is the agent a verified grant names, else the arrival's address. One process's
|
|
96
|
-
* memory: the count starts at one when the door starts, and two doors do not share it.
|
|
97
|
-
*/
|
|
98
|
-
export interface ArrivalRate {
|
|
99
|
-
by: "agent" | "remote";
|
|
100
|
-
burst: number;
|
|
101
|
-
minute: number;
|
|
102
|
-
}
|
|
103
|
-
export declare const RATE_BURST_MS = 10000;
|
|
104
|
-
export declare const RATE_MINUTE_MS = 60000;
|
|
105
|
-
export interface RateTrackerLimits {
|
|
106
|
-
/** sources kept at once; past this the least recently seen is forgotten. Default 10000 */
|
|
107
|
-
maxSources?: number;
|
|
108
|
-
/** a source key longer than this is kept as its sha256. Default 256 */
|
|
109
|
-
maxKeyLength?: number;
|
|
110
|
-
}
|
|
111
|
-
export interface RateTracker {
|
|
112
|
-
hit(source: string): {
|
|
113
|
-
burst: number;
|
|
114
|
-
minute: number;
|
|
115
|
-
};
|
|
116
|
-
/** sources kept now */
|
|
117
|
-
size(): number;
|
|
118
|
-
/** stops the sweep */
|
|
119
|
-
close(): void;
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Counts arrivals per source over the two windows. Each source keeps its arrival times in order with two heads that only
|
|
123
|
-
* move forward, so one arrival costs the same however many came before it in the window; the array is compacted once
|
|
124
|
-
* half of it is behind the minute head. The source key comes from the arrival, and with `trustProxy` the client may
|
|
125
|
-
* choose it, so the map bounds itself: at most `maxSources` keys, none longer than `maxKeyLength`, and a source with no
|
|
126
|
-
* arrival in the last minute is dropped every minute whether or not traffic goes on. A source forgotten early counts
|
|
127
|
-
* again from 1, which only lowers what a pace rule sees for a client that floods the map. The clock is monotonic
|
|
128
|
-
* (`performance.now`), so a step of the wall clock (an NTP correction, a VM resume) neither keeps old arrivals inside
|
|
129
|
-
* the windows nor drops new ones; an injected clock that goes back is held at the last time seen. `now` is for tests.
|
|
130
|
-
*/
|
|
131
|
-
export declare function createRateTracker(now?: () => number, limits?: RateTrackerLimits): RateTracker;
|
|
132
|
-
export interface Classified {
|
|
133
|
-
arrival: Arrival;
|
|
134
|
-
/** set when the arrival is verified by a grant: the grant, as presented */
|
|
135
|
-
delegation?: {
|
|
136
|
-
envelope: Envelope;
|
|
137
|
-
grant: Delegation;
|
|
138
|
-
principalKeyid: string;
|
|
139
|
-
};
|
|
140
|
-
/** set when a verified signature names the arrival's agent: alone, or bound to the grant that names the same agent */
|
|
141
|
-
signer?: {
|
|
142
|
-
agent: string;
|
|
143
|
-
keyid: string;
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* The record of the call keeps what arrived; the policy reads a copy Cedar accepts. Cedar has no `null` and no
|
|
148
|
-
* non-integer number, and refuses the whole request on either, so a body with `"coupon": null` or `"price": 9.99` would
|
|
149
|
-
* be denied whatever the policy says. In the copy a `null` is dropped and a number that is not a safe integer becomes its
|
|
150
|
-
* string; a rule that compares `price` as a number then errors, and the call is denied by that rule rather than by Cedar.
|
|
151
|
-
*/
|
|
152
|
-
export declare function cedarArgs(value: unknown): unknown;
|
|
153
|
-
/**
|
|
154
|
-
* What a receipt records of an arrival when the config gives its route no capture rule: the method, the path, the
|
|
155
|
-
* recorded headers, and the body's size in clear; the query and the body withheld, each a salted commitment. A query can
|
|
156
|
-
* carry an API key and a form body a password. Set a rule for the route (or `"*"`) to record more in clear.
|
|
157
|
-
*/
|
|
158
|
-
export declare const DOOR_DEFAULT_CAPTURE: {
|
|
159
|
-
args: {
|
|
160
|
-
mode: "digest";
|
|
161
|
-
clear: string[];
|
|
162
|
-
};
|
|
163
|
-
result: {
|
|
164
|
-
mode: "clear";
|
|
165
|
-
};
|
|
166
|
-
facts: {
|
|
167
|
-
mode: "clear";
|
|
168
|
-
};
|
|
169
|
-
};
|
|
170
|
-
/**
|
|
171
|
-
* The path as the origin will read it: each segment percent-decoded once, so that `/%61dmin` falls under `/admin/*`, and
|
|
172
|
-
* empty segments merged, so that `//admin/users` and `/admin//users` fall under it too (nginx, Apache, and many
|
|
173
|
-
* frameworks merge them, and the origin would serve the admin page to an arrival the door matched as something else).
|
|
174
|
-
* A trailing slash is kept. Refused when a segment does not decode, or decodes to a slash, a backslash, or a dot
|
|
175
|
-
* segment: the origin would then read a path the door did not match. `relay` is the merged, decoded path encoded once
|
|
176
|
-
* more, the form the origin is sent, so the door and the origin read one path.
|
|
177
|
-
*/
|
|
178
|
-
export declare function normalizePath(pathname: string): {
|
|
179
|
-
path: string;
|
|
180
|
-
relay: string;
|
|
181
|
-
} | {
|
|
182
|
-
problem: string;
|
|
183
|
-
};
|
|
184
|
-
/** What the door reads of a request: its method, its target, its headers, and the socket's address. A Node `IncomingMessage` is one; the in-process door builds one from a fetch `Request`. */
|
|
185
|
-
export interface DoorRequest {
|
|
186
|
-
method?: string | undefined;
|
|
187
|
-
url?: string | undefined;
|
|
188
|
-
headers: IncomingHttpHeaders;
|
|
189
|
-
/** every value of each field, as Node keeps them; read for an HTTP message signature */
|
|
190
|
-
headersDistinct?: Record<string, string[] | undefined>;
|
|
191
|
-
socket: {
|
|
192
|
-
remoteAddress?: string | undefined;
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* The original request an authz check asks about, from `X-Original-Method` and `X-Original-URI`, with the check's own
|
|
197
|
-
* headers and address. The check request's own method and path are the proxy's (nginx sends GET to a fixed location),
|
|
198
|
-
* so both headers are required, and a check without them is refused rather than decided on the proxy's request.
|
|
199
|
-
*/
|
|
200
|
-
export declare function authzTarget(req: DoorRequest): DoorRequest | {
|
|
201
|
-
problem: string;
|
|
202
|
-
};
|
|
203
|
-
/** The route an arrival falls under: the first configured route whose methods and decoded path match, else the unmatched name. A trailing slash matches as no trailing slash. */
|
|
204
|
-
export declare function matchRoute(routes: DoorRouteConfig[], unmatched: string, method: string, pathname: string): string;
|
|
205
|
-
/**
|
|
206
|
-
* The arrival's address: the socket's, or with trustProxy the last address in `X-Forwarded-For`, the one the proxy in
|
|
207
|
-
* front of the door appended. Everything before it was sent by the client, which may write what it likes there.
|
|
208
|
-
*/
|
|
209
|
-
export declare function remoteOf(req: DoorRequest, trustProxy: boolean): string;
|
|
210
|
-
/**
|
|
211
|
-
* The request as RFC 9421 reads it: the target as received, the `Host` as the authority, and every value of each field.
|
|
212
|
-
* A request without `headersDistinct` (a fetch request, which joins repeated fields with ", ") gives each field's value as
|
|
213
|
-
* it holds it.
|
|
214
|
-
*/
|
|
215
|
-
export declare function signedRequestOf(req: DoorRequest): SignedRequest;
|
|
216
|
-
/**
|
|
217
|
-
* What the arrival presented, checked where it can be. A grant signed by a trusted principal, in its window, naming this
|
|
218
|
-
* route among its scopes, makes the arrival `verified` and its principal attested. A grant that is out of scope, expired,
|
|
219
|
-
* or signed by a stranger leaves the arrival `claimed`: it asserted an identity the door could not accept for this route.
|
|
220
|
-
* Without a grant, a Web Bot Auth signature the door verified (`signature`, from `createWebBotAuthVerifier`) makes the
|
|
221
|
-
* arrival `verified` as its signature agent. With both, the signature binds the grant to its sender when the grant names
|
|
222
|
-
* that signature agent; a grant presented under another agent's signature is `wrong-sender` and the arrival `claimed`.
|
|
223
|
-
* An `x-agent-custody-agent` header or a signature that did not verify alone is `claimed`. Nothing at all is `unknown`.
|
|
224
|
-
* Without `signature`, a `Signature-Input` header is recorded as `unchecked`. `revoked`, when given, says why a grant
|
|
225
|
-
* that verified is revoked (from its chain's digests, leaf first), or null when it is not; a revoked grant is `claimed`.
|
|
226
|
-
*/
|
|
227
|
-
export declare function classifyArrival(req: DoorRequest, trusted: PublicKeyRef[], route: string, trustProxy: boolean, at: string, signature?: SignatureCheck, revoked?: (chainDigests: string[]) => string | null): Classified;
|
|
6
|
+
import { type BodyRead, type DoorAnswer, type DoorCore, type DoorIO } from "./door-core.ts";
|
|
7
|
+
export * from "./door-core.ts";
|
|
228
8
|
export interface DoorOptions {
|
|
229
9
|
/** the log to append to, in place of the one the config names; for embedding and tests */
|
|
230
10
|
log?: LogSink;
|
|
@@ -244,78 +24,17 @@ export interface DoorHost {
|
|
|
244
24
|
formScript?(): string | null;
|
|
245
25
|
close(): Promise<void>;
|
|
246
26
|
}
|
|
247
|
-
/** The body as the door read it: whole, or how many bytes had arrived when it passed the limit. */
|
|
248
|
-
export type BodyRead = {
|
|
249
|
-
body: Buffer;
|
|
250
|
-
} | {
|
|
251
|
-
oversized: true;
|
|
252
|
-
bytes: number;
|
|
253
|
-
};
|
|
254
27
|
/** The body, or how many bytes had arrived when it passed the limit; the rest is drained and dropped. */
|
|
255
28
|
export declare function readBody(req: IncomingMessage, max: number): Promise<BodyRead>;
|
|
256
|
-
/** A fetch body, or how many bytes had arrived when it passed the limit; the rest is not read. */
|
|
257
|
-
export declare function readStream(stream: ReadableStream<Uint8Array> | null, max: number): Promise<BodyRead>;
|
|
258
|
-
/** The query as own properties: a parameter named `constructor` or `__proto__` is a parameter, never an inherited member or the prototype. */
|
|
259
|
-
export declare function queryOf(url: URL): Record<string, string | string[]>;
|
|
260
|
-
type Execution = ReceiptPredicate["execution"];
|
|
261
|
-
type ReceiptHead = Omit<ReceiptPredicate, "session" | "model" | "execution" | "authorization">;
|
|
262
|
-
/** One arrival as the door decided it, before anything was relayed or passed on. */
|
|
263
|
-
export interface DoorDecision {
|
|
264
|
-
receiptId: string;
|
|
265
|
-
arrival: Arrival;
|
|
266
|
-
method: string;
|
|
267
|
-
url: URL;
|
|
268
|
-
route: string;
|
|
269
|
-
/** the path decoded and encoded once, the form the origin is sent; absent when the path did not decode cleanly */
|
|
270
|
-
relay?: string;
|
|
271
|
-
/** the body, or null when it passed `maxBodyBytes` */
|
|
272
|
-
body: Buffer | null;
|
|
273
|
-
/** set when the door refuses the arrival: what the receipt records, and the status the arrival is answered */
|
|
274
|
-
refused?: {
|
|
275
|
-
execution: Execution;
|
|
276
|
-
status: number;
|
|
277
|
-
};
|
|
278
|
-
head: ReceiptHead;
|
|
279
|
-
authorization?: AuthorizationBundle;
|
|
280
|
-
}
|
|
281
|
-
/** An answer the door gives itself, in place of the origin's or the app's. */
|
|
282
|
-
export interface DoorAnswer {
|
|
283
|
-
status: number;
|
|
284
|
-
headers: Record<string, string>;
|
|
285
|
-
body: string;
|
|
286
|
-
}
|
|
287
29
|
/**
|
|
288
|
-
* The door's
|
|
289
|
-
* policy
|
|
290
|
-
*
|
|
291
|
-
* the same process, is the caller's.
|
|
30
|
+
* The door's I/O from a config's files and the process environment: the key file, the trusted principal key files, the
|
|
31
|
+
* policy file re-read when it changes, the revocation file re-read when it changes, and receipts written by the file
|
|
32
|
+
* issuer to the receipts directory and the config's log.
|
|
292
33
|
*/
|
|
293
|
-
export
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
admit(): boolean;
|
|
298
|
-
release(): void;
|
|
299
|
-
busy(): DoorAnswer;
|
|
300
|
-
/** `framework`, when given, is the receipt's `issuer.framework` in place of the core's. `read` is null when the door never sees the body (an authz check): the receipt then records none */
|
|
301
|
-
decide(req: DoorRequest, receiptId: string, read: ((max: number) => Promise<BodyRead>) | null, framework?: string): Promise<DoorDecision>;
|
|
302
|
-
/** a header the door consumed and never passes on: the grant (and `Authorization` when it carried it), the declared agent, the challenge token */
|
|
303
|
-
consumed(name: string, req: DoorRequest, arrival: Arrival): boolean;
|
|
304
|
-
/** writes the receipt; null when it could not be written, after saying why on stderr */
|
|
305
|
-
record(d: DoorDecision, execution: Execution): Promise<{
|
|
306
|
-
logPending: boolean;
|
|
307
|
-
} | null>;
|
|
308
|
-
/** the door's headers on every answer */
|
|
309
|
-
mark(d: DoorDecision, logPending: boolean): Record<string, string>;
|
|
310
|
-
/** the answer to an arrival the door refused */
|
|
311
|
-
refusal(d: DoorDecision, logPending: boolean): DoorAnswer;
|
|
312
|
-
/** the answer when the receipt could not be written: what happened, so that nobody retries a refund that went through */
|
|
313
|
-
unrecorded(d: DoorDecision, execution: Execution, notSent: boolean): DoorAnswer;
|
|
314
|
-
flushOutbox(): Promise<FlushResult>;
|
|
315
|
-
pendingReceipts(): number;
|
|
316
|
-
close(): void;
|
|
317
|
-
}
|
|
318
|
-
/** The decision loop for a door config; `framework` is the receipt's `issuer.framework`. Throws when the config cannot be served. */
|
|
34
|
+
export declare function nodeDoorIO(cfg: DoorConfig, options?: Omit<DoorOptions, "fetch"> & {
|
|
35
|
+
fetch?: typeof fetch;
|
|
36
|
+
}): DoorIO;
|
|
37
|
+
/** The decision loop for a door config, reading its files and the environment; `framework` is the receipt's `issuer.framework`. Throws when the config cannot be served. */
|
|
319
38
|
export declare function createDoorCore(cfg: DoorConfig, options: Omit<DoorOptions, "fetch"> & {
|
|
320
39
|
fetch?: typeof fetch;
|
|
321
40
|
}, framework: string): DoorCore;
|
|
@@ -337,4 +56,3 @@ export interface RunningDoor {
|
|
|
337
56
|
* form protector script.
|
|
338
57
|
*/
|
|
339
58
|
export declare function serveDoor(host: DoorHost, opts: DoorServerOptions): Promise<RunningDoor>;
|
|
340
|
-
export {};
|