mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 16:38:19 +01:00
chore(federation): ✨ Add sender public key to federation debugging
This commit is contained in:
parent
f5605e6814
commit
fc98c95892
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
|
@ -4,8 +4,6 @@
|
||||||
"jest.rootPath": ".",
|
"jest.rootPath": ".",
|
||||||
"conventionalCommits.scopes": [
|
"conventionalCommits.scopes": [
|
||||||
"database",
|
"database",
|
||||||
"frontend",
|
|
||||||
"build",
|
|
||||||
"api",
|
"api",
|
||||||
"cli",
|
"cli",
|
||||||
"federation",
|
"federation",
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import {
|
||||||
} from "@lysand-org/federation";
|
} from "@lysand-org/federation";
|
||||||
import { config } from "config-manager";
|
import { config } from "config-manager";
|
||||||
import type { User } from "~packages/database-interface/user";
|
import type { User } from "~packages/database-interface/user";
|
||||||
|
import { LogLevel, LogManager } from "~packages/log-manager";
|
||||||
|
|
||||||
export const localObjectURI = (id: string) =>
|
export const localObjectURI = (id: string) =>
|
||||||
new URL(`/objects/${id}`, config.http.base_url).toString();
|
new URL(`/objects/${id}`, config.http.base_url).toString();
|
||||||
|
|
@ -48,6 +49,13 @@ export const objectToInboxRequest = async (
|
||||||
if (config.debug.federation) {
|
if (config.debug.federation) {
|
||||||
// Debug request
|
// Debug request
|
||||||
await debugRequest(signed);
|
await debugRequest(signed);
|
||||||
|
|
||||||
|
// Log public key
|
||||||
|
new LogManager(Bun.stdout).log(
|
||||||
|
LogLevel.DEBUG,
|
||||||
|
"Inbox.Signature",
|
||||||
|
`Sender public key: ${author.getUser().publicKey}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return signed;
|
return signed;
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ import { db } from "~drizzle/db";
|
||||||
import { Notifications, Relationships } from "~drizzle/schema";
|
import { Notifications, Relationships } from "~drizzle/schema";
|
||||||
import { config } from "~packages/config-manager";
|
import { config } from "~packages/config-manager";
|
||||||
import { User } from "~packages/database-interface/user";
|
import { User } from "~packages/database-interface/user";
|
||||||
import { LogLevel } from "~packages/log-manager";
|
import { LogLevel, LogManager } from "~packages/log-manager";
|
||||||
|
|
||||||
export const meta = applyConfig({
|
export const meta = applyConfig({
|
||||||
allowedMethods: ["POST"],
|
allowedMethods: ["POST"],
|
||||||
|
|
@ -143,6 +143,15 @@ export default (app: Hono) =>
|
||||||
return errorResponse("Could not resolve keyId", 400);
|
return errorResponse("Could not resolve keyId", 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config.debug.federation) {
|
||||||
|
// Log public key
|
||||||
|
new LogManager(Bun.stdout).log(
|
||||||
|
LogLevel.DEBUG,
|
||||||
|
"Inbox.Signature",
|
||||||
|
`Sender public key: ${sender.getUser().publicKey}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const validator = await SignatureValidator.fromStringKey(
|
const validator = await SignatureValidator.fromStringKey(
|
||||||
sender.getUser().publicKey,
|
sender.getUser().publicKey,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue