Skip to content

Commit

Permalink
patch library
Browse files Browse the repository at this point in the history
Co-authored-by: Tuditi <[email protected]>
  • Loading branch information
MarkNerdi and Tuditi committed May 17, 2024
1 parent 142f83f commit bb307c7
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions patches/@noble+hashes+1.3.3.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
diff --git a/node_modules/@noble/hashes/esm/utils.js b/node_modules/@noble/hashes/esm/utils.js
index 65546d2..88e9246 100644
--- a/node_modules/@noble/hashes/esm/utils.js
+++ b/node_modules/@noble/hashes/esm/utils.js
@@ -5,7 +5,7 @@
// from `crypto` to `cryptoNode`, which imports native module.
// Makes the utils un-importable in browsers without a bundler.
// Once node.js 18 is deprecated (2025-04-30), we can just drop the import.
-import { crypto } from '@noble/hashes/crypto';
+// import { crypto } from '@noble/hashes/crypto';
// Cast array to different type
export const u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
export const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
diff --git a/node_modules/@noble/hashes/src/utils.ts b/node_modules/@noble/hashes/src/utils.ts
index 28d4df7..78b5dc7 100644
--- a/node_modules/@noble/hashes/src/utils.ts
+++ b/node_modules/@noble/hashes/src/utils.ts
@@ -6,7 +6,7 @@
// from `crypto` to `cryptoNode`, which imports native module.
// Makes the utils un-importable in browsers without a bundler.
// Once node.js 18 is deprecated (2025-04-30), we can just drop the import.
-import { crypto } from '@noble/hashes/crypto';
+// import { crypto } from '@noble/hashes/crypto';

// prettier-ignore
export type TypedArray = Int8Array | Uint8ClampedArray | Uint8Array |
diff --git a/node_modules/@noble/hashes/utils.js b/node_modules/@noble/hashes/utils.js
index c907436..52c92de 100644
--- a/node_modules/@noble/hashes/utils.js
+++ b/node_modules/@noble/hashes/utils.js
@@ -8,7 +8,7 @@ exports.randomBytes = exports.wrapXOFConstructorWithOpts = exports.wrapConstruct
// from `crypto` to `cryptoNode`, which imports native module.
// Makes the utils un-importable in browsers without a bundler.
// Once node.js 18 is deprecated (2025-04-30), we can just drop the import.
-const crypto_1 = require("@noble/hashes/crypto");
+// const crypto_1 = require("@noble/hashes/crypto");
// Cast array to different type
const u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
exports.u8 = u8;
@@ -189,8 +189,8 @@ exports.wrapXOFConstructorWithOpts = wrapXOFConstructorWithOpts;
* Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS.
*/
function randomBytes(bytesLength = 32) {
- if (crypto_1.crypto && typeof crypto_1.crypto.getRandomValues === 'function') {
- return crypto_1.crypto.getRandomValues(new Uint8Array(bytesLength));
+ if (crypto.crypto && typeof crypto.crypto.getRandomValues === 'function') {
+ return crypto.crypto.getRandomValues(new Uint8Array(bytesLength));
}
throw new Error('crypto.getRandomValues must be defined');
}

0 comments on commit bb307c7

Please sign in to comment.