feat: support custom app secret in the setup()
call + EVM signTypedData fixes
#563
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation: We'd like to be able to use the setup method with the same flow that Metamask/Rabby wallets do (i.e. redirection through lattice connector which takes care of the pairing instead of custom logic within the wallet app) and for that we need to create the same app secret which is however not the case for the implementation of the setup() method (notice the different order of parameters passed to the hashing function which generates the app secret) :
Metamask/Rabby app secret: https://github.com/GridPlus/eth-lattice-keyring/blob/c22352bd35c895d25700f19d50ff932d680ec66a/index.js#L683-L686
gridplus-sdk setup implementation:
gridplus-sdk/src/util.ts
Lines 666 to 670 in 68a8242
This PR solves our problem by exposing an optional
appSecret
parameter which allows to override the defaultappSecret
generated in thesetup()
calladditionally, this PR addresses an issue we came across with
bignumber.js
being possibly encoded correctly, which happened if package manager chose to supply a different version of bignumber.js to gridplus-sdk vs theborc
lib which is internally used to encode payloads. This should be prevented by making sure the version ofbignumber.js
required bygridplus-sdk
matches exactly the one required byborc