fix busted types

This commit is contained in:
Moon Man 2023-12-27 09:42:48 -05:00
parent 7de6cb4677
commit 3f5478d94b
2 changed files with 8 additions and 3 deletions

7
module.d.ts vendored
View File

@ -11,7 +11,12 @@ declare module "activitypub-http-signatures" {
sign: (options: { url: string, method: string, headers: any[] }) => string;
};
export const parse: (params: { url: string, method: string, headers: Record<string, string> }) => {
type parse = (params: { url: string, method: string, headers: Record<string, string> }) => {
verify: (publicKey: string) => boolean;
};
export default {
Sha256Signer,
parse
};
}

View File

@ -5,7 +5,7 @@ import { fillRoute } from "./router.js";
import { streamToString, hashDigest } from "./util.js";
import { signedFetch, SignedInit, getActor} from "./net.js";
import { getById as getUserById, getKeyId } from "./user.js";
import { parse as parseSignedRequest } from "activitypub-http-signatures";
import parser from "activitypub-http-signatures";
import type { Request, Response } from "express";
import { addFollower } from "./follower.js";
@ -59,7 +59,7 @@ export const handleInboxPost = async (req: Request, res: Response) => {
}
// OK validate request signature
const signature = parseSignedRequest({
const signature = parser.parse({
url: req.originalUrl,
method: "POST",
headers: req.headers as Record<string, string>