feat: make lint happy

This commit is contained in:
2025-01-19 09:40:50 +08:00
parent f7d2a53a2e
commit 62a56525f2

View File

@@ -407,7 +407,7 @@ function parsePemToArray(pem: string): Uint8Array {
} }
} }
if (innerPem.length === 0) { if (innerPem.length === 0) {
return null; return new Uint8Array(0);
} }
return decodeBase64(innerPem.join("")); return decodeBase64(innerPem.join(""));
} }
@@ -427,7 +427,9 @@ async function digestFile(filename: string, algorithm: string): Promise<Uint8Arr
return new Uint8Array(hashBuffer); return new Uint8Array(hashBuffer);
} }
function normalizeHashAlgorithm(algorithm: string): string { type DigestAlgorithm = "SHA-256" | "SHA-384" | "SHA-512";
function normalizeHashAlgorithm(algorithm: string): DigestAlgorithm {
let hashAlgorithm; let hashAlgorithm;
switch (algorithm.toLowerCase()) { switch (algorithm.toLowerCase()) {
case "sha256": case "sha256":
@@ -445,7 +447,7 @@ function normalizeHashAlgorithm(algorithm: string): string {
default: default:
throw `Unknown algorithm: ${algorithm}`; throw `Unknown algorithm: ${algorithm}`;
} }
return hashAlgorithm; return hashAlgorithm as DigestAlgorithm;
} }
async function testSshSig() { async function testSshSig() {