From 43f8764d09e0b0adb53ed56723b9bf43ca9b37ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20Mi=C3=B1o?= Date: Thu, 13 Jun 2024 14:23:27 -0400 Subject: [PATCH 1/3] wallet_revokePermissions --- src/handleProviderRequest.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/handleProviderRequest.ts b/src/handleProviderRequest.ts index 63eb85a..5edec43 100644 --- a/src/handleProviderRequest.ts +++ b/src/handleProviderRequest.ts @@ -20,6 +20,10 @@ import { toHex } from './utils/hex'; import { errorCodes } from './references/errorCodes'; import { ChainNativeCurrency } from 'viem/_types/types/chain'; +interface WalletPermissionsParams { + eth_accounts: object; +} + const buildError = ({ id, message, @@ -48,6 +52,7 @@ export const handleProviderRequest = ({ checkRateLimit, isSupportedChain, getActiveSession, + removeAppSession, getChainNativeCurrency, getProvider, messengerProviderRequest, @@ -68,6 +73,7 @@ export const handleProviderRequest = ({ }) => Promise<{ id: number; error: Error } | undefined>; isSupportedChain: (chainId: number) => boolean; getActiveSession: ({ host }: { host: string }) => ActiveSession; + removeAppSession?: ({ host }: { host: string }) => void; getChainNativeCurrency: (chainId: number) => ChainNativeCurrency | undefined; getProvider: (options: { chainId?: number }) => Provider; messengerProviderRequest: ( @@ -458,6 +464,16 @@ export const handleProviderRequest = ({ }); break; } + case 'wallet_revokePermissions': { + if ( + !!removeAppSession && + (params?.[0] as WalletPermissionsParams)?.eth_accounts + ) { + removeAppSession?.({ host }); + response = null; + } + throw new Error('next'); + } default: { try { if (method?.substring(0, 7) === 'wallet_') { From 8a7d443ed14dab0629d5ac7d5471adb049520cf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20Mi=C3=B1o?= Date: Thu, 13 Jun 2024 14:25:52 -0400 Subject: [PATCH 2/3] bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6b2f197..336b7cb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rainbow-me/provider", - "version": "0.1.0", + "version": "0.1.1", "main": "dist/index.js", "license": "MIT", "files": [ From a08ef51b06103d8f0b0791167b648ca45520824c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20Mi=C3=B1o?= Date: Thu, 13 Jun 2024 14:45:32 -0400 Subject: [PATCH 3/3] audit resolution --- package.json | 3 ++- yarn.lock | 18 +++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 336b7cb..c0cb7dd 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "viem": "1.21.4" }, "resolutions": { - "vite": "5.1.7" + "vite": "5.1.7", + "braces": "3.0.3" } } \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index b5f8f77..ea00434 100644 --- a/yarn.lock +++ b/yarn.lock @@ -926,12 +926,12 @@ brace-expansion@^2.0.1: dependencies: balanced-match "^1.0.0" -braces@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" - integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== +braces@3.0.3, braces@^3.0.2: + version "3.0.3" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" + integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== dependencies: - fill-range "^7.0.1" + fill-range "^7.1.1" brorand@^1.1.0: version "1.1.0" @@ -1351,10 +1351,10 @@ file-entry-cache@^6.0.1: dependencies: flat-cache "^3.0.4" -fill-range@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" - integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== +fill-range@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" + integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== dependencies: to-regex-range "^5.0.1"