@fedify/cli 2.0.0-pr.467.1877 → 2.0.0-pr.474.1879

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/deno.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/cli",
3
- "version": "2.0.0-pr.467.1877+dc12636d",
3
+ "version": "2.0.0-pr.474.1879+be9e2989",
4
4
  "license": "MIT",
5
5
  "exports": "./src/mod.ts",
6
6
  "imports": {
package/dist/deno.js CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  //#region deno.json
5
5
  var name = "@fedify/cli";
6
- var version = "2.0.0-pr.467.1877+dc12636d";
6
+ var version = "2.0.0-pr.474.1879+be9e2989";
7
7
  var license = "MIT";
8
8
  var exports = "./src/mod.ts";
9
9
  var imports = {
package/dist/inbox.js CHANGED
@@ -30,7 +30,8 @@ const inboxCommand = command("inbox", merge(object("Inbox options", {
30
30
  acceptFollow: optional(multiple(option("-a", "--accept-follow", string({ metavar: "URI" }), { description: message`Accept follow requests from the given actor. The argument can be either an actor URI or a handle, or a wildcard (${"*"}). Can be specified multiple times. If a wildcard is specified, all follow requests will be accepted.` }))),
31
31
  noTunnel: option("-T", "--no-tunnel", { description: message`Do not tunnel the ephemeral ActivityPub server to the public Internet.` }),
32
32
  actorName: withDefault(option("--actor-name", string({ metavar: "NAME" }), { description: message`Customize the actor display name.` }), "Fedify Ephemeral Inbox"),
33
- actorSummary: withDefault(option("--actor-summary", string({ metavar: "SUMMARY" }), { description: message`Customize the actor description.` }), "An ephemeral ActivityPub inbox for testing purposes.")
33
+ actorSummary: withDefault(option("--actor-summary", string({ metavar: "SUMMARY" }), { description: message`Customize the actor description.` }), "An ephemeral ActivityPub inbox for testing purposes."),
34
+ authorizedFetch: option("-A", "--authorized-fetch", { description: message`Require HTTP Signatures for all incoming requests. Returns 401 for unsigned requests.` })
34
35
  }), debugOption), {
35
36
  brief: message`Run an ephemeral ActivityPub inbox server.`,
36
37
  description: message`Spins up an ephemeral server that serves the ActivityPub inbox with an one-time actor, through a short-lived public DNS with HTTPS. You can monitor the incoming activities in real-time.`
@@ -38,7 +39,8 @@ const inboxCommand = command("inbox", merge(object("Inbox options", {
38
39
  async function runInbox(command$1) {
39
40
  const fetch = createFetchHandler({
40
41
  actorName: command$1.actorName,
41
- actorSummary: command$1.actorSummary
42
+ actorSummary: command$1.actorSummary,
43
+ requireHttpSignature: command$1.authorizedFetch
42
44
  });
43
45
  const sendDeleteToPeers = createSendDeleteToPeers({
44
46
  actorName: command$1.actorName,
@@ -300,6 +302,7 @@ function createFetchHandler(actorOptions) {
300
302
  actorName: actorOptions.actorName,
301
303
  actorSummary: actorOptions.actorSummary
302
304
  },
305
+ requireHttpSignature: actorOptions.requireHttpSignature,
303
306
  onNotAcceptable: app.fetch.bind(app),
304
307
  onNotFound: app.fetch.bind(app),
305
308
  onUnauthorized: app.fetch.bind(app)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/cli",
3
- "version": "2.0.0-pr.467.1877+dc12636d",
3
+ "version": "2.0.0-pr.474.1879+be9e2989",
4
4
  "description": "CLI toolchain for Fedify and debugging ActivityPub",
5
5
  "keywords": [
6
6
  "fedify",
@@ -71,10 +71,10 @@
71
71
  "ora": "^8.2.0",
72
72
  "shiki": "^1.6.4",
73
73
  "srvx": "^0.8.7",
74
- "@fedify/fedify": "2.0.0-pr.467.1877+dc12636d",
75
- "@fedify/sqlite": "2.0.0-pr.467.1877+dc12636d",
76
- "@fedify/vocab-runtime": "2.0.0-pr.467.1877+dc12636d",
77
- "@fedify/vocab-tools": "2.0.0-pr.467.1877+dc12636d"
74
+ "@fedify/fedify": "2.0.0-pr.474.1879+be9e2989",
75
+ "@fedify/vocab-runtime": "2.0.0-pr.474.1879+be9e2989",
76
+ "@fedify/vocab-tools": "2.0.0-pr.474.1879+be9e2989",
77
+ "@fedify/sqlite": "2.0.0-pr.474.1879+be9e2989"
78
78
  },
79
79
  "devDependencies": {
80
80
  "@types/bun": "^1.2.23",
package/src/inbox.tsx CHANGED
@@ -103,6 +103,14 @@ export const inboxCommand = command(
103
103
  }),
104
104
  "An ephemeral ActivityPub inbox for testing purposes.",
105
105
  ),
106
+ authorizedFetch: option(
107
+ "-A",
108
+ "--authorized-fetch",
109
+ {
110
+ description:
111
+ message`Require HTTP Signatures for all incoming requests. Returns 401 for unsigned requests.`,
112
+ },
113
+ ),
106
114
  }),
107
115
  debugOption,
108
116
  ),
@@ -119,6 +127,7 @@ export async function runInbox(
119
127
  const fetch = createFetchHandler({
120
128
  actorName: command.actorName,
121
129
  actorSummary: command.actorSummary,
130
+ requireHttpSignature: command.authorizedFetch,
122
131
  });
123
132
  const sendDeleteToPeers = createSendDeleteToPeers({
124
133
  actorName: command.actorName,
@@ -499,7 +508,11 @@ app.get("/r/:idx{[0-9]+}", (c) => {
499
508
  });
500
509
 
501
510
  function createFetchHandler(
502
- actorOptions: { actorName: string; actorSummary: string },
511
+ actorOptions: {
512
+ actorName: string;
513
+ actorSummary: string;
514
+ requireHttpSignature?: boolean;
515
+ },
503
516
  ): (request: Request) => Promise<Response> {
504
517
  return async function fetch(request: Request): Promise<Response> {
505
518
  const timestamp = Temporal.Now.instant();
@@ -521,6 +534,7 @@ function createFetchHandler(
521
534
  actorName: actorOptions.actorName,
522
535
  actorSummary: actorOptions.actorSummary,
523
536
  },
537
+ requireHttpSignature: actorOptions.requireHttpSignature,
524
538
  onNotAcceptable: app.fetch.bind(app),
525
539
  onNotFound: app.fetch.bind(app),
526
540
  onUnauthorized: app.fetch.bind(app),