(text: string, secrets: string[])
| 70 | } |
| 71 | |
| 72 | export function redact(text: string, secrets: string[]): string { |
| 73 | for (const secret of secrets.filter(Boolean)) { |
| 74 | for (const form of [secret, encodeURIComponent(secret), Buffer.from(secret).toString("base64")]) { |
| 75 | text = text.replaceAll(form, "[REDACTED]"); |
| 76 | } |
| 77 | } |
| 78 | return text; |
| 79 | } |
| 80 | |
| 81 | export async function save(path: string, value: unknown, secrets: string[] = []): Promise<void> { |
| 82 | await mkdir(dirname(path), { recursive: true, mode: 0o700 }); |
no outgoing calls
no test coverage detected