Skip to content

Latest commit

 

History

History
545 lines (376 loc) · 31.7 KB

File metadata and controls

545 lines (376 loc) · 31.7 KB

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

Changed

  • Bump @metamask/controller-utils from ^12.0.0 to ^12.1.0 (#8774)

Changed

  • Bump @metamask/json-rpc-engine from ^10.3.0 to ^10.5.0 (#8746, #8753)
  • Bump @metamask/controller-utils from ^11.20.0 to ^12.0.0 (#8755)

Added

  • Expose missing public PermissionController methods through its messenger (#8675)
    • The following actions are now available:
      • PermissionController:acceptPermissionsRequest,
      • PermissionController:rejectPermissionsRequest,
      • PermissionController:revokePermission,
      • PermissionController:updatePermissionsByCaveat,
      • PermissionController:getPermission
    • Corresponding action types are available as well.

Added

  • Add createPermissionMiddlewareV2, a JsonRpcEngineV2 variant of the standalone permission middleware factory (#8532)
  • Add messenger option to permission specification builders, allowing restricted-method specs to receive a scoped messenger in place of methodHooks (#8551)
    • Use the actionNames field on the specification builder and createRestrictedMethodMessenger to construct the scoped messenger.

Changed

  • BREAKING: Decouple the permission middleware from PermissionController and expose it as a standalone function (#8532)
    • The standalone createPermissionMiddleware replaces the former PermissionController.createPermissionMiddleware; it is imported from @metamask/permission-controller and called with a messenger and subject metadata, and targets the legacy JsonRpcEngine.
    • New integrations should prefer createPermissionMiddlewareV2, which targets JsonRpcEngineV2.
    • PermissionController.getRestrictedMethod no longer serves a purpose, and is removed. Restricted methods should be invoked via the :executeRestrictedMethod action instead.
  • Bump @metamask/json-rpc-engine from ^10.2.4 to ^10.3.0 (#8661)
  • Bump @metamask/controller-utils from ^11.19.0 to ^11.20.0 (#8344)
  • Bump @metamask/messenger from ^1.0.0 to ^1.2.0 (#8364, #8373, #8632)
  • Bump @metamask/base-controller from ^9.0.1 to ^9.1.0 (#8457)

Deprecated

  • Deprecate createPermissionMiddleware in favor of createPermissionMiddlewareV2, which targets JsonRpcEngineV2 (#8532)

Removed

  • BREAKING: Remove factoryHooks, validatorHooks, and related fields from permission specification builders (#8551)
  • BREAKING: Remove permitted method handlers and types (#8583)
    • The permitted method handlers were unused in practice. Replacement types for generic RPC method implementations are available in @metamask/json-rpc-engine@10.3.0.

Added

  • Expose missing public PermissionController methods through its messenger (#8201)
    • The following actions are now available:
      • PermissionController:clearState
    • Corresponding action types (e.g. PermissionControllerClearStateAction) are available as well.
  • Expose missing public SubjectMetadataController methods through its messenger (#8201)
    • The following actions are now available:
      • SubjectMetadataController:clearState
      • SubjectMetadataController:trimMetadataState
    • Corresponding action types (e.g. SubjectMetadataControllerClearStateAction) are available as well.

Changed

  • Bump @metamask/approval-controller from ^9.0.0 to ^9.0.1 (#8317)
  • Bump @metamask/base-controller from ^9.0.0 to ^9.0.1 (#8317)
  • Bump @metamask/json-rpc-engine from ^10.2.3 to ^10.2.4 (#8317)
  • Bump @metamask/messenger from ^0.3.0 to ^1.0.0 (#8317)

Deprecated

  • Deprecate action types in favor of PermissionController...Action and SubjectMetadataController...Action types (#8201)
    • For the PermissionController:
      • GetPermissionControllerState is now PermissionControllerGetStateAction.
      • GetSubjects is now PermissionControllerGetSubjectsAction.
      • GetPermissions is now PermissionControllerGetPermissionsAction.
      • HasPermissions is now PermissionControllerHasPermissionsAction.
      • HasPermission is now PermissionControllerHasPermissionAction.
      • GrantPermissions is now PermissionControllerGrantPermissionsAction.
      • GrantPermissionsIncremental is now PermissionControllerGrantPermissionsIncrementalAction.
      • RequestPermissions is now PermissionControllerRequestPermissionsAction.
      • RequestPermissionsIncremental is now PermissionControllerRequestPermissionsIncrementalAction.
      • RevokePermissions is now PermissionControllerRevokePermissionsAction.
      • RevokeAllPermissions is now PermissionControllerRevokeAllPermissionsAction.
      • RevokePermissionForAllSubjects is now PermissionControllerRevokePermissionForAllSubjectsAction.
      • UpdateCaveat is now PermissionControllerUpdateCaveatAction.
      • GetCaveat is now PermissionControllerGetCaveatAction.
      • ClearPermissions is now PermissionControllerClearPermissionsAction.
      • GetEndowments is now PermissionControllerGetEndowmentsAction.
    • For the SubjectMetadataController:
      • GetSubjectMetadataControllerState is now SubjectMetadataControllerGetStateAction.
      • GetSubjectMetadata is now SubjectMetadataControllerGetMetadataAction.
      • AddSubjectMetadata is now SubjectMetadataControllerAddMetadataAction.
    • The old types are still exported but are now marked as deprecated and will be removed in a future release.

Changed

  • Bump @metamask/approval-controller from ^8.0.0 to ^9.0.0 (#8225)
  • Bump @metamask/json-rpc-engine from ^10.2.0 to ^10.2.3 (#7642, #7856, #8078)
  • Bump @metamask/controller-utils from ^11.17.0 to ^11.19.0 (#7583, #7995)

Added

  • Add PermissionController:getCaveat action (#7303)

Changed

  • Upgrade @metamask/utils from ^11.8.1 to ^11.9.0 (#7511)
  • Move peer dependencies for controller and service packages to direct dependencies (#7209)
    • The dependencies moved are:
      • @metamask/approval-controller (^8.0.0)
    • In clients, it is now possible for multiple versions of these packages to exist in the dependency tree.
      • For example, this scenario would be valid: a client relies on @metamask/controller-a 1.0.0 and @metamask/controller-b 1.0.0, and @metamask/controller-b depends on @metamask/controller-a 1.1.0.
    • Note, however, that the versions specified in the client's package.json always "win", and you are expected to keep them up to date so as not to break controller and service intercommunication.
  • Bump @metamask/controller-utils from ^11.16.0 to ^11.17.0 (#7534)

Changed

  • Bump @metamask/json-rpc-engine from ^10.1.1 to ^10.2.0 (#7202)
  • Bump @metamask/controller-utils from ^11.15.0 to ^11.16.0 (#7202)

Added

  • Add name property to permission errors (#6987)

Changed

  • BREAKING: Use new Messenger from @metamask/messenger (#6537)
    • Previously, PermissionController and SubjectMetadataController accepted a RestrictedMessenger instance from @metamask/base-controller.
  • BREAKING: Metadata property anonymous renamed to includeInDebugSnapshot (#6537)
  • BREAKING: Bump @metamask/approval-controller from ^7.0.0 to ^8.0.0 (#6962)
  • Bump @metamask/base-controller from ^8.4.2 to ^9.0.0 (#6962)

Changed

  • Bump @metamask/base-controller from ^8.4.1 to ^8.4.2 (#6917)

Added

  • Add two new controller state metadata properties: includeInStateLogs and usedInUi (#6525)

Changed

Changed

  • Bump @metamask/base-controller from ^7.1.1 to ^8.0.0 (#5305)
  • Bump @metamask/controller-utils from ^11.4.5 to ^11.5.0 (#5272)
  • Bump @metamask/json-rpc-engine from ^10.0.2 to ^10.0.3 (#5272)
  • Bump @metamask/utils from ^11.0.1 to ^11.1.0 (#5223)

Changed

  • Remove redundant caveat validator calls (#5062)
    • In some cases, caveats were being validated multiple times or without the possibility of being changed.
    • The intended purpose of permission and caveat validators has also been documented. See ARCHITECTURE.md.
  • Bump nanoid from ^3.1.31 to ^3.3.8 (#5073)
  • Bump @metamask/utils from ^10.0.0 to ^11.0.1 (#5080)
  • Bump @metamask/rpc-errors from ^7.0.0 to ^7.0.2 (#5080)
  • Bump @metamask/base-controller from ^7.0.0 to ^7.1.1, (#5079, #5135)

Changed

  • Bump @metamask/controller-utils from ^11.4.1 to ^11.4.4, #4915, #5012) (#4870)

Fixed

  • Correct ESM-compatible build so that imports of the following packages that re-export other modules via export * are no longer corrupted: (#5011)
    • deep-freeze-strict

Changed

  • Bump @metamask/utils from ^9.1.0 to ^10.0.0 (#4831)

Fixed

  • Produce and export ESM-compatible TypeScript type declaration files in addition to CommonJS-compatible declaration files (#4648)
    • Previously, this package shipped with only one variant of type declaration files, and these files were only CommonJS-compatible, and the exports field in package.json linked to these files. This is an anti-pattern and was rightfully flagged by the "Are the Types Wrong?" tool as "masquerading as CJS". All of the ATTW checks now pass.
  • Remove chunk files (#4648)
    • Previously, the build tool we used to generate JavaScript files extracted common code to "chunk" files. While this was intended to make this package more tree-shakeable, it also made debugging more difficult for our development teams. These chunk files are no longer present.

Changed

  • Bump @metamask/base-controller from ^6.0.3 to ^7.0.0 (#4643)
  • Bump @metamask/controller-utils from ^11.0.2 to ^11.2.0 (#4639, #4651)
  • Bump typescript from ~5.0.4 to ~5.2.2 (#4576, #4584)

Changed

  • BREAKING: Rename enum property names to match PascalCase instead of camelCase (#4521)
    • The affected enums are: CaveatMutatorOperations, MethodNames.
  • Bump TypeScript version to ~5.0.4 and set moduleResolution option to Node16 (#3645)
  • Bump @metamask/base-controller from ^6.0.1 to ^6.0.2 (#4544)
  • Bump @metamask/controller-utils from ^11.0.1 to ^11.0.2 (#4544)
  • Bump @metamask/json-rpc-engine from ^9.0.1 to ^9.0.2 (#4544)
  • Bump @metamask/utils from ^9.0.0 to ^9.1.0 (#4529)

Changed

  • Bump @metamask/rpc-errors from 6.2.1 to ^6.3.1 (#4516)
  • Bump @metamask/utils from ^8.3.0 to ^9.0.0 (#4516)
  • Bump @metamask/base-controller to ^9.0.1 (#4517)
  • Bump @metamask/controller-utils to ^11.0.1 (#4517)
  • Bump @metamask/json-rpc-engine to ^9.0.1 (#4517)

Changed

  • BREAKING: Bump minimum Node version to 18.18 (#3611)
  • BREAKING: Bump peer dependency @metamask/approval-controller to ^7.0.0 (#4352)
  • Bump @metamask/base-controller to ^6.0.0 (#4352)
  • Bump @metamask/controller-utils to ^11.0.0 (#4352)
  • Bump @metamask/json-rpc-engine to ^9.0.0 (#4352)

Changed

  • Bump @metamask/controller-utils to ^10.0.0 (#4342)

Added

  • Add requestPermissionsIncremental() and caveat merger functions (#4222)
  • Enable passing additional metadata during permission requests (#4179)
  • Make permission request validation errors more informative (#4172)

Fixed

  • Fix SideEffectMessenger type not respecting generic parameter types (#4059)

Fixed

  • Fix types field in package.json (#4047)

Added

  • BREAKING: Add ESM build (#3998)
    • It's no longer possible to import files from ./dist directly.

Changed

  • BREAKING: Bump peer dependency on @metamask/approval-controller to ^6.0.0 (#4039)
  • BREAKING: Bump @metamask/base-controller to ^5.0.0 (#4039)
    • This version has a number of breaking changes. See the changelog for more.
  • Bump @metamask/controller-utils to ^9.0.0 (#4039)
  • Bump @metamask/json-rpc-engine to ^8.0.0 (#4039)

Fixed

  • BREAKING: Fix SideEffectMessenger so that it's defined with a RestrictedControllerMessenger that has access to PermissionController allowed actions (#4031)
    • The messenger's Action generic parameter is widened to include the PermissionController actions allowlist.
    • The messenger's AllowedAction generic parameter is narrowed from string to the PermissionController actions allowlist.

Fixed

  • Bump @metamask/rpc-errors to ^6.2.1 (#3954, #3970)

Changed

  • BREAKING: Bump @metamask/approval-controller peer dependency to ^5.1.2 (#3821)
  • Bump @metamask/utils to ^8.3.0 (#3769)
  • Bump @metamask/base-controller to ^4.1.1 (#3760, #3821)
  • Bump @metamask/controller-utils to ^8.0.2 (#3821)
  • Bump @metamask/json-rpc-engine to ^7.3.2 (#3821)

Added

  • Add SubjectMetadataController:addSubjectMetadata action (#3733)

Changed

  • BREAKING: Bump @metamask/approval-controller peer dependency from ^5.0.0 to ^5.1.1 (#3680, #3695)
  • Bump @metamask/base-controller to ^4.0.1 (#3695)
  • Bump @metamask/controller-utils to ^8.0.1 (#3695, #3678, #3667, #3580)
  • Bump @metamask/json-rpc-engine to ^7.3.1 (#3695)

Fixed

  • Remove @metamask/approval-controller dependency (#3607)

Added

  • Add new handler to permissionRpcMethods.handlers for wallet_revokePermissions RPC method (#1889)

Changed

  • BREAKING: Bump @metamask/base-controller to ^4.0.0 (#2063)
    • This is breaking because the type of the messenger has backward-incompatible changes. See the changelog for this package for more.
  • BREAKING: Update PermittedRpcMethodHooks type so it must support signature for wallet_revokePermission hook (#1889)
  • Bump @metamask/approval-controller to ^5.0.0 (#2063)
  • Bump @metamask/controller-utils to ^6.0.0 (#2063)

Changed

  • Bump @metamask/json-rpc-engine from ^7.1.0 to ^7.2.0 (#1895)
  • Bump dependency on @metamask/rpc-errors to ^6.1.0 (#1653)
  • Bump dependency and peer dependency on @metamask/approval-controller to ^4.0.1
  • Bump @metamask/utils from 8.1.0 to 8.2.0 (#1957)
  • Bump @metamask/auto-changelog from ^3.2.0 to ^3.4.3 (#1870, #1905, #1997)

Changed

  • BREAKING: Remove undefined from RestrictedMethodParameters type union and from type parameter for RestrictedMethodOptions (#1749)
  • BREAKING: Update from json-rpc-engine@^6.1.0 to @metamask/json-rpc-engine@^7.1.1 (#1749)
  • Update from eth-rpc-errors@^4.0.2 to @metamask/rpc-errors@^6.0.0 (#1749)
  • Bump dependency on @metamask/utils to ^8.1.0 (#1639)
  • Bump dependency and peer dependency on @metamask/approval-controller to ^4.0.0
  • Bump dependency on @metamask/base-controller to ^3.2.3
  • Bump dependency on @metamask/controller-utils to ^5.0.2

Changed

  • Update TypeScript to v4.8.x (#1718)
  • Bump dependency on @metamask/controller-utils to ^5.0.0

Changed

  • Bump dependency and peer dependency on @metamask/approval-controller to ^3.5.1
  • Bump dependency on @metamask/base-controller to ^3.2.1
  • Bump dependency on @metamask/controller-utils to ^4.3.2

Changed

  • Update @metamask/utils to ^6.2.0 (#1514)

Fixed

  • Fix permissions RPC method types (#1464)
    • The RPC method handlers were mistakenly typed as an array rather than a tuple

Changed

  • BREAKING: Bump to Node 16 (#1262)
  • BREAKING: Update @metamask/approval-controller dependency and peer dependency
  • The export permissionRpcMethods has a slightly different type; the second generic type variable of the getPermissions handler is now undefined rather than void (#1372)
  • Add @metamask/utils dependency (#1275)
  • Remove @metamask/types dependency (#1372)
  • Change type of constructor parameter unrestrictedMethods to be readonly (#1395)

Removed

  • BREAKING: Remove namespaced permissions (#1337)
    • Namespaced permissions are no longer supported. Consumers should replace namespaced permissions with equivalent caveat-based implementations.
  • BREAKING: Remove targetKey concept (#1337)
    • The target key/name distinction only existed to support namespaced permissions, which are removed as of this release. Henceforth, permissions only have "names".
    • The targetKey property of permission specifications has been renamed to targetName.

Added

  • Allow restricting permissions by subject type (#1233)

Changed

  • Move SubjectMetadataController to permission-controller package (#1234)
  • Update minimum eth-rpc-errors version from 4.0.0 to 4.0.2 (#1215)

Added

  • Add side-effects to permissions (#1069)

Removed

  • BREAKING: Remove isomorphic-fetch (#1106)
    • Consumers must now import isomorphic-fetch or another polyfill themselves if they are running in an environment without fetch

Added

  • Add updateCaveat action (#1071)

Changed

  • BREAKING: Update @metamask/network-controller peer dependency to v3 (#1041)
  • Rename this repository to core (#1031)
  • Update @metamask/controller-utils package (#1041)

Fixed

  • This package will now warn if a required package is not present (#1003)

Changed

  • Relax dependencies on @metamask/approval-controller, @metamask/base-controller and @metamask/controller-utils (use ^ instead of ~) (#998)

Added

  • Initial release
    • As a result of converting our shared controllers repo into a monorepo (#831), we've created this package from select parts of @metamask/controllers v33.0.0, namely:

      • Everything in src/permissions

      All changes listed after this point were applied to this package following the monorepo conversion.