@dwk/activitypub 0.1.0-beta.0
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 +15 -0
- package/README.md +135 -0
- package/dist/as2.d.ts +117 -0
- package/dist/as2.d.ts.map +1 -0
- package/dist/as2.js +174 -0
- package/dist/as2.js.map +1 -0
- package/dist/config.d.ts +148 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +142 -0
- package/dist/config.js.map +1 -0
- package/dist/delivery.d.ts +43 -0
- package/dist/delivery.d.ts.map +1 -0
- package/dist/delivery.js +131 -0
- package/dist/delivery.js.map +1 -0
- package/dist/handler.d.ts +21 -0
- package/dist/handler.d.ts.map +1 -0
- package/dist/handler.js +293 -0
- package/dist/handler.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/log.d.ts +57 -0
- package/dist/log.d.ts.map +1 -0
- package/dist/log.js +53 -0
- package/dist/log.js.map +1 -0
- package/dist/nodeinfo.d.ts +33 -0
- package/dist/nodeinfo.d.ts.map +1 -0
- package/dist/nodeinfo.js +61 -0
- package/dist/nodeinfo.js.map +1 -0
- package/dist/object.d.ts +21 -0
- package/dist/object.d.ts.map +1 -0
- package/dist/object.js +722 -0
- package/dist/object.js.map +1 -0
- package/dist/signature.d.ts +108 -0
- package/dist/signature.d.ts.map +1 -0
- package/dist/signature.js +234 -0
- package/dist/signature.js.map +1 -0
- package/package.json +50 -0
- package/src/as2.ts +257 -0
- package/src/config.ts +291 -0
- package/src/delivery.ts +155 -0
- package/src/handler.ts +370 -0
- package/src/index.ts +90 -0
- package/src/log.ts +62 -0
- package/src/nodeinfo.ts +91 -0
- package/src/object.ts +883 -0
- package/src/signature.ts +355 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"AAAA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EAAE,CAAC,CAAC,CAAY,CAAC;IAChD,OAAO,IAAI,KAAK,CAAC,CAAC;AACpB,CAAC;AAED,qEAAqE;AACrE,KAAK,UAAU,aAAa,CAC1B,MAAsB,EACtB,GAAmB;IAEnB,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;QAC7C,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE;YACxD,MAAM,EAAE,KAAK;SACd,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,EAAE;YAAE,OAAO,EAAE,CAAC;QAC5B,MAAM,KAAK,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAgB,CAAC;QACrD,OAAO;YACL,KAAK,EAAE,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACxD,UAAU,EAAE,OAAO,KAAK,CAAC,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;SACxE,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@dwk/activitypub` — edge-native ActivityPub actor.
|
|
3
|
+
*
|
|
4
|
+
* A native [ActivityPub](https://www.w3.org/TR/activitypub/) actor rooted at the
|
|
5
|
+
* user's own domain, making the self-owned presence a first-class fediverse
|
|
6
|
+
* citizen (followers, replies, boosts) rather than a bridged guest. It mirrors
|
|
7
|
+
* the architecture proven in `@dwk/solid-pod`: a stateless Worker front door
|
|
8
|
+
* (routing + edge HTTP-signature verification) over a per-actor Durable Object
|
|
9
|
+
* that is the consistency authority for activity-`id` dedup, the
|
|
10
|
+
* follower/following/outbox collections, and the signed outbound delivery queue
|
|
11
|
+
* (retry/backoff via DO alarms). This is the second `@dwk` package to ship a
|
|
12
|
+
* Durable Object.
|
|
13
|
+
*
|
|
14
|
+
* The package is **not** protocol-agnostic: it is the ActivityPub endpoint. v1
|
|
15
|
+
* covers server-to-server federation (inbound `Follow`/`Undo`/`Create`/`Like`/
|
|
16
|
+
* `Announce`/`Delete` with signature verification and dedup; auto-`Accept` of
|
|
17
|
+
* follows; signed fan-out delivery), the actor document and paged
|
|
18
|
+
* `OrderedCollection`s, and NodeInfo discovery. Client-to-server authoring is
|
|
19
|
+
* out of scope — `@dwk/micropub` covers authoring, and the owner publish
|
|
20
|
+
* endpoint (`POST <actor>/outbox`) is the publish → `Create` fan-out seam.
|
|
21
|
+
*
|
|
22
|
+
* HTTP Message Signatures are implemented inline against the de-facto fediverse
|
|
23
|
+
* `draft-cavage` profile so the actor federates today; signing/verification sit
|
|
24
|
+
* behind the {@link ActivityPubConfig.verifyInboxSignature} seam so the
|
|
25
|
+
* forthcoming cross-standard `@dwk/http-signatures` package (issue #59) can be
|
|
26
|
+
* swapped in unchanged.
|
|
27
|
+
*
|
|
28
|
+
* @see spec/packages/activitypub.md
|
|
29
|
+
* @packageDocumentation
|
|
30
|
+
*/
|
|
31
|
+
export { createActivityPub, type ActivityPubHandler } from "./handler";
|
|
32
|
+
export { ActivityPubObject } from "./object";
|
|
33
|
+
export { resolveConfig, deriveIris, type ActivityPubConfig, type ActivityPubEnv, type ResolvedConfig, type InboxVerifier, } from "./config";
|
|
34
|
+
export { AS2_NS, AS2_CONTENT_TYPE, AS2_LD_CONTENT_TYPE, PUBLIC_AUDIENCE, buildActorDocument, buildCollection, buildCollectionPage, wantsActivityJson, as2ContentType, type ActorProfile, type ActorIris, type ActorDocumentOptions, type ActivityObject, } from "./as2";
|
|
35
|
+
export { buildNodeInfoDiscovery, buildNodeInfo20, buildNodeInfo21, type SoftwareInfo, type UsageCounts, } from "./nodeinfo";
|
|
36
|
+
export { signRequest, verifyInboxSignature, digestHeader, importPublicKey, importPrivateKey, type KeyResolver, type ResolvedKey, type VerifyResult, type VerifyFailureReason, type InboxRequest, type SignerKey, } from "./signature";
|
|
37
|
+
export { deliverActivity, assertPublicHttpsTarget, DeliveryBlockedError, type DeliveryResult, } from "./delivery";
|
|
38
|
+
export { ActivityPubLogEvent } from "./log";
|
|
39
|
+
export type { Logger, Metrics } from "@dwk/log";
|
|
40
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,iBAAiB,EAAE,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,EACL,aAAa,EACb,UAAU,EACV,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,aAAa,GACnB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,MAAM,EACN,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,oBAAoB,EACzB,KAAK,cAAc,GACpB,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,KAAK,YAAY,EACjB,KAAK,WAAW,GACjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,SAAS,GACf,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACpB,KAAK,cAAc,GACpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAC5C,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@dwk/activitypub` — edge-native ActivityPub actor.
|
|
3
|
+
*
|
|
4
|
+
* A native [ActivityPub](https://www.w3.org/TR/activitypub/) actor rooted at the
|
|
5
|
+
* user's own domain, making the self-owned presence a first-class fediverse
|
|
6
|
+
* citizen (followers, replies, boosts) rather than a bridged guest. It mirrors
|
|
7
|
+
* the architecture proven in `@dwk/solid-pod`: a stateless Worker front door
|
|
8
|
+
* (routing + edge HTTP-signature verification) over a per-actor Durable Object
|
|
9
|
+
* that is the consistency authority for activity-`id` dedup, the
|
|
10
|
+
* follower/following/outbox collections, and the signed outbound delivery queue
|
|
11
|
+
* (retry/backoff via DO alarms). This is the second `@dwk` package to ship a
|
|
12
|
+
* Durable Object.
|
|
13
|
+
*
|
|
14
|
+
* The package is **not** protocol-agnostic: it is the ActivityPub endpoint. v1
|
|
15
|
+
* covers server-to-server federation (inbound `Follow`/`Undo`/`Create`/`Like`/
|
|
16
|
+
* `Announce`/`Delete` with signature verification and dedup; auto-`Accept` of
|
|
17
|
+
* follows; signed fan-out delivery), the actor document and paged
|
|
18
|
+
* `OrderedCollection`s, and NodeInfo discovery. Client-to-server authoring is
|
|
19
|
+
* out of scope — `@dwk/micropub` covers authoring, and the owner publish
|
|
20
|
+
* endpoint (`POST <actor>/outbox`) is the publish → `Create` fan-out seam.
|
|
21
|
+
*
|
|
22
|
+
* HTTP Message Signatures are implemented inline against the de-facto fediverse
|
|
23
|
+
* `draft-cavage` profile so the actor federates today; signing/verification sit
|
|
24
|
+
* behind the {@link ActivityPubConfig.verifyInboxSignature} seam so the
|
|
25
|
+
* forthcoming cross-standard `@dwk/http-signatures` package (issue #59) can be
|
|
26
|
+
* swapped in unchanged.
|
|
27
|
+
*
|
|
28
|
+
* @see spec/packages/activitypub.md
|
|
29
|
+
* @packageDocumentation
|
|
30
|
+
*/
|
|
31
|
+
export { createActivityPub } from "./handler";
|
|
32
|
+
export { ActivityPubObject } from "./object";
|
|
33
|
+
export { resolveConfig, deriveIris, } from "./config";
|
|
34
|
+
export { AS2_NS, AS2_CONTENT_TYPE, AS2_LD_CONTENT_TYPE, PUBLIC_AUDIENCE, buildActorDocument, buildCollection, buildCollectionPage, wantsActivityJson, as2ContentType, } from "./as2";
|
|
35
|
+
export { buildNodeInfoDiscovery, buildNodeInfo20, buildNodeInfo21, } from "./nodeinfo";
|
|
36
|
+
export { signRequest, verifyInboxSignature, digestHeader, importPublicKey, importPrivateKey, } from "./signature";
|
|
37
|
+
export { deliverActivity, assertPublicHttpsTarget, DeliveryBlockedError, } from "./delivery";
|
|
38
|
+
export { ActivityPubLogEvent } from "./log";
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,iBAAiB,EAA2B,MAAM,WAAW,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,EACL,aAAa,EACb,UAAU,GAKX,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,MAAM,EACN,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,GAKf,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,eAAe,GAGhB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,YAAY,EACZ,eAAe,EACf,gBAAgB,GAOjB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,oBAAoB,GAErB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC"}
|
package/dist/log.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@dwk/activitypub` — structured observability event taxonomy.
|
|
3
|
+
*
|
|
4
|
+
* An ActivityPub actor verifies HTTP signatures at the edge and federates
|
|
5
|
+
* activities from the Durable Object; a rejected signature or a failed delivery
|
|
6
|
+
* that is silently swallowed is an operational and security blind spot. Logging
|
|
7
|
+
* and metrics are opt-in via an injected {@link Logger}/{@link Metrics} (see
|
|
8
|
+
* `@dwk/log`), wired once at the composition boundary — the stateless front
|
|
9
|
+
* door — and **share this one vocabulary** so a log line and its counter line
|
|
10
|
+
* up.
|
|
11
|
+
*
|
|
12
|
+
* Because the Durable Object cannot receive injected functions across the
|
|
13
|
+
* isolate boundary, it signals its inbound/delivery outcomes back to the front
|
|
14
|
+
* door via an internal response header ({@link ApOutcome}); the front door emits
|
|
15
|
+
* the events and strips the header. Fields follow the redaction policy — only
|
|
16
|
+
* machine-readable reason codes, activity types, and sanitized hosts; never key
|
|
17
|
+
* material, tokens, or full bodies. See `spec/observability.md`.
|
|
18
|
+
*
|
|
19
|
+
* @packageDocumentation
|
|
20
|
+
*/
|
|
21
|
+
/** Stable event names emitted by `@dwk/activitypub`. */
|
|
22
|
+
export declare const ActivityPubLogEvent: {
|
|
23
|
+
/** An inbound `POST /inbox` signature failed verification. Field: `reason`. */
|
|
24
|
+
readonly SignatureRejected: "activitypub.signature.rejected";
|
|
25
|
+
/** An inbound `POST /inbox` signature verified. Field: `actorHost`. */
|
|
26
|
+
readonly SignatureAccepted: "activitypub.signature.accepted";
|
|
27
|
+
/** An inbound activity was accepted by the DO. Fields: `activity` (type). */
|
|
28
|
+
readonly InboxAccepted: "activitypub.inbox.accepted";
|
|
29
|
+
/** An inbound activity was a duplicate (deduped by `id`). */
|
|
30
|
+
readonly InboxDuplicate: "activitypub.inbox.duplicate";
|
|
31
|
+
/** A delivery to a remote inbox succeeded. Field: `targetHost`. */
|
|
32
|
+
readonly DeliverySucceeded: "activitypub.delivery.succeeded";
|
|
33
|
+
/** A delivery attempt failed and will be retried or dropped. Fields: `targetHost`, `dropped`. */
|
|
34
|
+
readonly DeliveryFailed: "activitypub.delivery.failed";
|
|
35
|
+
/** A delivery target was refused on SSRF grounds. Field: `reason`. */
|
|
36
|
+
readonly DeliveryBlocked: "activitypub.delivery.blocked";
|
|
37
|
+
/** An owner publish request was refused (bad/absent token). */
|
|
38
|
+
readonly PublishRejected: "activitypub.publish.rejected";
|
|
39
|
+
};
|
|
40
|
+
/** Union of the event-name string literals in {@link ActivityPubLogEvent}. */
|
|
41
|
+
export type ActivityPubLogEvent = (typeof ActivityPubLogEvent)[keyof typeof ActivityPubLogEvent];
|
|
42
|
+
/**
|
|
43
|
+
* Machine-readable outcome values the DO sets on the internal outcome header so
|
|
44
|
+
* the front door can emit the matching {@link ActivityPubLogEvent}. Internal to
|
|
45
|
+
* the DO↔front-door contract; stripped before the response reaches the client.
|
|
46
|
+
*/
|
|
47
|
+
export declare const ApOutcome: {
|
|
48
|
+
readonly InboxAccepted: "inbox_accepted";
|
|
49
|
+
readonly InboxDuplicate: "inbox_duplicate";
|
|
50
|
+
};
|
|
51
|
+
/** Union of the outcome string literals in {@link ApOutcome}. */
|
|
52
|
+
export type ApOutcome = (typeof ApOutcome)[keyof typeof ApOutcome];
|
|
53
|
+
/** Internal header the DO uses to report an inbound outcome to the front door. */
|
|
54
|
+
export declare const OUTCOME_HEADER = "x-ap-outcome";
|
|
55
|
+
/** Internal header carrying the accepted activity type for logging. */
|
|
56
|
+
export declare const OUTCOME_ACTIVITY_HEADER = "x-ap-outcome-activity";
|
|
57
|
+
//# sourceMappingURL=log.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,wDAAwD;AACxD,eAAO,MAAM,mBAAmB;IAC9B,+EAA+E;;IAE/E,uEAAuE;;IAEvE,6EAA6E;;IAE7E,6DAA6D;;IAE7D,mEAAmE;;IAEnE,iGAAiG;;IAEjG,sEAAsE;;IAEtE,+DAA+D;;CAEvD,CAAC;AAEX,8EAA8E;AAC9E,MAAM,MAAM,mBAAmB,GAC7B,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAEjE;;;;GAIG;AACH,eAAO,MAAM,SAAS;;;CAGZ,CAAC;AAEX,iEAAiE;AACjE,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAEnE,kFAAkF;AAClF,eAAO,MAAM,cAAc,iBAAiB,CAAC;AAC7C,uEAAuE;AACvE,eAAO,MAAM,uBAAuB,0BAA0B,CAAC"}
|
package/dist/log.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@dwk/activitypub` — structured observability event taxonomy.
|
|
3
|
+
*
|
|
4
|
+
* An ActivityPub actor verifies HTTP signatures at the edge and federates
|
|
5
|
+
* activities from the Durable Object; a rejected signature or a failed delivery
|
|
6
|
+
* that is silently swallowed is an operational and security blind spot. Logging
|
|
7
|
+
* and metrics are opt-in via an injected {@link Logger}/{@link Metrics} (see
|
|
8
|
+
* `@dwk/log`), wired once at the composition boundary — the stateless front
|
|
9
|
+
* door — and **share this one vocabulary** so a log line and its counter line
|
|
10
|
+
* up.
|
|
11
|
+
*
|
|
12
|
+
* Because the Durable Object cannot receive injected functions across the
|
|
13
|
+
* isolate boundary, it signals its inbound/delivery outcomes back to the front
|
|
14
|
+
* door via an internal response header ({@link ApOutcome}); the front door emits
|
|
15
|
+
* the events and strips the header. Fields follow the redaction policy — only
|
|
16
|
+
* machine-readable reason codes, activity types, and sanitized hosts; never key
|
|
17
|
+
* material, tokens, or full bodies. See `spec/observability.md`.
|
|
18
|
+
*
|
|
19
|
+
* @packageDocumentation
|
|
20
|
+
*/
|
|
21
|
+
/** Stable event names emitted by `@dwk/activitypub`. */
|
|
22
|
+
export const ActivityPubLogEvent = {
|
|
23
|
+
/** An inbound `POST /inbox` signature failed verification. Field: `reason`. */
|
|
24
|
+
SignatureRejected: "activitypub.signature.rejected",
|
|
25
|
+
/** An inbound `POST /inbox` signature verified. Field: `actorHost`. */
|
|
26
|
+
SignatureAccepted: "activitypub.signature.accepted",
|
|
27
|
+
/** An inbound activity was accepted by the DO. Fields: `activity` (type). */
|
|
28
|
+
InboxAccepted: "activitypub.inbox.accepted",
|
|
29
|
+
/** An inbound activity was a duplicate (deduped by `id`). */
|
|
30
|
+
InboxDuplicate: "activitypub.inbox.duplicate",
|
|
31
|
+
/** A delivery to a remote inbox succeeded. Field: `targetHost`. */
|
|
32
|
+
DeliverySucceeded: "activitypub.delivery.succeeded",
|
|
33
|
+
/** A delivery attempt failed and will be retried or dropped. Fields: `targetHost`, `dropped`. */
|
|
34
|
+
DeliveryFailed: "activitypub.delivery.failed",
|
|
35
|
+
/** A delivery target was refused on SSRF grounds. Field: `reason`. */
|
|
36
|
+
DeliveryBlocked: "activitypub.delivery.blocked",
|
|
37
|
+
/** An owner publish request was refused (bad/absent token). */
|
|
38
|
+
PublishRejected: "activitypub.publish.rejected",
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Machine-readable outcome values the DO sets on the internal outcome header so
|
|
42
|
+
* the front door can emit the matching {@link ActivityPubLogEvent}. Internal to
|
|
43
|
+
* the DO↔front-door contract; stripped before the response reaches the client.
|
|
44
|
+
*/
|
|
45
|
+
export const ApOutcome = {
|
|
46
|
+
InboxAccepted: "inbox_accepted",
|
|
47
|
+
InboxDuplicate: "inbox_duplicate",
|
|
48
|
+
};
|
|
49
|
+
/** Internal header the DO uses to report an inbound outcome to the front door. */
|
|
50
|
+
export const OUTCOME_HEADER = "x-ap-outcome";
|
|
51
|
+
/** Internal header carrying the accepted activity type for logging. */
|
|
52
|
+
export const OUTCOME_ACTIVITY_HEADER = "x-ap-outcome-activity";
|
|
53
|
+
//# sourceMappingURL=log.js.map
|
package/dist/log.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,wDAAwD;AACxD,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,+EAA+E;IAC/E,iBAAiB,EAAE,gCAAgC;IACnD,uEAAuE;IACvE,iBAAiB,EAAE,gCAAgC;IACnD,6EAA6E;IAC7E,aAAa,EAAE,4BAA4B;IAC3C,6DAA6D;IAC7D,cAAc,EAAE,6BAA6B;IAC7C,mEAAmE;IACnE,iBAAiB,EAAE,gCAAgC;IACnD,iGAAiG;IACjG,cAAc,EAAE,6BAA6B;IAC7C,sEAAsE;IACtE,eAAe,EAAE,8BAA8B;IAC/C,+DAA+D;IAC/D,eAAe,EAAE,8BAA8B;CACvC,CAAC;AAMX;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,aAAa,EAAE,gBAAgB;IAC/B,cAAc,EAAE,iBAAiB;CACzB,CAAC;AAKX,kFAAkF;AAClF,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAAC;AAC7C,uEAAuE;AACvE,MAAM,CAAC,MAAM,uBAAuB,GAAG,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NodeInfo discovery documents for `@dwk/activitypub`.
|
|
3
|
+
*
|
|
4
|
+
* NodeInfo lets a peer learn what software a domain runs. The documents are
|
|
5
|
+
* **largely static** — static enough for a generator like Anglesite to emit —
|
|
6
|
+
* with only the live `usage` counts being dynamic. This module builds the
|
|
7
|
+
* `/.well-known/nodeinfo` discovery pointer (advertising both the 2.0 and 2.1
|
|
8
|
+
* schemas, since many consumers still request 2.0) and the matching `nodeinfo`
|
|
9
|
+
* documents from plain data; the consumer decides whether to fill in live counts
|
|
10
|
+
* (from the DO) or omit them.
|
|
11
|
+
*/
|
|
12
|
+
import type { JsonValue } from "./as2";
|
|
13
|
+
/** Identifies the running software in the NodeInfo `software` block. */
|
|
14
|
+
export interface SoftwareInfo {
|
|
15
|
+
readonly name: string;
|
|
16
|
+
readonly version: string;
|
|
17
|
+
}
|
|
18
|
+
/** Dynamic usage counts; omitted entirely when not supplied. */
|
|
19
|
+
export interface UsageCounts {
|
|
20
|
+
readonly users?: number;
|
|
21
|
+
readonly localPosts?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Build the `/.well-known/nodeinfo` discovery document. NodeInfo allows multiple
|
|
25
|
+
* `links` entries, so both the 2.0 and 2.1 documents are advertised: many
|
|
26
|
+
* consumers still request 2.0, and listing both maximizes interop.
|
|
27
|
+
*/
|
|
28
|
+
export declare function buildNodeInfoDiscovery(baseUrl: string): Record<string, JsonValue>;
|
|
29
|
+
/** Build the `nodeinfo/2.0` document (see {@link buildNodeInfo}). */
|
|
30
|
+
export declare function buildNodeInfo20(software: SoftwareInfo, usage?: UsageCounts): Record<string, JsonValue>;
|
|
31
|
+
/** Build the `nodeinfo/2.1` document (see {@link buildNodeInfo}). */
|
|
32
|
+
export declare function buildNodeInfo21(software: SoftwareInfo, usage?: UsageCounts): Record<string, JsonValue>;
|
|
33
|
+
//# sourceMappingURL=nodeinfo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeinfo.d.ts","sourceRoot":"","sources":["../src/nodeinfo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,wEAAwE;AACxE,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,gEAAgE;AAChE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAOD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,GACd,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAO3B;AA+BD,qEAAqE;AACrE,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,YAAY,EACtB,KAAK,GAAE,WAAgB,GACtB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAE3B;AAED,qEAAqE;AACrE,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,YAAY,EACtB,KAAK,GAAE,WAAgB,GACtB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAE3B"}
|
package/dist/nodeinfo.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NodeInfo discovery documents for `@dwk/activitypub`.
|
|
3
|
+
*
|
|
4
|
+
* NodeInfo lets a peer learn what software a domain runs. The documents are
|
|
5
|
+
* **largely static** — static enough for a generator like Anglesite to emit —
|
|
6
|
+
* with only the live `usage` counts being dynamic. This module builds the
|
|
7
|
+
* `/.well-known/nodeinfo` discovery pointer (advertising both the 2.0 and 2.1
|
|
8
|
+
* schemas, since many consumers still request 2.0) and the matching `nodeinfo`
|
|
9
|
+
* documents from plain data; the consumer decides whether to fill in live counts
|
|
10
|
+
* (from the DO) or omit them.
|
|
11
|
+
*/
|
|
12
|
+
/** Schema rel for the NodeInfo 2.0 document. */
|
|
13
|
+
const NODEINFO_REL_20 = "http://nodeinfo.diaspora.software/ns/schema/2.0";
|
|
14
|
+
/** Schema rel for the NodeInfo 2.1 document. */
|
|
15
|
+
const NODEINFO_REL_21 = "http://nodeinfo.diaspora.software/ns/schema/2.1";
|
|
16
|
+
/**
|
|
17
|
+
* Build the `/.well-known/nodeinfo` discovery document. NodeInfo allows multiple
|
|
18
|
+
* `links` entries, so both the 2.0 and 2.1 documents are advertised: many
|
|
19
|
+
* consumers still request 2.0, and listing both maximizes interop.
|
|
20
|
+
*/
|
|
21
|
+
export function buildNodeInfoDiscovery(baseUrl) {
|
|
22
|
+
return {
|
|
23
|
+
links: [
|
|
24
|
+
{ rel: NODEINFO_REL_20, href: `${baseUrl}/nodeinfo/2.0` },
|
|
25
|
+
{ rel: NODEINFO_REL_21, href: `${baseUrl}/nodeinfo/2.1` },
|
|
26
|
+
],
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Build a NodeInfo document for the given schema `version`. `protocols` is fixed
|
|
31
|
+
* to `activitypub`; `usage` is included only when counts are supplied (a
|
|
32
|
+
* deployment that does not want to wake the DO for live numbers omits them). The
|
|
33
|
+
* 2.0 and 2.1 schemas agree on every field we emit, so the only difference is
|
|
34
|
+
* the `version` string.
|
|
35
|
+
*/
|
|
36
|
+
function buildNodeInfo(version, software, usage) {
|
|
37
|
+
const doc = {
|
|
38
|
+
version,
|
|
39
|
+
software: { name: software.name, version: software.version },
|
|
40
|
+
protocols: ["activitypub"],
|
|
41
|
+
services: { inbound: [], outbound: [] },
|
|
42
|
+
openRegistrations: false,
|
|
43
|
+
metadata: {},
|
|
44
|
+
};
|
|
45
|
+
if (usage.users !== undefined || usage.localPosts !== undefined) {
|
|
46
|
+
doc.usage = {
|
|
47
|
+
users: { total: usage.users ?? 0 },
|
|
48
|
+
localPosts: usage.localPosts ?? 0,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return doc;
|
|
52
|
+
}
|
|
53
|
+
/** Build the `nodeinfo/2.0` document (see {@link buildNodeInfo}). */
|
|
54
|
+
export function buildNodeInfo20(software, usage = {}) {
|
|
55
|
+
return buildNodeInfo("2.0", software, usage);
|
|
56
|
+
}
|
|
57
|
+
/** Build the `nodeinfo/2.1` document (see {@link buildNodeInfo}). */
|
|
58
|
+
export function buildNodeInfo21(software, usage = {}) {
|
|
59
|
+
return buildNodeInfo("2.1", software, usage);
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=nodeinfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeinfo.js","sourceRoot":"","sources":["../src/nodeinfo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAgBH,gDAAgD;AAChD,MAAM,eAAe,GAAG,iDAAiD,CAAC;AAC1E,gDAAgD;AAChD,MAAM,eAAe,GAAG,iDAAiD,CAAC;AAE1E;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CACpC,OAAe;IAEf,OAAO;QACL,KAAK,EAAE;YACL,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,GAAG,OAAO,eAAe,EAAE;YACzD,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,GAAG,OAAO,eAAe,EAAE;SAC1D;KACF,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,SAAS,aAAa,CACpB,OAAsB,EACtB,QAAsB,EACtB,KAAkB;IAElB,MAAM,GAAG,GAA8B;QACrC,OAAO;QACP,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE;QAC5D,SAAS,EAAE,CAAC,aAAa,CAAC;QAC1B,QAAQ,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;QACvC,iBAAiB,EAAE,KAAK;QACxB,QAAQ,EAAE,EAAE;KACb,CAAC;IACF,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QAChE,GAAG,CAAC,KAAK,GAAG;YACV,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,CAAC,EAAE;YAClC,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,CAAC;SAClC,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,eAAe,CAC7B,QAAsB,EACtB,QAAqB,EAAE;IAEvB,OAAO,aAAa,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;AAC/C,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,eAAe,CAC7B,QAAsB,EACtB,QAAqB,EAAE;IAEvB,OAAO,aAAa,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;AAC/C,CAAC"}
|
package/dist/object.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The per-actor Durable Object: the single-threaded consistency authority for
|
|
3
|
+
* one ActivityPub actor.
|
|
4
|
+
*
|
|
5
|
+
* The stateless front door (`handler.ts`) verifies inbound HTTP signatures at
|
|
6
|
+
* the edge and hands the verified facts to this object via internal headers;
|
|
7
|
+
* everything that must be strongly consistent — activity-`id` dedup, the
|
|
8
|
+
* follower/following collections, the outbox, and the signed outbound delivery
|
|
9
|
+
* queue — happens here, where Cloudflare guarantees a single thread per actor.
|
|
10
|
+
* Delivery retries are driven by the DO **alarm** with exponential backoff.
|
|
11
|
+
* Consumers bind this class as a Durable Object namespace.
|
|
12
|
+
*/
|
|
13
|
+
import { DurableObject } from "cloudflare:workers";
|
|
14
|
+
import type { ActivityPubEnv } from "./config";
|
|
15
|
+
export declare class ActivityPubObject extends DurableObject<ActivityPubEnv> {
|
|
16
|
+
#private;
|
|
17
|
+
constructor(state: DurableObjectState, env: ActivityPubEnv);
|
|
18
|
+
fetch(request: Request): Promise<Response>;
|
|
19
|
+
alarm(): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=object.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../src/object.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAqBnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AA2B/C,qBAAa,iBAAkB,SAAQ,aAAa,CAAC,cAAc,CAAC;;gBAItD,KAAK,EAAE,kBAAkB,EAAE,GAAG,EAAE,cAAc;IAkC3C,KAAK,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;IAykB1C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAqGtC"}
|