Skip to content

Commit c249e17

Browse files
committed
feat: Add messenger delegate and revoke methods
The methods `delegate` and `revoke` have been added to the Messenger class. These methods replace the need for the `RestrictedMessenger`. The `getRestricted` method, and the `RestrictedMessenger` class, have been removed as obsolete. See this ADR PR for details: MetaMask/decisions#53
1 parent b0904fa commit c249e17

File tree

7 files changed

+1252
-2007
lines changed

7 files changed

+1252
-2007
lines changed

packages/messenger/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111

1212
- Migrate `Messenger` class from `@metamask/base-controller` package ([#6127](https://github.com/MetaMask/core/pull/6127))
13+
- Add `delegate` and `revoke` methods ([#6132](https://github.com/MetaMask/core/pull/6132))
14+
- These allow delegating or revoking capabilities (actions or events) from one `Messenger` instance to another.
15+
- This allows passing capabilities through chains of messengers of arbitrary length
16+
- See this ADR for details: https://github.com/MetaMask/decisions/blob/main/decisions/core/0012-messenger-delegation.md
17+
18+
### Changed
19+
20+
- **BREAKING:** Add `Namespace` type parameter and required `namespace` constructor parameter ([#6132](https://github.com/MetaMask/core/pull/6132))
21+
- All published events and registered actions should fall under the given namespace. Typically the namespace is the controller or service name. This is the equivalent to the `Namespace` parameter from the old `RestrictedMessenger` class.
22+
- **BREAKING:** Remove `RestrictedMessenger` class ([#6132](https://github.com/MetaMask/core/pull/6132))
23+
- Existing `RestrictedMessenger` instances should be replaced with a `Messenger`. We can now use the same class everywhere, passing capabilities using `delegate`.
24+
- See this ADR for details: https://github.com/MetaMask/decisions/blob/main/decisions/core/0012-messenger-delegation.md
1325

1426
[Unreleased]: https://github.com/MetaMask/core/

0 commit comments

Comments
 (0)