@metamask-previews/keyring-controller 22.1.1-preview-7b6467c → 23.0.0-preview-541d905c
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 +28 -1
- package/dist/KeyringController.cjs +2 -228
- package/dist/KeyringController.cjs.map +1 -1
- package/dist/KeyringController.d.cts +1 -114
- package/dist/KeyringController.d.cts.map +1 -1
- package/dist/KeyringController.d.mts +1 -114
- package/dist/KeyringController.d.mts.map +1 -1
- package/dist/KeyringController.mjs +2 -228
- package/dist/KeyringController.mjs.map +1 -1
- package/package.json +2 -4
package/CHANGELOG.md
CHANGED
|
@@ -9,11 +9,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
### Changed
|
|
11
11
|
|
|
12
|
+
- Bump `@metamask/base-controller` from `^8.1.0` to `^8.2.0` ([#6355](https://github.com/MetaMask/core/pull/6355))
|
|
13
|
+
|
|
14
|
+
## [23.0.0]
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
12
18
|
- Bump `@metamask/base-controller` from `^8.0.1` to `^8.1.0` ([#6284](https://github.com/MetaMask/core/pull/6284))
|
|
13
19
|
- Bump accounts related packages ([#6309](https://github.com/MetaMask/core/pull/6309))
|
|
14
20
|
- Bump `@metamask/keyring-api` from `^20.0.0` to `^20.1.0`
|
|
15
21
|
- Bump `@metamask/keyring-internal-api` from `^8.0.0` to `^8.1.0`
|
|
16
22
|
|
|
23
|
+
### Removed
|
|
24
|
+
|
|
25
|
+
- **BREAKING:** Removed QR keyring methods ([#6031](https://github.com/MetaMask/core/pull/6031))
|
|
26
|
+
- The following methods have been removed:
|
|
27
|
+
- `cancelQRSignRequest`
|
|
28
|
+
- `cancelQRSynchronization`
|
|
29
|
+
- `connectQRHardware`
|
|
30
|
+
- `forgetQRDevice`
|
|
31
|
+
- `getOrAddQRKeyring`
|
|
32
|
+
- `getQRKeyring`
|
|
33
|
+
- `getQRKeyringState`
|
|
34
|
+
- `resetQRKeyringState`
|
|
35
|
+
- `restoreQRKeyring`
|
|
36
|
+
- `submitQRCryptoHDKey`
|
|
37
|
+
- `submitQRCryptoAccount`
|
|
38
|
+
- `submitQRSignature`
|
|
39
|
+
- `unlockQRHardwareWalletAccount`
|
|
40
|
+
- Consumers can use the `withKeyring` method to select a QR keyring and execute a callback with it as argument.
|
|
41
|
+
- **BREAKING:** Removed `KeyringController:qrKeyringStateChange` event ([#6031](https://github.com/MetaMask/core/pull/6031))
|
|
42
|
+
|
|
17
43
|
## [22.1.1]
|
|
18
44
|
|
|
19
45
|
### Changed
|
|
@@ -821,7 +847,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
821
847
|
|
|
822
848
|
All changes listed after this point were applied to this package following the monorepo conversion.
|
|
823
849
|
|
|
824
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/keyring-controller@
|
|
850
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/keyring-controller@23.0.0...HEAD
|
|
851
|
+
[23.0.0]: https://github.com/MetaMask/core/compare/@metamask/keyring-controller@22.1.1...@metamask/keyring-controller@23.0.0
|
|
825
852
|
[22.1.1]: https://github.com/MetaMask/core/compare/@metamask/keyring-controller@22.1.0...@metamask/keyring-controller@22.1.1
|
|
826
853
|
[22.1.0]: https://github.com/MetaMask/core/compare/@metamask/keyring-controller@22.0.2...@metamask/keyring-controller@22.1.0
|
|
827
854
|
[22.0.2]: https://github.com/MetaMask/core/compare/@metamask/keyring-controller@22.0.1...@metamask/keyring-controller@22.0.2
|
|
@@ -36,7 +36,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
36
36
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
38
|
};
|
|
39
|
-
var _KeyringController_instances, _KeyringController_controllerOperationMutex, _KeyringController_vaultOperationMutex, _KeyringController_keyringBuilders, _KeyringController_encryptor, _KeyringController_cacheEncryptionKey, _KeyringController_keyrings, _KeyringController_unsupportedKeyrings, _KeyringController_password,
|
|
39
|
+
var _KeyringController_instances, _KeyringController_controllerOperationMutex, _KeyringController_vaultOperationMutex, _KeyringController_keyringBuilders, _KeyringController_encryptor, _KeyringController_cacheEncryptionKey, _KeyringController_keyrings, _KeyringController_unsupportedKeyrings, _KeyringController_password, _KeyringController_registerMessageHandlers, _KeyringController_getKeyringById, _KeyringController_getKeyringByIdOrDefault, _KeyringController_getKeyringMetadata, _KeyringController_getKeyringBuilderForType, _KeyringController_createNewVaultWithKeyring, _KeyringController_verifySeedPhrase, _KeyringController_getUpdatedKeyrings, _KeyringController_getSerializedKeyrings, _KeyringController_getSessionState, _KeyringController_restoreSerializedKeyrings, _KeyringController_unlockKeyrings, _KeyringController_updateVault, _KeyringController_isNewEncryptionAvailable, _KeyringController_getAccountsFromKeyrings, _KeyringController_createKeyringWithFirstAccount, _KeyringController_newKeyring, _KeyringController_createKeyring, _KeyringController_clearKeyrings, _KeyringController_restoreKeyring, _KeyringController_destroyKeyring, _KeyringController_removeEmptyKeyrings, _KeyringController_assertNoDuplicateAccounts, _KeyringController_setUnlocked, _KeyringController_assertIsUnlocked, _KeyringController_persistOrRollback, _KeyringController_withRollback, _KeyringController_assertControllerMutexIsLocked, _KeyringController_withControllerLock, _KeyringController_withVaultLock;
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
41
|
exports.KeyringController = exports.getDefaultKeyringState = exports.keyringBuilderFactory = exports.SignTypedDataVersion = exports.AccountImportStrategy = exports.isCustodyKeyring = exports.KeyringTypes = void 0;
|
|
42
42
|
const util_1 = require("@ethereumjs/util");
|
|
@@ -285,7 +285,6 @@ class KeyringController extends base_controller_1.BaseController {
|
|
|
285
285
|
_KeyringController_keyrings.set(this, void 0);
|
|
286
286
|
_KeyringController_unsupportedKeyrings.set(this, void 0);
|
|
287
287
|
_KeyringController_password.set(this, void 0);
|
|
288
|
-
_KeyringController_qrKeyringStateListener.set(this, void 0);
|
|
289
288
|
__classPrivateFieldSet(this, _KeyringController_keyringBuilders, keyringBuilders
|
|
290
289
|
? keyringBuilders.concat(defaultKeyringBuilders)
|
|
291
290
|
: defaultKeyringBuilders, "f");
|
|
@@ -410,9 +409,6 @@ class KeyringController extends base_controller_1.BaseController {
|
|
|
410
409
|
*/
|
|
411
410
|
async addNewKeyring(type, opts) {
|
|
412
411
|
__classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertIsUnlocked).call(this);
|
|
413
|
-
if (type === KeyringTypes.qr) {
|
|
414
|
-
return __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getKeyringMetadata).call(this, await this.getOrAddQRKeyring());
|
|
415
|
-
}
|
|
416
412
|
return __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getKeyringMetadata).call(this, await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_persistOrRollback).call(this, async () => __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_newKeyring).call(this, type, opts)));
|
|
417
413
|
}
|
|
418
414
|
/**
|
|
@@ -671,7 +667,6 @@ class KeyringController extends base_controller_1.BaseController {
|
|
|
671
667
|
async setLocked() {
|
|
672
668
|
__classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertIsUnlocked).call(this);
|
|
673
669
|
return __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_withRollback).call(this, async () => {
|
|
674
|
-
__classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_unsubscribeFromQRKeyringsEvents).call(this);
|
|
675
670
|
__classPrivateFieldSet(this, _KeyringController_password, undefined, "f");
|
|
676
671
|
await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_clearKeyrings).call(this);
|
|
677
672
|
this.update((state) => {
|
|
@@ -989,206 +984,14 @@ class KeyringController extends base_controller_1.BaseController {
|
|
|
989
984
|
return result;
|
|
990
985
|
});
|
|
991
986
|
}
|
|
992
|
-
// QR Hardware related methods
|
|
993
|
-
/**
|
|
994
|
-
* Get QR Hardware keyring.
|
|
995
|
-
*
|
|
996
|
-
* @returns The QR Keyring if defined, otherwise undefined
|
|
997
|
-
* @deprecated Use `withKeyring` instead.
|
|
998
|
-
*/
|
|
999
|
-
getQRKeyring() {
|
|
1000
|
-
__classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertIsUnlocked).call(this);
|
|
1001
|
-
// QRKeyring is not yet compatible with Keyring type from @metamask/utils
|
|
1002
|
-
return this.getKeyringsByType(KeyringTypes.qr)[0];
|
|
1003
|
-
}
|
|
1004
|
-
/**
|
|
1005
|
-
* Get QR hardware keyring. If it doesn't exist, add it.
|
|
1006
|
-
*
|
|
1007
|
-
* @returns The added keyring
|
|
1008
|
-
* @deprecated Use `addNewKeyring` and `withKeyring` instead.
|
|
1009
|
-
*/
|
|
1010
|
-
async getOrAddQRKeyring() {
|
|
1011
|
-
__classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertIsUnlocked).call(this);
|
|
1012
|
-
return (this.getQRKeyring() ||
|
|
1013
|
-
(await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_persistOrRollback).call(this, async () => __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_addQRKeyring).call(this))));
|
|
1014
|
-
}
|
|
1015
|
-
/**
|
|
1016
|
-
* Restore QR keyring from serialized data.
|
|
1017
|
-
*
|
|
1018
|
-
* @param serialized - Serialized data to restore the keyring from.
|
|
1019
|
-
* @returns Promise resolving when the operation completes.
|
|
1020
|
-
* @deprecated Use `withKeyring` instead.
|
|
1021
|
-
*/
|
|
1022
|
-
// TODO: Replace `any` with type
|
|
1023
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1024
|
-
async restoreQRKeyring(serialized) {
|
|
1025
|
-
__classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertIsUnlocked).call(this);
|
|
1026
|
-
return __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_persistOrRollback).call(this, async () => {
|
|
1027
|
-
const keyring = this.getQRKeyring() || (await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_addQRKeyring).call(this));
|
|
1028
|
-
keyring.deserialize(serialized);
|
|
1029
|
-
});
|
|
1030
|
-
}
|
|
1031
|
-
/**
|
|
1032
|
-
* Reset QR keyring state.
|
|
1033
|
-
*
|
|
1034
|
-
* @returns Promise resolving when the operation completes.
|
|
1035
|
-
* @deprecated Use `withKeyring` instead.
|
|
1036
|
-
*/
|
|
1037
|
-
async resetQRKeyringState() {
|
|
1038
|
-
__classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertIsUnlocked).call(this);
|
|
1039
|
-
(await this.getOrAddQRKeyring()).resetStore();
|
|
1040
|
-
}
|
|
1041
|
-
/**
|
|
1042
|
-
* Get QR keyring state.
|
|
1043
|
-
*
|
|
1044
|
-
* @returns Promise resolving to the keyring state.
|
|
1045
|
-
* @deprecated Use `withKeyring` or subscribe to `"KeyringController:qrKeyringStateChange"`
|
|
1046
|
-
* instead.
|
|
1047
|
-
*/
|
|
1048
|
-
async getQRKeyringState() {
|
|
1049
|
-
__classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertIsUnlocked).call(this);
|
|
1050
|
-
return (await this.getOrAddQRKeyring()).getMemStore();
|
|
1051
|
-
}
|
|
1052
|
-
/**
|
|
1053
|
-
* Submit QR hardware wallet public HDKey.
|
|
1054
|
-
*
|
|
1055
|
-
* @param cryptoHDKey - The key to submit.
|
|
1056
|
-
* @returns Promise resolving when the operation completes.
|
|
1057
|
-
* @deprecated Use `withKeyring` instead.
|
|
1058
|
-
*/
|
|
1059
|
-
async submitQRCryptoHDKey(cryptoHDKey) {
|
|
1060
|
-
__classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertIsUnlocked).call(this);
|
|
1061
|
-
(await this.getOrAddQRKeyring()).submitCryptoHDKey(cryptoHDKey);
|
|
1062
|
-
}
|
|
1063
|
-
/**
|
|
1064
|
-
* Submit QR hardware wallet account.
|
|
1065
|
-
*
|
|
1066
|
-
* @param cryptoAccount - The account to submit.
|
|
1067
|
-
* @returns Promise resolving when the operation completes.
|
|
1068
|
-
* @deprecated Use `withKeyring` instead.
|
|
1069
|
-
*/
|
|
1070
|
-
async submitQRCryptoAccount(cryptoAccount) {
|
|
1071
|
-
__classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertIsUnlocked).call(this);
|
|
1072
|
-
(await this.getOrAddQRKeyring()).submitCryptoAccount(cryptoAccount);
|
|
1073
|
-
}
|
|
1074
|
-
/**
|
|
1075
|
-
* Submit QR hardware wallet signature.
|
|
1076
|
-
*
|
|
1077
|
-
* @param requestId - The request ID.
|
|
1078
|
-
* @param ethSignature - The signature to submit.
|
|
1079
|
-
* @returns Promise resolving when the operation completes.
|
|
1080
|
-
* @deprecated Use `withKeyring` instead.
|
|
1081
|
-
*/
|
|
1082
|
-
async submitQRSignature(requestId, ethSignature) {
|
|
1083
|
-
__classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertIsUnlocked).call(this);
|
|
1084
|
-
(await this.getOrAddQRKeyring()).submitSignature(requestId, ethSignature);
|
|
1085
|
-
}
|
|
1086
|
-
/**
|
|
1087
|
-
* Cancel QR sign request.
|
|
1088
|
-
*
|
|
1089
|
-
* @returns Promise resolving when the operation completes.
|
|
1090
|
-
* @deprecated Use `withKeyring` instead.
|
|
1091
|
-
*/
|
|
1092
|
-
async cancelQRSignRequest() {
|
|
1093
|
-
__classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertIsUnlocked).call(this);
|
|
1094
|
-
(await this.getOrAddQRKeyring()).cancelSignRequest();
|
|
1095
|
-
}
|
|
1096
|
-
/**
|
|
1097
|
-
* Cancels qr keyring sync.
|
|
1098
|
-
*
|
|
1099
|
-
* @returns Promise resolving when the operation completes.
|
|
1100
|
-
* @deprecated Use `withKeyring` instead.
|
|
1101
|
-
*/
|
|
1102
|
-
async cancelQRSynchronization() {
|
|
1103
|
-
__classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertIsUnlocked).call(this);
|
|
1104
|
-
(await this.getOrAddQRKeyring()).cancelSync();
|
|
1105
|
-
}
|
|
1106
|
-
/**
|
|
1107
|
-
* Connect to QR hardware wallet.
|
|
1108
|
-
*
|
|
1109
|
-
* @param page - The page to connect to.
|
|
1110
|
-
* @returns Promise resolving to the connected accounts.
|
|
1111
|
-
* @deprecated Use of this method is discouraged as it creates a dangling promise
|
|
1112
|
-
* internal to the `QRKeyring`, which can lead to unpredictable deadlocks. Please use
|
|
1113
|
-
* `withKeyring` instead.
|
|
1114
|
-
*/
|
|
1115
|
-
async connectQRHardware(page) {
|
|
1116
|
-
__classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertIsUnlocked).call(this);
|
|
1117
|
-
return __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_persistOrRollback).call(this, async () => {
|
|
1118
|
-
try {
|
|
1119
|
-
const keyring = this.getQRKeyring() || (await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_addQRKeyring).call(this));
|
|
1120
|
-
let accounts;
|
|
1121
|
-
switch (page) {
|
|
1122
|
-
case -1:
|
|
1123
|
-
accounts = await keyring.getPreviousPage();
|
|
1124
|
-
break;
|
|
1125
|
-
case 1:
|
|
1126
|
-
accounts = await keyring.getNextPage();
|
|
1127
|
-
break;
|
|
1128
|
-
default:
|
|
1129
|
-
accounts = await keyring.getFirstPage();
|
|
1130
|
-
}
|
|
1131
|
-
// TODO: Replace `any` with type
|
|
1132
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1133
|
-
return accounts.map((account) => {
|
|
1134
|
-
return {
|
|
1135
|
-
...account,
|
|
1136
|
-
balance: '0x0',
|
|
1137
|
-
};
|
|
1138
|
-
});
|
|
1139
|
-
}
|
|
1140
|
-
catch (e) {
|
|
1141
|
-
// TODO: Add test case for when keyring throws
|
|
1142
|
-
/* istanbul ignore next */
|
|
1143
|
-
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
|
|
1144
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
1145
|
-
throw new Error(`Unspecified error when connect QR Hardware, ${e}`);
|
|
1146
|
-
}
|
|
1147
|
-
});
|
|
1148
|
-
}
|
|
1149
|
-
/**
|
|
1150
|
-
* Unlock a QR hardware wallet account.
|
|
1151
|
-
*
|
|
1152
|
-
* @param index - The index of the account to unlock.
|
|
1153
|
-
* @returns Promise resolving when the operation completes.
|
|
1154
|
-
* @deprecated Use `withKeyring` instead.
|
|
1155
|
-
*/
|
|
1156
|
-
async unlockQRHardwareWalletAccount(index) {
|
|
1157
|
-
__classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertIsUnlocked).call(this);
|
|
1158
|
-
return __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_persistOrRollback).call(this, async () => {
|
|
1159
|
-
const keyring = this.getQRKeyring() || (await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_addQRKeyring).call(this));
|
|
1160
|
-
keyring.setAccountToUnlock(index);
|
|
1161
|
-
await keyring.addAccounts(1);
|
|
1162
|
-
});
|
|
1163
|
-
}
|
|
1164
987
|
async getAccountKeyringType(account) {
|
|
1165
988
|
__classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertIsUnlocked).call(this);
|
|
1166
989
|
const keyring = (await this.getKeyringForAccount(account));
|
|
1167
990
|
return keyring.type;
|
|
1168
991
|
}
|
|
1169
|
-
/**
|
|
1170
|
-
* Forget the QR hardware wallet.
|
|
1171
|
-
*
|
|
1172
|
-
* @returns Promise resolving to the removed accounts and the remaining accounts.
|
|
1173
|
-
* @deprecated Use `withKeyring` instead.
|
|
1174
|
-
*/
|
|
1175
|
-
async forgetQRDevice() {
|
|
1176
|
-
__classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertIsUnlocked).call(this);
|
|
1177
|
-
return __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_persistOrRollback).call(this, async () => {
|
|
1178
|
-
const keyring = this.getQRKeyring();
|
|
1179
|
-
if (!keyring) {
|
|
1180
|
-
return { removedAccounts: [], remainingAccounts: [] };
|
|
1181
|
-
}
|
|
1182
|
-
const allAccounts = (await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getAccountsFromKeyrings).call(this));
|
|
1183
|
-
keyring.forgetDevice();
|
|
1184
|
-
const remainingAccounts = (await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_getAccountsFromKeyrings).call(this));
|
|
1185
|
-
const removedAccounts = allAccounts.filter((address) => !remainingAccounts.includes(address));
|
|
1186
|
-
return { removedAccounts, remainingAccounts };
|
|
1187
|
-
});
|
|
1188
|
-
}
|
|
1189
992
|
}
|
|
1190
993
|
exports.KeyringController = KeyringController;
|
|
1191
|
-
_KeyringController_controllerOperationMutex = new WeakMap(), _KeyringController_vaultOperationMutex = new WeakMap(), _KeyringController_keyringBuilders = new WeakMap(), _KeyringController_encryptor = new WeakMap(), _KeyringController_cacheEncryptionKey = new WeakMap(), _KeyringController_keyrings = new WeakMap(), _KeyringController_unsupportedKeyrings = new WeakMap(), _KeyringController_password = new WeakMap(),
|
|
994
|
+
_KeyringController_controllerOperationMutex = new WeakMap(), _KeyringController_vaultOperationMutex = new WeakMap(), _KeyringController_keyringBuilders = new WeakMap(), _KeyringController_encryptor = new WeakMap(), _KeyringController_cacheEncryptionKey = new WeakMap(), _KeyringController_keyrings = new WeakMap(), _KeyringController_unsupportedKeyrings = new WeakMap(), _KeyringController_password = new WeakMap(), _KeyringController_instances = new WeakSet(), _KeyringController_registerMessageHandlers = function _KeyringController_registerMessageHandlers() {
|
|
1192
995
|
this.messagingSystem.registerActionHandler(`${name}:signMessage`, this.signMessage.bind(this));
|
|
1193
996
|
this.messagingSystem.registerActionHandler(`${name}:signEip7702Authorization`, this.signEip7702Authorization.bind(this));
|
|
1194
997
|
this.messagingSystem.registerActionHandler(`${name}:signPersonalMessage`, this.signPersonalMessage.bind(this));
|
|
@@ -1220,30 +1023,6 @@ _KeyringController_controllerOperationMutex = new WeakMap(), _KeyringController_
|
|
|
1220
1023
|
return keyringWithMetadata.metadata;
|
|
1221
1024
|
}, _KeyringController_getKeyringBuilderForType = function _KeyringController_getKeyringBuilderForType(type) {
|
|
1222
1025
|
return __classPrivateFieldGet(this, _KeyringController_keyringBuilders, "f").find((keyringBuilder) => keyringBuilder.type === type);
|
|
1223
|
-
}, _KeyringController_addQRKeyring =
|
|
1224
|
-
/**
|
|
1225
|
-
* Add qr hardware keyring.
|
|
1226
|
-
*
|
|
1227
|
-
* @returns The added keyring
|
|
1228
|
-
* @throws If a QRKeyring builder is not provided
|
|
1229
|
-
* when initializing the controller
|
|
1230
|
-
*/
|
|
1231
|
-
async function _KeyringController_addQRKeyring() {
|
|
1232
|
-
__classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_assertControllerMutexIsLocked).call(this);
|
|
1233
|
-
// QRKeyring is not yet compatible with Keyring type from @metamask/utils
|
|
1234
|
-
return (await __classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_newKeyring).call(this, KeyringTypes.qr));
|
|
1235
|
-
}, _KeyringController_subscribeToQRKeyringEvents = function _KeyringController_subscribeToQRKeyringEvents(qrKeyring) {
|
|
1236
|
-
__classPrivateFieldSet(this, _KeyringController_qrKeyringStateListener, (state) => {
|
|
1237
|
-
this.messagingSystem.publish(`${name}:qrKeyringStateChange`, state);
|
|
1238
|
-
}, "f");
|
|
1239
|
-
qrKeyring.getMemStore().subscribe(__classPrivateFieldGet(this, _KeyringController_qrKeyringStateListener, "f"));
|
|
1240
|
-
}, _KeyringController_unsubscribeFromQRKeyringsEvents = function _KeyringController_unsubscribeFromQRKeyringsEvents() {
|
|
1241
|
-
const qrKeyrings = this.getKeyringsByType(KeyringTypes.qr);
|
|
1242
|
-
qrKeyrings.forEach((qrKeyring) => {
|
|
1243
|
-
if (__classPrivateFieldGet(this, _KeyringController_qrKeyringStateListener, "f")) {
|
|
1244
|
-
qrKeyring.getMemStore().unsubscribe(__classPrivateFieldGet(this, _KeyringController_qrKeyringStateListener, "f"));
|
|
1245
|
-
}
|
|
1246
|
-
});
|
|
1247
1026
|
}, _KeyringController_createNewVaultWithKeyring =
|
|
1248
1027
|
/**
|
|
1249
1028
|
* Create new vault with an initial keyring
|
|
@@ -1603,11 +1382,6 @@ async function _KeyringController_createKeyring(type, data) {
|
|
|
1603
1382
|
await keyring.generateRandomMnemonic();
|
|
1604
1383
|
await keyring.addAccounts(1);
|
|
1605
1384
|
}
|
|
1606
|
-
if (type === KeyringTypes.qr) {
|
|
1607
|
-
// In case of a QR keyring type, we need to subscribe
|
|
1608
|
-
// to its events after creating it
|
|
1609
|
-
__classPrivateFieldGet(this, _KeyringController_instances, "m", _KeyringController_subscribeToQRKeyringEvents).call(this, keyring);
|
|
1610
|
-
}
|
|
1611
1385
|
return keyring;
|
|
1612
1386
|
}, _KeyringController_clearKeyrings =
|
|
1613
1387
|
/**
|