feat(federation): Add a federation requester client

This commit is contained in:
Jesse Wierzbinski 2024-06-29 22:20:07 -10:00
parent 7e3db6fc2b
commit bbcc362bc1
No known key found for this signature in database
8 changed files with 266 additions and 4 deletions

View file

@ -259,7 +259,7 @@ export class SignatureConstructor {
async sign(
method: HttpVerb,
url: URL,
body: string,
body?: string,
headers?: Headers,
date?: Date,
): Promise<{
@ -302,7 +302,7 @@ export class SignatureConstructor {
return { request, signedString };
}
if (!(url && body && headers)) {
if (!(url && headers)) {
throw new TypeError(
"Missing or empty required parameters: url, body or headers",
);
@ -312,7 +312,7 @@ export class SignatureConstructor {
const digest = await crypto.subtle.digest(
"SHA-256",
new TextEncoder().encode(body),
new TextEncoder().encode(body ?? ""),
);
const signedString =