Unverified Commit 3f8325df authored by Hong Minhee's avatar Hong Minhee
Browse files

Merge branch 'rfc9421'

parents 09b29f9e 79391416
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -3,3 +3,5 @@ deno.lock
repomix-output.xml
t.ts
t2.ts

**/.claude/settings.local.json
+17 −0
Original line number Diff line number Diff line
@@ -22,6 +22,23 @@ To be released.

 -  Added `Router.trailingSlashInsensitive` property.

 -  Implemented HTTP Message Signatures ([RFC 9421]) with double-knocking.
    Currently, it only works with RSA-PKCS#1-v1.5.  [[#208]]

     -  Added `HttpMessageSignaturesSpec` type.
     -  Added `SignRequestOptions.spec` option.
     -  Added `SignRequestOptions.currentTime` option.
     -  Added `VerifyRequestOptions.spec` option.
     -  Added `GetAuthenticatedDocumentLoaderOptions.specDeterminer` option.
     -  Added `GetAuthenticatedDocumentLoaderOptions.traceProvider` option.
     -  Added `HttpMessageSignaturesSpecDeterminer` interface.
     -  Added `--first-knock` option to `fedify lookup` command.

 -  The `exportJwk()` function now populates the `alg` property of a returned
    `JsonWebKey` object with `"Ed25519"` if the input key is an Ed25519 key.

[RFC 9421]: https://www.rfc-editor.org/rfc/rfc9421
[#208]: https://github.com/fedify-dev/fedify/issues/208
[#227]: https://github.com/fedify-dev/fedify/issues/227


+27 −5
Original line number Diff line number Diff line
import { colors } from "@cliffy/ansi";
import { Command } from "@cliffy/command";
import { Command, EnumType } from "@cliffy/command";
import {
  Application,
  Collection,
@@ -22,7 +22,10 @@ import { printJson } from "./utils.ts";

const logger = getLogger(["fedify", "cli", "lookup"]);

const sigSpec = new EnumType(["draft-cavage-http-signatures-12", "rfc9421"]);

export const command = new Command()
  .type("sig-spec", sigSpec)
  .arguments("<...urls:string>")
  .description(
    "Lookup an Activity Streams object by URL or the actor handle.  " +
@@ -30,6 +33,12 @@ export const command = new Command()
      "(e.g., @username@domain), and it can be multiple.",
  )
  .option("-a, --authorized-fetch", "Sign the request with an one-time key.")
  .option(
    "--first-knock <spec:sig-spec>",
    "The first-knock spec for -a/--authorized-fetch.  It is used for " +
      "the double-knocking technique.",
    { depends: ["authorized-fetch"], default: "rfc9421" },
  )
  .option(
    "-t, --traverse",
    "Traverse the given collection to fetch all items.  If it is turned on, " +
@@ -118,10 +127,21 @@ export const command = new Command()
          { contextLoader },
        );
      });
      authLoader = getAuthenticatedDocumentLoader({
      authLoader = getAuthenticatedDocumentLoader(
        {
          keyId: new URL("#main-key", server.url),
          privateKey: key.privateKey,
      });
        },
        {
          specDeterminer: {
            determineSpec() {
              return options.firstKnock;
            },
            rememberSpec() {
            },
          },
        },
      );
    }
    spinner.text = `Looking up the ${
      options.traverse ? "collection" : urls.length > 1 ? "objects" : "object"
@@ -255,3 +275,5 @@ export const command = new Command()
      Deno.exit(1);
    }
  });

// cSpell: ignore sigspec
+2 −0
Original line number Diff line number Diff line
import { Command, CompletionsCommand, HelpCommand } from "@cliffy/command";
import { configure, getConsoleSink, getFileSink } from "@logtape/logtape";
import { AsyncLocalStorage } from "node:async_hooks";
import { DEFAULT_CACHE_DIR, setCacheDir } from "./cache.ts";
import metadata from "./deno.json" with { type: "json" };
import { command as inbox } from "./inbox.tsx";
@@ -46,6 +47,7 @@ const command = new Command()
          },
        ],
        reset: true,
        contextLocalStorage: new AsyncLocalStorage(),
      });
    },
  })
+1 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
    "dereferenceable",
    "discoverability",
    "docloader",
    "draft-cavage",
    "eddsa",
    "fanout",
    "federatable",
Loading