Skip to content

Commit

Permalink
update deps and patch @peculiar/webcrypto types
Browse files Browse the repository at this point in the history
  • Loading branch information
mrnerdhair committed Oct 18, 2021
1 parent e59bac8 commit 91d7a45
Show file tree
Hide file tree
Showing 3 changed files with 568 additions and 534 deletions.
2 changes: 1 addition & 1 deletion packages/hdwallet-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"web-encoding": "^1.1.0"
},
"devDependencies": {
"@peculiar/webcrypto": "^1.1.3",
"@peculiar/webcrypto": "1.1.7",
"@types/bchaddrjs": "^0.4.0",
"@types/big.js": "^6.0.2",
"@types/bs58": "^4.0.1",
Expand Down
39 changes: 39 additions & 0 deletions patches/@peculiar+webcrypto+1.1.7.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
diff --git a/node_modules/@peculiar/webcrypto/build/webcrypto.es.js b/node_modules/@peculiar/webcrypto/build/webcrypto.es.js
index 73b70df..e628601 100644
--- a/node_modules/@peculiar/webcrypto/build/webcrypto.es.js
+++ b/node_modules/@peculiar/webcrypto/build/webcrypto.es.js
@@ -2148,7 +2148,7 @@ class Crypto extends core.Crypto {
this.subtle = new SubtleCrypto();
}
getRandomValues(array) {
- const buffer = Buffer.from(array.buffer);
+ const buffer = Buffer.from(array.buffer, array.byteOffset, array.byteLength);
crypto__default.randomFillSync(buffer);
return array;
}
diff --git a/node_modules/@peculiar/webcrypto/build/webcrypto.js b/node_modules/@peculiar/webcrypto/build/webcrypto.js
index 18edc34..69ba1c3 100644
--- a/node_modules/@peculiar/webcrypto/build/webcrypto.js
+++ b/node_modules/@peculiar/webcrypto/build/webcrypto.js
@@ -2176,7 +2176,7 @@ class Crypto extends core__namespace.Crypto {
this.subtle = new SubtleCrypto();
}
getRandomValues(array) {
- const buffer = Buffer.from(array.buffer);
+ const buffer = Buffer.from(array.buffer, array.byteOffset, array.byteLength);
crypto__default['default'].randomFillSync(buffer);
return array;
}
diff --git a/node_modules/@peculiar/webcrypto/index.d.ts b/node_modules/@peculiar/webcrypto/index.d.ts
index a347040..069892a 100644
--- a/node_modules/@peculiar/webcrypto/index.d.ts
+++ b/node_modules/@peculiar/webcrypto/index.d.ts
@@ -2,7 +2,7 @@ import * as core from "webcrypto-core";

export declare class Crypto implements core.NativeCrypto {
public subtle: SubtleCrypto;
- public getRandomValues<T extends Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | null>(array: T): T;
+ public getRandomValues<T extends ArrayBufferView | null>(array: T): T;
}

export declare class CryptoKey implements core.NativeCryptoKey {
Loading

0 comments on commit 91d7a45

Please sign in to comment.