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
107 changes: 85 additions & 22 deletions openrpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,60 @@
}
]
},
{
"name": "wallet_revokePermissions",
"tags": [
{
"$ref": "#/components/tags/MetaMask"
},
{
"$ref": "#/components/tags/Experimental"
}
],
"summary": "Revoke the current dapp permissions.",
"description": "Revoke previously granted permissions for the current dapp identified by origin",
"paramStructure": "by-name",
shanejonas marked this conversation as resolved.
Show resolved Hide resolved
"params": [
{
"name": "permission",
"required": false,
"schema": {
"type": "object",
"title": "PermissionKey",
"patternProperties": {
".*": {
"type": "object",
"title": "Permission",
"additionalProperties": false,
"properties": {
"caveats": {
"$ref": "#/components/schemas/Caveats"
}
}
}
}
}
}
],
"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": [],
"examples": [
{
"name": "wallet_revokePermissions example of revoking all permissions",
"params": [],
"result": {
"name": "UpdatedPermissionsAfterRevoke",
"value": []
}
}
]
},
{
"tags": [
{
Expand Down Expand Up @@ -368,7 +422,9 @@
"schema": {
"title": "WatchAssetOptions",
"type": "object",
"required": ["address"],
"required": [
"address"
],
"properties": {
"address": {
"description": "The address of the token contract.",
Expand Down Expand Up @@ -1038,6 +1094,29 @@
}
}
},
"Caveats": {
"description": "Every capability document MAY add restrictions on the way the capability may be used by adding to the caveat property. Capabilities inherit the restrictions from all caveat properties of their parents, and MAY add new caveats in addition to those of their parents.",
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"title": "Type",
"type": "string",
"description": "Type of caveat."
},
"value": {
"title": "CaveatValue",
"description": "Value of the caveat."
Copy link
Contributor

Choose a reason for hiding this comment

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

this is technically any. any thoughts on other ways to represent this @BelfordZ

},
"name": {
"title": "Name",
"type": "string",
"description": "Name of the caveat."
}
}
}
},
"Permission": {
"title": "Permission",
"type": "object",
Expand All @@ -1058,27 +1137,7 @@
"type": "string"
},
"caveats": {
"description": "The specific restrictions applied to the permitted method.",
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"title": "Type",
"type": "string",
"description": "Type of caveat."
},
"value": {
"title": "CaveatValue",
"description": "Value of the caveat."
},
"name": {
"title": "Name",
"type": "string",
"description": "Name of the caveat."
}
}
}
"$ref": "#/components/schemas/Caveats"
}
}
},
Expand All @@ -1101,6 +1160,10 @@
"Mobile": {
"name": "Mobile",
"description": "Mobile-specific methods."
},
"Experimental": {
"name": "Experimental",
"description": "Experimental methods."
}
},
"errors": {
Expand Down
Loading