diff options
author | Kenta Moriuchi <moriken@kimamass.com> | 2024-01-11 07:37:25 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-10 15:37:25 -0700 |
commit | 515a34b4de222e35c7ade1b92614d746e73d4c2e (patch) | |
tree | 8284201fc826a33f12597959a8a8be14e0f524bd /ext/node/polyfills/internal/crypto/sig.ts | |
parent | d4893eb51a01c5a692d8ca74a3b8ff95c5fd1d9f (diff) |
refactor: use `core.ensureFastOps()` (#21888)
Diffstat (limited to 'ext/node/polyfills/internal/crypto/sig.ts')
-rw-r--r-- | ext/node/polyfills/internal/crypto/sig.ts | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/ext/node/polyfills/internal/crypto/sig.ts b/ext/node/polyfills/internal/crypto/sig.ts index 066857d51..fb303e4e2 100644 --- a/ext/node/polyfills/internal/crypto/sig.ts +++ b/ext/node/polyfills/internal/crypto/sig.ts @@ -4,6 +4,12 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials +import { core } from "ext:core/mod.js"; +const { + op_node_sign, + op_node_verify, +} = core.ensureFastOps(); + import { notImplemented } from "ext:deno_node/_utils.ts"; import { validateFunction, @@ -28,9 +34,6 @@ import { KeyFormat, KeyType } from "ext:deno_node/internal/crypto/types.ts"; import { isArrayBufferView } from "ext:deno_node/internal/util/types.ts"; import { ERR_CRYPTO_SIGN_KEY_REQUIRED } from "ext:deno_node/internal/errors.ts"; -const { core } = globalThis.__bootstrap; -const { ops } = core; - export type DSAEncoding = "der" | "ieee-p1363"; export interface SigningOptions { @@ -81,7 +84,7 @@ export class SignImpl extends Writable { encoding?: BinaryToTextEncoding, ): Buffer | string { const { data, format, type } = prepareAsymmetricKey(privateKey); - const ret = Buffer.from(ops.op_node_sign( + const ret = Buffer.from(op_node_sign( this.hash.digest(), this.#digestType, data!, @@ -157,7 +160,7 @@ export class VerifyImpl extends Writable { "crypto.Verify.prototype.verify with non BinaryLike input", ); } - return ops.op_node_verify( + return op_node_verify( this.hash.digest(), this.#digestType, keyData!, |