From 560f534a36c32a5b7301f21308a6e4585211c399 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?So=CC=88nmez=20Kartal?= Date: Sat, 12 Mar 2022 01:41:33 +0300 Subject: [PATCH] Bind `this` name to the `webcrypto` The changes in https://github.com/nodejs/node/pull/4178 (which released in node v17.7.0) makes the [type check](https://github.com/nodejs/node/blob/master/lib/internal/crypto/webcrypto.js#L701-L703) on `this` in the internal `crypto` module fail. --- packages/core/src/standards/crypto.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/src/standards/crypto.ts b/packages/core/src/standards/crypto.ts index a53dbc8e3..3aa363cf9 100644 --- a/packages/core/src/standards/crypto.ts +++ b/packages/core/src/standards/crypto.ts @@ -65,11 +65,11 @@ function digest( export function createCrypto(blockGlobalRandom = false): typeof webcrypto { const getRandomValues = assertsInRequest( - webcrypto.getRandomValues, + webcrypto.getRandomValues.bind(webcrypto), blockGlobalRandom ); const generateKey = assertsInRequest( - webcrypto.subtle.generateKey, + webcrypto.subtle.generateKey.bind(webcrypto.subtle), blockGlobalRandom );