# ArdorJS library fixes

**URL:** <https://talk.jelurida.com/t/ardorjs-library-fixes/861>\
**Category:** Developers\
**Created:** [22 February 2023 12:16 UTC](https://talk.jelurida.com/t/ardorjs-library-fixes/861 "2023-02-22T12:16:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![6DeadSky9](https://talk.jelurida.com/user_avatar/talk.jelurida.com/6deadsky9/32/288_2.png) [@6DeadSky9](https://talk.jelurida.com/u/6DeadSky9)\
**Post date:** [22 February 2023 12:16 UTC](https://talk.jelurida.com/t/ardorjs-library-fixes/861/1 "2023-02-22T12:16:04Z")

</div>

I'm working with ReactJS + ArdorJS but the library has some small bugs:

**ardorjs/lib/account add:**  
`import { Buffer } from "buffer";`

**ardorjs/lib/helpers.js add:**  
`import { Buffer } from "buffer";`

**ardorjs/util/curve25519\_.js**  
`export default { curve25519_ };` to `export default curve25519_;`

I hope it can be useful to someone. 😁

---

<div class="post-metadata">

**Author:** ![petko.petkov](https://talk.jelurida.com/letter_avatar_proxy/v4/letter/p/eb8c5e/32.png) [@petko.petkov](https://talk.jelurida.com/u/petko.petkov)\
**Post date:** [22 February 2023 13:33 UTC](https://talk.jelurida.com/t/ardorjs-library-fixes/861/2 "2023-02-22T13:33:11Z")

</div>

mrv777 already merged the **curve25519\_** one. Could you create a pull request for the 2 other fixes so that we can discuss them with mrv777?

---

<div class="post-metadata">

**Author:** ![6DeadSky9](https://talk.jelurida.com/user_avatar/talk.jelurida.com/6deadsky9/32/288_2.png) [@6DeadSky9](https://talk.jelurida.com/u/6DeadSky9)\
**Post date:** [23 February 2023 15:47 UTC](https://talk.jelurida.com/t/ardorjs-library-fixes/861/3 "2023-02-23T15:47:37Z")

</div>

**It's ready!**

I also added a fix for decryption, it was not working properly.

> <https://github.com/mrv777/ardorjs/pull/25>
>
> Instead of creating a new byte array with the length of wordArray.sigBytes, you …can create an array with length len \* 4 and then cut the unneeded bytes at the end of the loop. This will avoid creating a larger array than necessary and thus reduce memory usage.
> 
> \*\*It now returns the exact amount it needs and decryption works perfectly.\*\*
> 
> On the other hand, \`\<Buffer\>\` was added to increase compatibility with other frameworks (in my case, ReactJS).

> <https://github.com/mrv777/ardorjs/issues/24>
>
> \*\*Hello!\*\*
> 
> I have used \`encryptMessage\` and everything works correctly.
> 
> Th…e problem now comes when decrypting the message returned by Ardor.
> 
> I am trying to use \`decryptNote\` but it generates errors.
> 
> \*\*NOTES\*\*
> \- \`isCompressed\` should be true by default, since \`encryptMessage\` compresses it, right?
> 
> \- \`isText\` should be set to true directly, there is nothing in the documentation.
> 
> \- \`byteArrayToString\` uses deprecated functions.
> 
> \`escape(String.fromCharCode.apply(null, bytes))\` change it to \`encodeURIComponent(String.fromCodePoint(...bytes))\`
> 
> \*\*ERROR\*\* in \_ardorjs/helpers -\> byteArrayToString\_
> URIError: malformed URI sequence
