diff options
Diffstat (limited to 'ext/node/polyfills/internal/crypto/hash.ts')
-rw-r--r-- | ext/node/polyfills/internal/crypto/hash.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/node/polyfills/internal/crypto/hash.ts b/ext/node/polyfills/internal/crypto/hash.ts index d81844f30..63c92190c 100644 --- a/ext/node/polyfills/internal/crypto/hash.ts +++ b/ext/node/polyfills/internal/crypto/hash.ts @@ -15,10 +15,10 @@ import type { Encoding, } from "ext:deno_node/internal/crypto/types.ts"; import { + getKeyMaterial, KeyObject, prepareSecretKey, } from "ext:deno_node/internal/crypto/keys.ts"; -import { notImplemented } from "ext:deno_node/_utils.ts"; const { ops } = globalThis.__bootstrap.core; @@ -170,12 +170,12 @@ class HmacImpl extends Transform { }); // deno-lint-ignore no-this-alias const self = this; - if (key instanceof KeyObject) { - notImplemented("Hmac: KeyObject key is not implemented"); - } validateString(hmac, "hmac"); - const u8Key = prepareSecretKey(key, options?.encoding) as Buffer; + + const u8Key = key instanceof KeyObject + ? getKeyMaterial(key) + : prepareSecretKey(key, options?.encoding) as Buffer; const alg = hmac.toLowerCase(); this.#algorithm = alg; |