Skip to content

Commit 22204c7

Browse files
Merge pull request #1637 from input-output-hk/fix/remove-setImmediate
fix(crypto): remove setImmediate from async calls
2 parents 0a1ae04 + 5a2a0c5 commit 22204c7

File tree

3 files changed

+3
-15
lines changed

3 files changed

+3
-15
lines changed

packages/crypto/src/blake2b-hash.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ export const blake2b: Blake2b = {
3535
return hash(outputLengthBytes).update(hexStringToBuffer(message)).digest('hex') as T;
3636
},
3737
async hashAsync<T extends HexBlob>(message: HexBlob, outputLengthBytes: number): Promise<T> {
38-
return new Promise((resolve) => {
39-
setImmediate(() => {
40-
resolve(blake2b.hash<T>(message, outputLengthBytes));
41-
});
42-
});
38+
return blake2b.hash<T>(message, outputLengthBytes);
4339
}
4440
};

packages/crypto/src/strategies/CmlBip32Ed25519.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,7 @@ export class CmlBip32Ed25519 implements Bip32Ed25519 {
104104
parentKey: Bip32PublicKeyHex,
105105
derivationIndices: BIP32Path
106106
): Promise<Bip32PublicKeyHex> {
107-
return new Promise((resolve) => {
108-
setImmediate(() => {
109-
resolve(this.derivePublicKey(parentKey, derivationIndices));
110-
});
111-
});
107+
return this.derivePublicKey(parentKey, derivationIndices);
112108
}
113109

114110
public sign(

packages/crypto/src/strategies/SodiumBip32Ed25519.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,7 @@ export class SodiumBip32Ed25519 implements Bip32Ed25519 {
7474
parentKey: Bip32PublicKeyHex,
7575
derivationIndices: BIP32Path
7676
): Promise<Bip32PublicKeyHex> {
77-
return new Promise((resolve) => {
78-
setImmediate(() => {
79-
resolve(this.derivePublicKey(parentKey, derivationIndices));
80-
});
81-
});
77+
return this.derivePublicKey(parentKey, derivationIndices);
8278
}
8379

8480
public sign(

0 commit comments

Comments
 (0)