@metamask-previews/multichain-api-middleware 1.2.2-preview-3d9bbf60 → 1.2.4-preview-8c66598b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,10 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.2.4]
11
+
12
+ ### Changed
13
+
14
+ - Bump `@metamask/permission-controller` from `^12.0.0` to `^12.1.0` ([#6988](https://github.com/MetaMask/core/pull/6988))
15
+
16
+ ### Fixed
17
+
18
+ - Fix `wallet_revokeSession` error handling ([#6987](https://github.com/MetaMask/core/pull/6987))
19
+ - This was broken in a different way in v1.2.3. Fixed by the update to `@metamask/permission-controller@12.1.0`.
20
+
21
+ ## [1.2.3]
22
+
10
23
  ### Changed
11
24
 
12
25
  - Bump `@metamask/network-controller` from `^24.3.1` to `^25.0.0` ([#6962](https://github.com/MetaMask/core/pull/6962))
13
26
  - Bump `@metamask/permission-controller` from `^11.1.1` to `^12.0.0` ([#6962](https://github.com/MetaMask/core/pull/6962))
27
+ - Bump `@metamask/chain-agnostic-permission` from `^1.2.1` to `^1.2.2` ([#6986](https://github.com/MetaMask/core/pull/6986))
28
+
29
+ ### Fixed
30
+
31
+ - Fix `wallet_revokeSession` error handling in case where different versions of `@metamask/permission-controller` are used ([#6985](https://github.com/MetaMask/core/pull/6985))
14
32
 
15
33
  ## [1.2.2]
16
34
 
@@ -108,7 +126,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
108
126
 
109
127
  - Initial release
110
128
 
111
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/multichain-api-middleware@1.2.2...HEAD
129
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/multichain-api-middleware@1.2.4...HEAD
130
+ [1.2.4]: https://github.com/MetaMask/core/compare/@metamask/multichain-api-middleware@1.2.3...@metamask/multichain-api-middleware@1.2.4
131
+ [1.2.3]: https://github.com/MetaMask/core/compare/@metamask/multichain-api-middleware@1.2.2...@metamask/multichain-api-middleware@1.2.3
112
132
  [1.2.2]: https://github.com/MetaMask/core/compare/@metamask/multichain-api-middleware@1.2.1...@metamask/multichain-api-middleware@1.2.2
113
133
  [1.2.1]: https://github.com/MetaMask/core/compare/@metamask/multichain-api-middleware@1.2.0...@metamask/multichain-api-middleware@1.2.1
114
134
  [1.2.0]: https://github.com/MetaMask/core/compare/@metamask/multichain-api-middleware@1.1.0...@metamask/multichain-api-middleware@1.2.0
@@ -4,6 +4,24 @@ exports.walletRevokeSession = void 0;
4
4
  const chain_agnostic_permission_1 = require("@metamask/chain-agnostic-permission");
5
5
  const permission_controller_1 = require("@metamask/permission-controller");
6
6
  const rpc_errors_1 = require("@metamask/rpc-errors");
7
+ const utils_1 = require("@metamask/utils");
8
+ /**
9
+ * Check whether the given error is a permission error.
10
+ *
11
+ * @param error - The error to check.
12
+ * @returns Whether the error is a permission error.
13
+ */
14
+ function isPermissionError(error) {
15
+ if (!(0, utils_1.isObject)(error) ||
16
+ !('name' in error) ||
17
+ typeof error.name !== 'string') {
18
+ return false;
19
+ }
20
+ return [
21
+ permission_controller_1.UnrecognizedSubjectError.name,
22
+ permission_controller_1.PermissionDoesNotExistError.name,
23
+ ].includes(error.name);
24
+ }
7
25
  /**
8
26
  * Revokes specific session scopes from an existing caveat.
9
27
  * Fully revokes permission if no accounts remain permitted after iterating through scopes.
@@ -66,8 +84,7 @@ async function walletRevokeSessionHandler(request, response, _next, end, hooks)
66
84
  }
67
85
  }
68
86
  catch (err) {
69
- if (!(err instanceof permission_controller_1.UnrecognizedSubjectError) &&
70
- !(err instanceof permission_controller_1.PermissionDoesNotExistError)) {
87
+ if (!isPermissionError(err)) {
71
88
  console.error(err);
72
89
  return end(rpc_errors_1.rpcErrors.internal());
73
90
  }
@@ -1 +1 @@
1
- {"version":3,"file":"wallet-revokeSession.cjs","sourceRoot":"","sources":["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AAC;SACzC;aAAM;YACL,KAAK,CAAC,yBAAyB,CAAC,yDAA6B,CAAC,CAAC;SAChE;KACF;IAAC,OAAO,GAAG,EAAE;QACZ,IACE,CAAC,CAAC,GAAG,YAAY,gDAAwB,CAAC;YAC1C,CAAC,CAAC,GAAG,YAAY,mDAA2B,CAAC,EAC7C;YACA,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACnB,OAAO,GAAG,CAAC,sBAAS,CAAC,QAAQ,EAAE,CAAC,CAAC;SAClC;KACF;IAED,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,GAAG,EAAE,CAAC;AACf,CAAC;AACY,QAAA,mBAAmB,GAAG;IACjC,WAAW,EAAE,CAAC,sBAAsB,CAAC;IACrC,cAAc,EAAE,0BAA0B;IAC1C,SAAS,EAAE;QACT,yBAAyB,EAAE,IAAI;QAC/B,YAAY,EAAE,IAAI;QAClB,kBAAkB,EAAE,IAAI;KACzB;CACF,CAAC","sourcesContent":["import {\n Caip25CaveatMutators,\n Caip25CaveatType,\n Caip25EndowmentPermissionName,\n getCaipAccountIdsFromCaip25CaveatValue,\n} from '@metamask/chain-agnostic-permission';\nimport type {\n JsonRpcEngineNextCallback,\n JsonRpcEngineEndCallback,\n} from '@metamask/json-rpc-engine';\nimport {\n CaveatMutatorOperation,\n PermissionDoesNotExistError,\n UnrecognizedSubjectError,\n} from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type { JsonRpcSuccess, JsonRpcRequest } from '@metamask/utils';\n\nimport type { WalletRevokeSessionHooks } from './types';\n\n/**\n * Revokes specific session scopes from an existing caveat.\n * Fully revokes permission if no accounts remain permitted after iterating through scopes.\n *\n * @param scopes - Array of scope strings to remove from the caveat.\n * @param hooks - The hooks object.\n * @param hooks.revokePermissionForOrigin - The hook for revoking a permission for an origin function.\n * @param hooks.updateCaveat - The hook used to conditionally update the caveat rather than fully revoke the permission.\n * @param hooks.getCaveatForOrigin - The hook to fetch an existing caveat for the origin of the request.\n */\nfunction partialRevokePermissions(\n scopes: string[],\n hooks: WalletRevokeSessionHooks,\n) {\n let updatedCaveatValue = hooks.getCaveatForOrigin(\n Caip25EndowmentPermissionName,\n Caip25CaveatType,\n ).value;\n\n for (const scopeString of scopes) {\n const result = Caip25CaveatMutators[Caip25CaveatType].removeScope(\n updatedCaveatValue,\n scopeString,\n );\n\n // If operation is a Noop, it means a scope was passed that was not present in the permission, so we proceed with the loop\n if (result.operation === CaveatMutatorOperation.Noop) {\n continue;\n }\n\n updatedCaveatValue = result?.value ?? {\n requiredScopes: {},\n optionalScopes: {},\n sessionProperties: {},\n isMultichainOrigin: true,\n };\n }\n\n const caipAccountIds =\n getCaipAccountIdsFromCaip25CaveatValue(updatedCaveatValue);\n\n // We fully revoke permission if no accounts are left after scope removal loop.\n if (!caipAccountIds.length) {\n hooks.revokePermissionForOrigin(Caip25EndowmentPermissionName);\n } else {\n hooks.updateCaveat(\n Caip25EndowmentPermissionName,\n Caip25CaveatType,\n updatedCaveatValue,\n );\n }\n}\n\n/**\n * Handler for the `wallet_revokeSession` RPC method as specified by [CAIP-285](https://chainagnostic.org/CAIPs/caip-285).\n * The implementation below deviates from the linked spec in that it ignores the `sessionId` param\n * and instead revokes the singular session for the origin if available. Additionally,\n * the handler also does not return an error if there is currently no active session and instead\n * returns true which is the same result returned if an active session was actually revoked.\n *\n * @param request - The JSON-RPC request object. Unused.\n * @param response - The JSON-RPC response object.\n * @param _next - The next middleware function. Unused.\n * @param end - The end callback function.\n * @param hooks - The hooks object.\n * @param hooks.revokePermissionForOrigin - The hook for revoking a permission for an origin function.\n * @param hooks.updateCaveat - The hook used to conditionally update the caveat rather than fully revoke the permission.\n * @param hooks.getCaveatForOrigin - The hook to fetch an existing caveat for the origin of the request.\n * @returns Nothing.\n */\nasync function walletRevokeSessionHandler(\n request: JsonRpcRequest & {\n origin: string;\n params: { scopes?: string[] };\n },\n response: JsonRpcSuccess,\n _next: JsonRpcEngineNextCallback,\n end: JsonRpcEngineEndCallback,\n hooks: WalletRevokeSessionHooks,\n) {\n const {\n params: { scopes },\n } = request;\n\n try {\n if (scopes?.length) {\n partialRevokePermissions(scopes, hooks);\n } else {\n hooks.revokePermissionForOrigin(Caip25EndowmentPermissionName);\n }\n } catch (err) {\n if (\n !(err instanceof UnrecognizedSubjectError) &&\n !(err instanceof PermissionDoesNotExistError)\n ) {\n console.error(err);\n return end(rpcErrors.internal());\n }\n }\n\n response.result = true;\n return end();\n}\nexport const walletRevokeSession = {\n methodNames: ['wallet_revokeSession'],\n implementation: walletRevokeSessionHandler,\n hookNames: {\n revokePermissionForOrigin: true,\n updateCaveat: true,\n getCaveatForOrigin: true,\n },\n};\n"]}
1
+ {"version":3,"file":"wallet-revokeSession.cjs","sourceRoot":"","sources":["../../src/handlers/wallet-revokeSession.ts"],"names":[],"mappings":";;;AAAA,mFAK6C;AAK7C,2EAIyC;AACzC,qDAAiD;AACjD,2CAIyB;AAIzB;;;;;GAKG;AACH,SAAS,iBAAiB,CAAC,KAAc;IACvC,IACE,CAAC,IAAA,gBAAQ,EAAC,KAAK,CAAC;QAChB,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC;QAClB,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,EAC9B;QACA,OAAO,KAAK,CAAC;KACd;IAED,OAAO;QACL,gDAAwB,CAAC,IAAI;QAC7B,mDAA2B,CAAC,IAAI;KACjC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,wBAAwB,CAC/B,MAAgB,EAChB,KAA+B;IAE/B,IAAI,kBAAkB,GAAG,KAAK,CAAC,kBAAkB,CAC/C,yDAA6B,EAC7B,4CAAgB,CACjB,CAAC,KAAK,CAAC;IAER,KAAK,MAAM,WAAW,IAAI,MAAM,EAAE;QAChC,MAAM,MAAM,GAAG,gDAAoB,CAAC,4CAAgB,CAAC,CAAC,WAAW,CAC/D,kBA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mB,GAAG;IACjC,WAAW,EAAE,CAAC,sBAAsB,CAAC;IACrC,cAAc,EAAE,0BAA0B;IAC1C,SAAS,EAAE;QACT,yBAAyB,EAAE,IAAI;QAC/B,YAAY,EAAE,IAAI;QAClB,kBAAkB,EAAE,IAAI;KACzB;CACF,CAAC","sourcesContent":["import {\n Caip25CaveatMutators,\n Caip25CaveatType,\n Caip25EndowmentPermissionName,\n getCaipAccountIdsFromCaip25CaveatValue,\n} from '@metamask/chain-agnostic-permission';\nimport type {\n JsonRpcEngineNextCallback,\n JsonRpcEngineEndCallback,\n} from '@metamask/json-rpc-engine';\nimport {\n CaveatMutatorOperation,\n PermissionDoesNotExistError,\n UnrecognizedSubjectError,\n} from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport {\n type JsonRpcSuccess,\n type JsonRpcRequest,\n isObject,\n} from '@metamask/utils';\n\nimport type { WalletRevokeSessionHooks } from './types';\n\n/**\n * Check whether the given error is a permission error.\n *\n * @param error - The error to check.\n * @returns Whether the error is a permission error.\n */\nfunction isPermissionError(error: unknown) {\n if (\n !isObject(error) ||\n !('name' in error) ||\n typeof error.name !== 'string'\n ) {\n return false;\n }\n\n return [\n UnrecognizedSubjectError.name,\n PermissionDoesNotExistError.name,\n ].includes(error.name);\n}\n\n/**\n * Revokes specific session scopes from an existing caveat.\n * Fully revokes permission if no accounts remain permitted after iterating through scopes.\n *\n * @param scopes - Array of scope strings to remove from the caveat.\n * @param hooks - The hooks object.\n * @param hooks.revokePermissionForOrigin - The hook for revoking a permission for an origin function.\n * @param hooks.updateCaveat - The hook used to conditionally update the caveat rather than fully revoke the permission.\n * @param hooks.getCaveatForOrigin - The hook to fetch an existing caveat for the origin of the request.\n */\nfunction partialRevokePermissions(\n scopes: string[],\n hooks: WalletRevokeSessionHooks,\n) {\n let updatedCaveatValue = hooks.getCaveatForOrigin(\n Caip25EndowmentPermissionName,\n Caip25CaveatType,\n ).value;\n\n for (const scopeString of scopes) {\n const result = Caip25CaveatMutators[Caip25CaveatType].removeScope(\n updatedCaveatValue,\n scopeString,\n );\n\n // If operation is a Noop, it means a scope was passed that was not present in the permission, so we proceed with the loop\n if (result.operation === CaveatMutatorOperation.Noop) {\n continue;\n }\n\n updatedCaveatValue = result?.value ?? {\n requiredScopes: {},\n optionalScopes: {},\n sessionProperties: {},\n isMultichainOrigin: true,\n };\n }\n\n const caipAccountIds =\n getCaipAccountIdsFromCaip25CaveatValue(updatedCaveatValue);\n\n // We fully revoke permission if no accounts are left after scope removal loop.\n if (!caipAccountIds.length) {\n hooks.revokePermissionForOrigin(Caip25EndowmentPermissionName);\n } else {\n hooks.updateCaveat(\n Caip25EndowmentPermissionName,\n Caip25CaveatType,\n updatedCaveatValue,\n );\n }\n}\n\n/**\n * Handler for the `wallet_revokeSession` RPC method as specified by [CAIP-285](https://chainagnostic.org/CAIPs/caip-285).\n * The implementation below deviates from the linked spec in that it ignores the `sessionId` param\n * and instead revokes the singular session for the origin if available. Additionally,\n * the handler also does not return an error if there is currently no active session and instead\n * returns true which is the same result returned if an active session was actually revoked.\n *\n * @param request - The JSON-RPC request object. Unused.\n * @param response - The JSON-RPC response object.\n * @param _next - The next middleware function. Unused.\n * @param end - The end callback function.\n * @param hooks - The hooks object.\n * @param hooks.revokePermissionForOrigin - The hook for revoking a permission for an origin function.\n * @param hooks.updateCaveat - The hook used to conditionally update the caveat rather than fully revoke the permission.\n * @param hooks.getCaveatForOrigin - The hook to fetch an existing caveat for the origin of the request.\n * @returns Nothing.\n */\nasync function walletRevokeSessionHandler(\n request: JsonRpcRequest & {\n origin: string;\n params: { scopes?: string[] };\n },\n response: JsonRpcSuccess,\n _next: JsonRpcEngineNextCallback,\n end: JsonRpcEngineEndCallback,\n hooks: WalletRevokeSessionHooks,\n) {\n const {\n params: { scopes },\n } = request;\n\n try {\n if (scopes?.length) {\n partialRevokePermissions(scopes, hooks);\n } else {\n hooks.revokePermissionForOrigin(Caip25EndowmentPermissionName);\n }\n } catch (err) {\n if (!isPermissionError(err)) {\n console.error(err);\n return end(rpcErrors.internal());\n }\n }\n\n response.result = true;\n return end();\n}\nexport const walletRevokeSession = {\n methodNames: ['wallet_revokeSession'],\n implementation: walletRevokeSessionHandler,\n hookNames: {\n revokePermissionForOrigin: true,\n updateCaveat: true,\n getCaveatForOrigin: true,\n },\n};\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { JsonRpcEngineNextCallback, JsonRpcEngineEndCallback } from "@metamask/json-rpc-engine";
2
- import type { JsonRpcSuccess, JsonRpcRequest } from "@metamask/utils";
2
+ import { type JsonRpcSuccess, type JsonRpcRequest } from "@metamask/utils";
3
3
  import type { WalletRevokeSessionHooks } from "./types.cjs";
4
4
  /**
5
5
  * Handler for the `wallet_revokeSession` RPC method as specified by [CAIP-285](https://chainagnostic.org/CAIPs/caip-285).
@@ -1 +1 @@
1
- {"version":3,"file":"wallet-revokeSession.d.cts","sourceRoot":"","sources":["../../src/handlers/wallet-revokeSession.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,yBAAyB,EACzB,wBAAwB,EACzB,kCAAkC;AAOnC,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,wBAAwB;AAEtE,OAAO,KAAK,EAAE,wBAAwB,EAAE,oBAAgB;AAuDxD;;;;;;;;;;;;;;;;GAgBG;AACH,iBAAe,0BAA0B,CACvC,OAAO,EAAE,cAAc,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CAC/B,EACD,QAAQ,EAAE,cAAc,EACxB,KAAK,EAAE,yBAAyB,EAChC,GAAG,EAAE,wBAAwB,EAC7B,KAAK,EAAE,wBAAwB,iBAwBhC;AACD,eAAO,MAAM,mBAAmB;;;;;;;;CAQ/B,CAAC"}
1
+ {"version":3,"file":"wallet-revokeSession.d.cts","sourceRoot":"","sources":["../../src/handlers/wallet-revokeSession.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,yBAAyB,EACzB,wBAAwB,EACzB,kCAAkC;AAOnC,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,cAAc,EAEpB,wBAAwB;AAEzB,OAAO,KAAK,EAAE,wBAAwB,EAAE,oBAAgB;AA4ExD;;;;;;;;;;;;;;;;GAgBG;AACH,iBAAe,0BAA0B,CACvC,OAAO,EAAE,cAAc,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CAC/B,EACD,QAAQ,EAAE,cAAc,EACxB,KAAK,EAAE,yBAAyB,EAChC,GAAG,EAAE,wBAAwB,EAC7B,KAAK,EAAE,wBAAwB,iBAqBhC;AACD,eAAO,MAAM,mBAAmB;;;;;;;;CAQ/B,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { JsonRpcEngineNextCallback, JsonRpcEngineEndCallback } from "@metamask/json-rpc-engine";
2
- import type { JsonRpcSuccess, JsonRpcRequest } from "@metamask/utils";
2
+ import { type JsonRpcSuccess, type JsonRpcRequest } from "@metamask/utils";
3
3
  import type { WalletRevokeSessionHooks } from "./types.mjs";
4
4
  /**
5
5
  * Handler for the `wallet_revokeSession` RPC method as specified by [CAIP-285](https://chainagnostic.org/CAIPs/caip-285).
@@ -1 +1 @@
1
- {"version":3,"file":"wallet-revokeSession.d.mts","sourceRoot":"","sources":["../../src/handlers/wallet-revokeSession.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,yBAAyB,EACzB,wBAAwB,EACzB,kCAAkC;AAOnC,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,wBAAwB;AAEtE,OAAO,KAAK,EAAE,wBAAwB,EAAE,oBAAgB;AAuDxD;;;;;;;;;;;;;;;;GAgBG;AACH,iBAAe,0BAA0B,CACvC,OAAO,EAAE,cAAc,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CAC/B,EACD,QAAQ,EAAE,cAAc,EACxB,KAAK,EAAE,yBAAyB,EAChC,GAAG,EAAE,wBAAwB,EAC7B,KAAK,EAAE,wBAAwB,iBAwBhC;AACD,eAAO,MAAM,mBAAmB;;;;;;;;CAQ/B,CAAC"}
1
+ {"version":3,"file":"wallet-revokeSession.d.mts","sourceRoot":"","sources":["../../src/handlers/wallet-revokeSession.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,yBAAyB,EACzB,wBAAwB,EACzB,kCAAkC;AAOnC,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,cAAc,EAEpB,wBAAwB;AAEzB,OAAO,KAAK,EAAE,wBAAwB,EAAE,oBAAgB;AA4ExD;;;;;;;;;;;;;;;;GAgBG;AACH,iBAAe,0BAA0B,CACvC,OAAO,EAAE,cAAc,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CAC/B,EACD,QAAQ,EAAE,cAAc,EACxB,KAAK,EAAE,yBAAyB,EAChC,GAAG,EAAE,wBAAwB,EAC7B,KAAK,EAAE,wBAAwB,iBAqBhC;AACD,eAAO,MAAM,mBAAmB;;;;;;;;CAQ/B,CAAC"}
@@ -1,6 +1,24 @@
1
1
  import { Caip25CaveatMutators, Caip25CaveatType, Caip25EndowmentPermissionName, getCaipAccountIdsFromCaip25CaveatValue } from "@metamask/chain-agnostic-permission";
2
2
  import { CaveatMutatorOperation, PermissionDoesNotExistError, UnrecognizedSubjectError } from "@metamask/permission-controller";
3
3
  import { rpcErrors } from "@metamask/rpc-errors";
4
+ import { isObject } from "@metamask/utils";
5
+ /**
6
+ * Check whether the given error is a permission error.
7
+ *
8
+ * @param error - The error to check.
9
+ * @returns Whether the error is a permission error.
10
+ */
11
+ function isPermissionError(error) {
12
+ if (!isObject(error) ||
13
+ !('name' in error) ||
14
+ typeof error.name !== 'string') {
15
+ return false;
16
+ }
17
+ return [
18
+ UnrecognizedSubjectError.name,
19
+ PermissionDoesNotExistError.name,
20
+ ].includes(error.name);
21
+ }
4
22
  /**
5
23
  * Revokes specific session scopes from an existing caveat.
6
24
  * Fully revokes permission if no accounts remain permitted after iterating through scopes.
@@ -63,8 +81,7 @@ async function walletRevokeSessionHandler(request, response, _next, end, hooks)
63
81
  }
64
82
  }
65
83
  catch (err) {
66
- if (!(err instanceof UnrecognizedSubjectError) &&
67
- !(err instanceof PermissionDoesNotExistError)) {
84
+ if (!isPermissionError(err)) {
68
85
  console.error(err);
69
86
  return end(rpcErrors.internal());
70
87
  }
@@ -1 +1 @@
1
- {"version":3,"file":"wallet-revokeSession.mjs","sourceRoot":"","sources":["../../src/handlers/wallet-revokeSession.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,6BAA6B,EAC7B,sCAAsC,EACvC,4CAA4C;AAK7C,OAAO,EACL,sBAAsB,EACtB,2BAA2B,EAC3B,wBAAwB,EACzB,wCAAwC;AACzC,OAAO,EAAE,SAAS,EAAE,6BAA6B;AAKjD;;;;;;;;;GASG;AACH,SAAS,wBAAwB,CAC/B,MAAgB,EAChB,KAA+B;IAE/B,IAAI,kBAAkB,GAAG,KAAK,CAAC,kBAAkB,CAC/C,6BAA6B,EAC7B,gBAAgB,CACjB,CAAC,KAAK,CAAC;IAER,KAAK,MAAM,WAAW,IAAI,MAAM,EAAE;QAChC,MAAM,MAAM,GAAG,oBAAoB,CAAC,gBAAgB,CAAC,CAAC,WAAW,CAC/D,kBAAkB,EAClB,WAAW,CACZ,CAAC;QAEF,0HAA0H;QAC1H,IAAI,MAAM,CAAC,SAAS,KAAK,sBAAsB,CAAC,IAAI,EAAE;YACpD,SAAS;SACV;QAED,kBAAkB,GAAG,MAAM,EAAE,KAAK,IAAI;YACpC,cAAc,EAAE,EAAE;YAClB,cAAc,EAAE,EAAE;YAClB,i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I;KACzB;CACF,CAAC","sourcesContent":["import {\n Caip25CaveatMutators,\n Caip25CaveatType,\n Caip25EndowmentPermissionName,\n getCaipAccountIdsFromCaip25CaveatValue,\n} from '@metamask/chain-agnostic-permission';\nimport type {\n JsonRpcEngineNextCallback,\n JsonRpcEngineEndCallback,\n} from '@metamask/json-rpc-engine';\nimport {\n CaveatMutatorOperation,\n PermissionDoesNotExistError,\n UnrecognizedSubjectError,\n} from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport type { JsonRpcSuccess, JsonRpcRequest } from '@metamask/utils';\n\nimport type { WalletRevokeSessionHooks } from './types';\n\n/**\n * Revokes specific session scopes from an existing caveat.\n * Fully revokes permission if no accounts remain permitted after iterating through scopes.\n *\n * @param scopes - Array of scope strings to remove from the caveat.\n * @param hooks - The hooks object.\n * @param hooks.revokePermissionForOrigin - The hook for revoking a permission for an origin function.\n * @param hooks.updateCaveat - The hook used to conditionally update the caveat rather than fully revoke the permission.\n * @param hooks.getCaveatForOrigin - The hook to fetch an existing caveat for the origin of the request.\n */\nfunction partialRevokePermissions(\n scopes: string[],\n hooks: WalletRevokeSessionHooks,\n) {\n let updatedCaveatValue = hooks.getCaveatForOrigin(\n Caip25EndowmentPermissionName,\n Caip25CaveatType,\n ).value;\n\n for (const scopeString of scopes) {\n const result = Caip25CaveatMutators[Caip25CaveatType].removeScope(\n updatedCaveatValue,\n scopeString,\n );\n\n // If operation is a Noop, it means a scope was passed that was not present in the permission, so we proceed with the loop\n if (result.operation === CaveatMutatorOperation.Noop) {\n continue;\n }\n\n updatedCaveatValue = result?.value ?? {\n requiredScopes: {},\n optionalScopes: {},\n sessionProperties: {},\n isMultichainOrigin: true,\n };\n }\n\n const caipAccountIds =\n getCaipAccountIdsFromCaip25CaveatValue(updatedCaveatValue);\n\n // We fully revoke permission if no accounts are left after scope removal loop.\n if (!caipAccountIds.length) {\n hooks.revokePermissionForOrigin(Caip25EndowmentPermissionName);\n } else {\n hooks.updateCaveat(\n Caip25EndowmentPermissionName,\n Caip25CaveatType,\n updatedCaveatValue,\n );\n }\n}\n\n/**\n * Handler for the `wallet_revokeSession` RPC method as specified by [CAIP-285](https://chainagnostic.org/CAIPs/caip-285).\n * The implementation below deviates from the linked spec in that it ignores the `sessionId` param\n * and instead revokes the singular session for the origin if available. Additionally,\n * the handler also does not return an error if there is currently no active session and instead\n * returns true which is the same result returned if an active session was actually revoked.\n *\n * @param request - The JSON-RPC request object. Unused.\n * @param response - The JSON-RPC response object.\n * @param _next - The next middleware function. Unused.\n * @param end - The end callback function.\n * @param hooks - The hooks object.\n * @param hooks.revokePermissionForOrigin - The hook for revoking a permission for an origin function.\n * @param hooks.updateCaveat - The hook used to conditionally update the caveat rather than fully revoke the permission.\n * @param hooks.getCaveatForOrigin - The hook to fetch an existing caveat for the origin of the request.\n * @returns Nothing.\n */\nasync function walletRevokeSessionHandler(\n request: JsonRpcRequest & {\n origin: string;\n params: { scopes?: string[] };\n },\n response: JsonRpcSuccess,\n _next: JsonRpcEngineNextCallback,\n end: JsonRpcEngineEndCallback,\n hooks: WalletRevokeSessionHooks,\n) {\n const {\n params: { scopes },\n } = request;\n\n try {\n if (scopes?.length) {\n partialRevokePermissions(scopes, hooks);\n } else {\n hooks.revokePermissionForOrigin(Caip25EndowmentPermissionName);\n }\n } catch (err) {\n if (\n !(err instanceof UnrecognizedSubjectError) &&\n !(err instanceof PermissionDoesNotExistError)\n ) {\n console.error(err);\n return end(rpcErrors.internal());\n }\n }\n\n response.result = true;\n return end();\n}\nexport const walletRevokeSession = {\n methodNames: ['wallet_revokeSession'],\n implementation: walletRevokeSessionHandler,\n hookNames: {\n revokePermissionForOrigin: true,\n updateCaveat: true,\n getCaveatForOrigin: true,\n },\n};\n"]}
1
+ {"version":3,"file":"wallet-revokeSession.mjs","sourceRoot":"","sources":["../../src/handlers/wallet-revokeSession.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,6BAA6B,EAC7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CAAC,6BAA6B,CAAC,CAAC;KAChE;SAAM;QACL,KAAK,CAAC,YAAY,CAChB,6BAA6B,EAC7B,gBAAgB,EAChB,kBAAkB,CACnB,CAAC;KACH;AACH,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,KAAK,UAAU,0BAA0B,CACvC,OAGC,EACD,QAAwB,EACxB,KAAgC,EAChC,GAA6B,EAC7B,KAA+B;IAE/B,MAAM,EACJ,MAAM,EAAE,EAAE,MAAM,EAAE,GACnB,GAAG,OAAO,CAAC;IAEZ,IAAI;QACF,IAAI,MAAM,EAAE,MAAM,EAAE;YAClB,wBAAwB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;SACzC;aAAM;YACL,KAAK,CAAC,yBAAyB,CAAC,6BAA6B,CAAC,CAAC;SAChE;KACF;IAAC,OAAO,GAAG,EAAE;QACZ,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE;YAC3B,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACnB,OAAO,GAAG,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC;SAClC;KACF;IAED,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,GAAG,EAAE,CAAC;AACf,CAAC;AACD,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,WAAW,EAAE,CAAC,sBAAsB,CAAC;IACrC,cAAc,EAAE,0BAA0B;IAC1C,SAAS,EAAE;QACT,yBAAyB,EAAE,IAAI;QAC/B,YAAY,EAAE,IAAI;QAClB,kBAAkB,EAAE,IAAI;KACzB;CACF,CAAC","sourcesContent":["import {\n Caip25CaveatMutators,\n Caip25CaveatType,\n Caip25EndowmentPermissionName,\n getCaipAccountIdsFromCaip25CaveatValue,\n} from '@metamask/chain-agnostic-permission';\nimport type {\n JsonRpcEngineNextCallback,\n JsonRpcEngineEndCallback,\n} from '@metamask/json-rpc-engine';\nimport {\n CaveatMutatorOperation,\n PermissionDoesNotExistError,\n UnrecognizedSubjectError,\n} from '@metamask/permission-controller';\nimport { rpcErrors } from '@metamask/rpc-errors';\nimport {\n type JsonRpcSuccess,\n type JsonRpcRequest,\n isObject,\n} from '@metamask/utils';\n\nimport type { WalletRevokeSessionHooks } from './types';\n\n/**\n * Check whether the given error is a permission error.\n *\n * @param error - The error to check.\n * @returns Whether the error is a permission error.\n */\nfunction isPermissionError(error: unknown) {\n if (\n !isObject(error) ||\n !('name' in error) ||\n typeof error.name !== 'string'\n ) {\n return false;\n }\n\n return [\n UnrecognizedSubjectError.name,\n PermissionDoesNotExistError.name,\n ].includes(error.name);\n}\n\n/**\n * Revokes specific session scopes from an existing caveat.\n * Fully revokes permission if no accounts remain permitted after iterating through scopes.\n *\n * @param scopes - Array of scope strings to remove from the caveat.\n * @param hooks - The hooks object.\n * @param hooks.revokePermissionForOrigin - The hook for revoking a permission for an origin function.\n * @param hooks.updateCaveat - The hook used to conditionally update the caveat rather than fully revoke the permission.\n * @param hooks.getCaveatForOrigin - The hook to fetch an existing caveat for the origin of the request.\n */\nfunction partialRevokePermissions(\n scopes: string[],\n hooks: WalletRevokeSessionHooks,\n) {\n let updatedCaveatValue = hooks.getCaveatForOrigin(\n Caip25EndowmentPermissionName,\n Caip25CaveatType,\n ).value;\n\n for (const scopeString of scopes) {\n const result = Caip25CaveatMutators[Caip25CaveatType].removeScope(\n updatedCaveatValue,\n scopeString,\n );\n\n // If operation is a Noop, it means a scope was passed that was not present in the permission, so we proceed with the loop\n if (result.operation === CaveatMutatorOperation.Noop) {\n continue;\n }\n\n updatedCaveatValue = result?.value ?? {\n requiredScopes: {},\n optionalScopes: {},\n sessionProperties: {},\n isMultichainOrigin: true,\n };\n }\n\n const caipAccountIds =\n getCaipAccountIdsFromCaip25CaveatValue(updatedCaveatValue);\n\n // We fully revoke permission if no accounts are left after scope removal loop.\n if (!caipAccountIds.length) {\n hooks.revokePermissionForOrigin(Caip25EndowmentPermissionName);\n } else {\n hooks.updateCaveat(\n Caip25EndowmentPermissionName,\n Caip25CaveatType,\n updatedCaveatValue,\n );\n }\n}\n\n/**\n * Handler for the `wallet_revokeSession` RPC method as specified by [CAIP-285](https://chainagnostic.org/CAIPs/caip-285).\n * The implementation below deviates from the linked spec in that it ignores the `sessionId` param\n * and instead revokes the singular session for the origin if available. Additionally,\n * the handler also does not return an error if there is currently no active session and instead\n * returns true which is the same result returned if an active session was actually revoked.\n *\n * @param request - The JSON-RPC request object. Unused.\n * @param response - The JSON-RPC response object.\n * @param _next - The next middleware function. Unused.\n * @param end - The end callback function.\n * @param hooks - The hooks object.\n * @param hooks.revokePermissionForOrigin - The hook for revoking a permission for an origin function.\n * @param hooks.updateCaveat - The hook used to conditionally update the caveat rather than fully revoke the permission.\n * @param hooks.getCaveatForOrigin - The hook to fetch an existing caveat for the origin of the request.\n * @returns Nothing.\n */\nasync function walletRevokeSessionHandler(\n request: JsonRpcRequest & {\n origin: string;\n params: { scopes?: string[] };\n },\n response: JsonRpcSuccess,\n _next: JsonRpcEngineNextCallback,\n end: JsonRpcEngineEndCallback,\n hooks: WalletRevokeSessionHooks,\n) {\n const {\n params: { scopes },\n } = request;\n\n try {\n if (scopes?.length) {\n partialRevokePermissions(scopes, hooks);\n } else {\n hooks.revokePermissionForOrigin(Caip25EndowmentPermissionName);\n }\n } catch (err) {\n if (!isPermissionError(err)) {\n console.error(err);\n return end(rpcErrors.internal());\n }\n }\n\n response.result = true;\n return end();\n}\nexport const walletRevokeSession = {\n methodNames: ['wallet_revokeSession'],\n implementation: walletRevokeSessionHandler,\n hookNames: {\n revokePermissionForOrigin: true,\n updateCaveat: true,\n getCaveatForOrigin: true,\n },\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/multichain-api-middleware",
3
- "version": "1.2.2-preview-3d9bbf60",
3
+ "version": "1.2.4-preview-8c66598b",
4
4
  "description": "JSON-RPC methods and middleware to support the MetaMask Multichain API",
5
5
  "keywords": [
6
6
  "MetaMask",
@@ -48,11 +48,11 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@metamask/api-specs": "^0.14.0",
51
- "@metamask/chain-agnostic-permission": "^1.2.1",
51
+ "@metamask/chain-agnostic-permission": "^1.2.2",
52
52
  "@metamask/controller-utils": "^11.14.1",
53
53
  "@metamask/json-rpc-engine": "^10.1.1",
54
54
  "@metamask/network-controller": "^25.0.0",
55
- "@metamask/permission-controller": "^12.0.0",
55
+ "@metamask/permission-controller": "^12.1.0",
56
56
  "@metamask/rpc-errors": "^7.0.2",
57
57
  "@metamask/utils": "^11.8.1",
58
58
  "@open-rpc/meta-schema": "^1.14.6",