diff options
Diffstat (limited to 'packages/server/src')
-rw-r--r-- | packages/server/src/helpers/iso/isoCrypto.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/packages/server/src/helpers/iso/isoCrypto.ts b/packages/server/src/helpers/iso/isoCrypto.ts index df3f150..3ffd2f0 100644 --- a/packages/server/src/helpers/iso/isoCrypto.ts +++ b/packages/server/src/helpers/iso/isoCrypto.ts @@ -46,12 +46,14 @@ export async function digest(data: Uint8Array, algorithm: string): Promise<Uint8 * Convert algorithms like "SHA1", "sha256", etc... into values like "SHA-1", "SHA-256", etc... * that `.digest()` will accept */ -function normalizeAlgorithm(algorithm: string): string { +function normalizeAlgorithm(algorithm: string): SubtleCryptoAlg { if (/sha\d{1,3}/i.test(algorithm)) { algorithm = algorithm.toUpperCase().replace('SHA', 'SHA-'); } - return algorithm; + return algorithm as SubtleCryptoAlg; +} + /** * Convert a COSE crv ID into a corresponding string value that WebCrypto APIs expect */ |