Factom-Asset-Tokens/fat-js

pkSignature method of Builders throw wrong errors when PK not found

PaulBernier opened this issue · 0 comments

Those conditions are always true:
https://github.com/Factom-Asset-Tokens/fat-js/blob/development/0/TransactionBuilder.js#L281
https://github.com/Factom-Asset-Tokens/fat-js/blob/development/1/TransactionBuilder.js#L307
because findIndex returns -1 when the element is not found: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex
Because of that the method with throw Cannot set property 'publicKey' of undefined which is hard to interpret for a user of the library.