core
core copied to clipboard
Add caveat support for endowment permissions
Permissions of type endowment currently do not support caveats at all; the allowedCaveats of their specification objects must be null. This is because we didn't need caveats for the first endowment permissions that we shipped. Recently, the Snaps team has started designing endowment permissions with rather lengthy "arguments" in their snap.manifest.json, for example the proposed snap:keyring permission: https://github.com/MetaMask/SIPs/blob/ba0540aed6e30ccb12c3743107d9280d2be78e7b/SIPS/sip-2.md#manifest
These "arguments" are essentially caveats, and they should be stored in the PermissionController state. Therefore, we to add support for caveats to endowment permissions.