multiversx / mx-sdk-js-wallet

Core wallet components (generation, signing) for TypeScript (JavaScript).
Other
7 stars 2 forks source link

Workaround: cast (convert) buffers to Uint8Array before calling noble functions #40

Closed andreibancioiu closed 1 year ago

andreibancioiu commented 1 year ago

Unit tests written in Jest are known to break the behavior of instanceof Uint8Array, if the tested object is a buffer:

https://github.com/jestjs/jest/issues/4422

Noble crypto functions rely on a correct behavior of instanceof Uint8Array.

In this PR, we perform an explicit conversion from Buffer to Uint8Array before calling functions of noble crypto.