Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wallet revoke permissions #145

Merged
merged 12 commits into from
Nov 20, 2023
Merged
67 changes: 67 additions & 0 deletions openrpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,73 @@
}
]
},
{
"name": "wallet_revokePermissions",
"tags": [
{
"$ref": "#/components/tags/MetaMask"
}
],
"summary": "Revoke existing permissions.",
"description": "Revoke permissions from the user",
shanejonas marked this conversation as resolved.
Show resolved Hide resolved
"paramStructure": "by-name",
shanejonas marked this conversation as resolved.
Show resolved Hide resolved
"params": [
{
"name": "accounts",
shanejonas marked this conversation as resolved.
Show resolved Hide resolved
"description": "If not provided, all permissions for the specified invoker will be revoked. Alternatively, if permissions list is provided, the method will delete permissions for each of the passed IDs",
"required": false,
"schema": {
"title": "optionalAccountsArray",
"type": "array",
"description": "Optional list of account addresses to be revoked",
"items": {
"$ref": "#/components/schemas/address"
}
}
}
],
"result": {
"name": "UpdatedPermissionsAfterRevoke",
"description": "The list of the revoked permissions objects",
shanejonas marked this conversation as resolved.
Show resolved Hide resolved
"schema": {
"$ref": "#/components/schemas/PermissionsList"
}
},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this response is expected for a dApp that was already connected previously, will the wallet_revokePermissions RPC method will only be accessible to dApps who are connected (ie: its a restricted method)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could. It doesn't have to be though, it could just return an empty array if there are no existing permissions.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just saw the update to the description. Makes sense now 👍

If we are allowing this method without being connected, we should ensure its resistant to timing attacks which can reveal if a specific snap or account exists on the device.

"errors": [
{
"code": 404,
shanejonas marked this conversation as resolved.
Show resolved Hide resolved
"message": "revoked permission was not found"
}
],
"examples": [
{
"name": "wallet_revokePermissions example of revoking all permissions",
"params": [
{
"name": "accounts",
"value": ["0x71c7656ec7ab88b098defb751b7401b5f6d8976f"]
}
],
"result": {
"name": "UpdatedPermissionsAfterRevoke",
"value": []
}
},
{
"name": "wallet_revokePermissions example of revoking specific account address",
"params": [
{
"name": "accounts",
"value": []
}
],
"result": {
"name": "UpdatedPermissionsAfterRevoke",
"value": []
}
}
]
},
{
"tags": [
{
Expand Down