feat(AuthWit): Allow generating authwits on the fly
In complex executions it's difficult for the app to foresee the exact authwit requests that need to be added to the pxe before simulating execution. It's particularly difficult if the authwit request includes a random element.
Until we implement something like https://github.com/AztecProtocol/aztec-packages/issues/9133, it may be useful to allow devs to sign authwits on the fly as they are requested to the pxe's oracle.
Note that this may be difficult to implement today, since the pxe today sits behind a json rpc interface, and has no way to call back into the client. In an actual production setup, the pxe would be integrated into the wallet software, and it'd be the wallet that implements this hook and not aztec.js.
Requested by Wonderland
We can introduce a oracle that makes a call out, requesting for a structured message (#5075) to be signed by the PXE. For testing, could be possible to just have the PXE blindly sign what it is asked, but for user execution it could make a call to the user's wallet, allowing them to sign the request or deny it and make the transaction fail.
Should help on our issue of currently requiring clairvoyant code.
Since we have more pressing matters and this is mainly a nice to have, I'm unassigning myself from this task.
but for user execution it could make a call to the user's wallet, allowing them to sign the request or deny it and make the transaction fail.
The big issue here is how do we reach back to the wallet, since it is the wallet that has called into PXE via json-rpc. Is the wallet e.g. listening at some endpoint for singing requests?
We've determined that https://github.com/AztecProtocol/aztec-packages/issues/9133 is the way to go for these.