mirror of
https://github.com/versia-pub/api.git
synced 2026-03-13 04:09:15 +01:00
feat(federation): ✨ Add a federation requester client
This commit is contained in:
parent
7e3db6fc2b
commit
bbcc362bc1
8 changed files with 266 additions and 4 deletions
|
|
@ -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 =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue