mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
refactor: use pino.Logger in daemon-keypair
This commit is contained in:
@@ -3,6 +3,7 @@ import { webcrypto } from "node:crypto";
|
||||
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { z } from "zod";
|
||||
import type pino from "pino";
|
||||
|
||||
const KeyPairSchema = z.object({
|
||||
v: z.literal(1),
|
||||
@@ -12,12 +13,6 @@ const KeyPairSchema = z.object({
|
||||
|
||||
type StoredKeyPair = z.infer<typeof KeyPairSchema>;
|
||||
|
||||
type LoggerLike = {
|
||||
child(bindings: Record<string, unknown>): LoggerLike;
|
||||
info(...args: any[]): void;
|
||||
warn(...args: any[]): void;
|
||||
};
|
||||
|
||||
const KEYPAIR_FILENAME = "daemon-keypair.json";
|
||||
const ECDH_ALGORITHM = { name: "ECDH", namedCurve: "P-256" };
|
||||
|
||||
@@ -28,7 +23,7 @@ export type DaemonKeyPairBundle = {
|
||||
|
||||
export async function loadOrCreateDaemonKeyPair(
|
||||
paseoHome: string,
|
||||
logger?: LoggerLike
|
||||
logger?: pino.Logger
|
||||
): Promise<DaemonKeyPairBundle> {
|
||||
const log = logger?.child({ module: "daemon-keypair" });
|
||||
const filePath = path.join(paseoHome, KEYPAIR_FILENAME);
|
||||
|
||||
Reference in New Issue
Block a user