Conversation
There was a problem hiding this comment.
I'm wondering if this might be better in a constants folder since it's not really a util?
| "url": "https://github.com/violetprotocol/mauve-periphery" | ||
| }, | ||
| "files": [ | ||
| "utils/**/*", |
There was a problem hiding this comment.
Where are we intending to use this? There are some seemingly small problems that could arise if we use this package outside of testing modules, since the generateAccessToken stuff here was originally written as a test utility.
Maybe it's even worth putting some code in the generateAccessToken function itself to throw if we're not in a testing state to disallow usage of the function in dev or prod.
There was a problem hiding this comment.
This is to be used for testing in the swap-router-contracts repo as well.
What issues do you see could arise?
There was a problem hiding this comment.
We wouldn't want this to be used by any kind of real EAT generation, which is possible if it's imported. Since we have a default expiry that's hardcoded you could end up with generating EATs with completely wrong expiries which could be really dangerous.
Feels safer to disable the function to be called by anything other than tests.
Exporting the generateAccessToken util functions will avoid code duplication: this is happening in swap-router-contracts where they've been copied ( https://github.com/violetprotocol/mauve-swap-router-contracts/blob/main/test/shared/generateAccessToken.ts )
Once re-published, another PR will follow in mauve-swap-router-contracts to import these functions.
Export the roles as bytes32 as well, for the same reason.