@metamask-previews/keyring-controller 25.0.0-preview-9462ebb8 → 25.0.0-preview-cb897e9
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 +3 -0
- package/dist/KeyringController.cjs +61 -58
- package/dist/KeyringController.cjs.map +1 -1
- package/dist/KeyringController.d.cts.map +1 -1
- package/dist/KeyringController.d.mts.map +1 -1
- package/dist/KeyringController.mjs +62 -59
- package/dist/KeyringController.mjs.map +1 -1
- package/dist/constants.cjs +43 -43
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.cts.map +1 -1
- package/dist/constants.d.mts +1 -1
- package/dist/constants.d.mts.map +1 -1
- package/dist/constants.mjs +42 -42
- package/dist/constants.mjs.map +1 -1
- package/dist/errors.cjs +83 -0
- package/dist/errors.cjs.map +1 -0
- package/dist/errors.d.cts +70 -0
- package/dist/errors.d.cts.map +1 -0
- package/dist/errors.d.mts +70 -0
- package/dist/errors.d.mts.map +1 -0
- package/dist/errors.mjs +79 -0
- package/dist/errors.mjs.map +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/constants.cjs
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
var
|
|
5
|
-
(function (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
})(
|
|
3
|
+
exports.KeyringControllerErrorMessage = void 0;
|
|
4
|
+
var KeyringControllerErrorMessage;
|
|
5
|
+
(function (KeyringControllerErrorMessage) {
|
|
6
|
+
KeyringControllerErrorMessage["NoKeyring"] = "KeyringController - No keyring found";
|
|
7
|
+
KeyringControllerErrorMessage["KeyringNotFound"] = "KeyringController - Keyring not found.";
|
|
8
|
+
KeyringControllerErrorMessage["UnsafeDirectKeyringAccess"] = "KeyringController - Returning keyring instances is unsafe";
|
|
9
|
+
KeyringControllerErrorMessage["WrongPasswordType"] = "KeyringController - Password must be of type string.";
|
|
10
|
+
KeyringControllerErrorMessage["WrongEncryptionKeyType"] = "KeyringController - Encryption key must be of type string.";
|
|
11
|
+
KeyringControllerErrorMessage["InvalidEmptyPassword"] = "KeyringController - Password cannot be empty.";
|
|
12
|
+
KeyringControllerErrorMessage["NoFirstAccount"] = "KeyringController - First Account not found.";
|
|
13
|
+
KeyringControllerErrorMessage["DuplicatedAccount"] = "KeyringController - The account you are trying to import is a duplicate";
|
|
14
|
+
KeyringControllerErrorMessage["VaultError"] = "KeyringController - Cannot unlock without a previous vault.";
|
|
15
|
+
KeyringControllerErrorMessage["VaultDataError"] = "KeyringController - The decrypted vault has an unexpected shape.";
|
|
16
|
+
KeyringControllerErrorMessage["UnsupportedEncryptionKeyExport"] = "KeyringController - The encryptor does not support encryption key export.";
|
|
17
|
+
KeyringControllerErrorMessage["UnsupportedGenerateRandomMnemonic"] = "KeyringController - The current keyring does not support the method generateRandomMnemonic.";
|
|
18
|
+
KeyringControllerErrorMessage["UnsupportedExportAccount"] = "`KeyringController - The keyring for the current address does not support the method exportAccount";
|
|
19
|
+
KeyringControllerErrorMessage["UnsupportedRemoveAccount"] = "`KeyringController - The keyring for the current address does not support the method removeAccount";
|
|
20
|
+
KeyringControllerErrorMessage["UnsupportedSignTransaction"] = "KeyringController - The keyring for the current address does not support the method signTransaction.";
|
|
21
|
+
KeyringControllerErrorMessage["UnsupportedSignMessage"] = "KeyringController - The keyring for the current address does not support the method signMessage.";
|
|
22
|
+
KeyringControllerErrorMessage["UnsupportedSignPersonalMessage"] = "KeyringController - The keyring for the current address does not support the method signPersonalMessage.";
|
|
23
|
+
KeyringControllerErrorMessage["UnsupportedSignEip7702Authorization"] = "KeyringController - The keyring for the current address does not support the method signEip7702Authorization.";
|
|
24
|
+
KeyringControllerErrorMessage["UnsupportedGetEncryptionPublicKey"] = "KeyringController - The keyring for the current address does not support the method getEncryptionPublicKey.";
|
|
25
|
+
KeyringControllerErrorMessage["UnsupportedDecryptMessage"] = "KeyringController - The keyring for the current address does not support the method decryptMessage.";
|
|
26
|
+
KeyringControllerErrorMessage["UnsupportedSignTypedMessage"] = "KeyringController - The keyring for the current address does not support the method signTypedMessage.";
|
|
27
|
+
KeyringControllerErrorMessage["UnsupportedGetAppKeyAddress"] = "KeyringController - The keyring for the current address does not support the method getAppKeyAddress.";
|
|
28
|
+
KeyringControllerErrorMessage["UnsupportedExportAppKeyForAddress"] = "KeyringController - The keyring for the current address does not support the method exportAppKeyForAddress.";
|
|
29
|
+
KeyringControllerErrorMessage["UnsupportedPrepareUserOperation"] = "KeyringController - The keyring for the current address does not support the method prepareUserOperation.";
|
|
30
|
+
KeyringControllerErrorMessage["UnsupportedPatchUserOperation"] = "KeyringController - The keyring for the current address does not support the method patchUserOperation.";
|
|
31
|
+
KeyringControllerErrorMessage["UnsupportedSignUserOperation"] = "KeyringController - The keyring for the current address does not support the method signUserOperation.";
|
|
32
|
+
KeyringControllerErrorMessage["UnsupportedVerifySeedPhrase"] = "KeyringController - The keyring does not support the method verifySeedPhrase.";
|
|
33
|
+
KeyringControllerErrorMessage["MissingEip7702AuthorizationContractAddress"] = "KeyringController - The EIP-7702 Authorization is invalid. No contract address provided.";
|
|
34
|
+
KeyringControllerErrorMessage["NoAccountOnKeychain"] = "KeyringController - The keychain doesn't have accounts.";
|
|
35
|
+
KeyringControllerErrorMessage["ControllerLocked"] = "KeyringController - The operation cannot be completed while the controller is locked.";
|
|
36
|
+
KeyringControllerErrorMessage["MissingCredentials"] = "KeyringController - Cannot persist vault without password and encryption key";
|
|
37
|
+
KeyringControllerErrorMessage["MissingVaultData"] = "KeyringController - Cannot persist vault without vault information";
|
|
38
|
+
KeyringControllerErrorMessage["ExpiredCredentials"] = "KeyringController - Encryption key and salt provided are expired";
|
|
39
|
+
KeyringControllerErrorMessage["NoKeyringBuilder"] = "KeyringController - No keyringBuilder found for keyring";
|
|
40
|
+
KeyringControllerErrorMessage["DataType"] = "KeyringController - Incorrect data type provided";
|
|
41
|
+
KeyringControllerErrorMessage["NoHdKeyring"] = "KeyringController - No HD Keyring found";
|
|
42
|
+
KeyringControllerErrorMessage["ControllerLockRequired"] = "KeyringController - attempt to update vault during a non mutually exclusive operation";
|
|
43
|
+
KeyringControllerErrorMessage["LastAccountInPrimaryKeyring"] = "KeyringController - Last account in primary keyring cannot be removed";
|
|
44
|
+
KeyringControllerErrorMessage["EncryptionKeyNotSet"] = "KeyringController - Encryption key not set";
|
|
45
|
+
})(KeyringControllerErrorMessage || (exports.KeyringControllerErrorMessage = KeyringControllerErrorMessage = {}));
|
|
46
46
|
//# sourceMappingURL=constants.cjs.map
|
package/dist/constants.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.cjs","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAA,IAAY,
|
|
1
|
+
{"version":3,"file":"constants.cjs","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAA,IAAY,6BAwCX;AAxCD,WAAY,6BAA6B;IACvC,mFAAkD,CAAA;IAClD,2FAA0D,CAAA;IAC1D,wHAAuF,CAAA;IACvF,2GAA0E,CAAA;IAC1E,sHAAqF,CAAA;IACrF,uGAAsE,CAAA;IACtE,gGAA+D,CAAA;IAC/D,8HAA6F,CAAA;IAC7F,2GAA0E,CAAA;IAC1E,oHAAmF,CAAA;IACnF,6IAA4G,CAAA;IAC5G,kKAAiI,CAAA;IACjI,gKAA+H,CAAA;IAC/H,gKAA+H,CAAA;IAC/H,oKAAmI,CAAA;IACnI,4JAA2H,CAAA;IAC3H,4KAA2I,CAAA;IAC3I,sLAAqJ,CAAA;IACrJ,kLAAiJ,CAAA;IACjJ,kKAAiI,CAAA;IACjI,sKAAqI,CAAA;IACrI,sKAAqI,CAAA;IACrI,kLAAiJ,CAAA;IACjJ,8KAA6I,CAAA;IAC7I,0KAAyI,CAAA;IACzI,wKAAuI,CAAA;IACvI,8IAA6G,CAAA;IAC7G,wKAAuI,CAAA;IACvI,gHAA+E,CAAA;IAC/E,2IAA0G,CAAA;IAC1G,oIAAmG,CAAA;IACnG,wHAAuF,CAAA;IACvF,wHAAuF,CAAA;IACvF,6GAA4E,CAAA;IAC5E,8FAA6D,CAAA;IAC7D,wFAAuD,CAAA;IACvD,iJAAgH,CAAA;IAChH,sIAAqG,CAAA;IACrG,mGAAkE,CAAA;AACpE,CAAC,EAxCW,6BAA6B,6CAA7B,6BAA6B,QAwCxC","sourcesContent":["export enum KeyringControllerErrorMessage {\n NoKeyring = 'KeyringController - No keyring found',\n KeyringNotFound = 'KeyringController - Keyring not found.',\n UnsafeDirectKeyringAccess = 'KeyringController - Returning keyring instances is unsafe',\n WrongPasswordType = 'KeyringController - Password must be of type string.',\n WrongEncryptionKeyType = 'KeyringController - Encryption key must be of type string.',\n InvalidEmptyPassword = 'KeyringController - Password cannot be empty.',\n NoFirstAccount = 'KeyringController - First Account not found.',\n DuplicatedAccount = 'KeyringController - The account you are trying to import is a duplicate',\n VaultError = 'KeyringController - Cannot unlock without a previous vault.',\n VaultDataError = 'KeyringController - The decrypted vault has an unexpected shape.',\n UnsupportedEncryptionKeyExport = 'KeyringController - The encryptor does not support encryption key export.',\n UnsupportedGenerateRandomMnemonic = 'KeyringController - The current keyring does not support the method generateRandomMnemonic.',\n UnsupportedExportAccount = '`KeyringController - The keyring for the current address does not support the method exportAccount',\n UnsupportedRemoveAccount = '`KeyringController - The keyring for the current address does not support the method removeAccount',\n UnsupportedSignTransaction = 'KeyringController - The keyring for the current address does not support the method signTransaction.',\n UnsupportedSignMessage = 'KeyringController - The keyring for the current address does not support the method signMessage.',\n UnsupportedSignPersonalMessage = 'KeyringController - The keyring for the current address does not support the method signPersonalMessage.',\n UnsupportedSignEip7702Authorization = 'KeyringController - The keyring for the current address does not support the method signEip7702Authorization.',\n UnsupportedGetEncryptionPublicKey = 'KeyringController - The keyring for the current address does not support the method getEncryptionPublicKey.',\n UnsupportedDecryptMessage = 'KeyringController - The keyring for the current address does not support the method decryptMessage.',\n UnsupportedSignTypedMessage = 'KeyringController - The keyring for the current address does not support the method signTypedMessage.',\n UnsupportedGetAppKeyAddress = 'KeyringController - The keyring for the current address does not support the method getAppKeyAddress.',\n UnsupportedExportAppKeyForAddress = 'KeyringController - The keyring for the current address does not support the method exportAppKeyForAddress.',\n UnsupportedPrepareUserOperation = 'KeyringController - The keyring for the current address does not support the method prepareUserOperation.',\n UnsupportedPatchUserOperation = 'KeyringController - The keyring for the current address does not support the method patchUserOperation.',\n UnsupportedSignUserOperation = 'KeyringController - The keyring for the current address does not support the method signUserOperation.',\n UnsupportedVerifySeedPhrase = 'KeyringController - The keyring does not support the method verifySeedPhrase.',\n MissingEip7702AuthorizationContractAddress = 'KeyringController - The EIP-7702 Authorization is invalid. No contract address provided.',\n NoAccountOnKeychain = \"KeyringController - The keychain doesn't have accounts.\",\n ControllerLocked = 'KeyringController - The operation cannot be completed while the controller is locked.',\n MissingCredentials = 'KeyringController - Cannot persist vault without password and encryption key',\n MissingVaultData = 'KeyringController - Cannot persist vault without vault information',\n ExpiredCredentials = 'KeyringController - Encryption key and salt provided are expired',\n NoKeyringBuilder = 'KeyringController - No keyringBuilder found for keyring',\n DataType = 'KeyringController - Incorrect data type provided',\n NoHdKeyring = 'KeyringController - No HD Keyring found',\n ControllerLockRequired = 'KeyringController - attempt to update vault during a non mutually exclusive operation',\n LastAccountInPrimaryKeyring = 'KeyringController - Last account in primary keyring cannot be removed',\n EncryptionKeyNotSet = 'KeyringController - Encryption key not set',\n}\n"]}
|
package/dist/constants.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare enum
|
|
1
|
+
export declare enum KeyringControllerErrorMessage {
|
|
2
2
|
NoKeyring = "KeyringController - No keyring found",
|
|
3
3
|
KeyringNotFound = "KeyringController - Keyring not found.",
|
|
4
4
|
UnsafeDirectKeyringAccess = "KeyringController - Returning keyring instances is unsafe",
|
package/dist/constants.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.cts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,oBAAY,
|
|
1
|
+
{"version":3,"file":"constants.d.cts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,oBAAY,6BAA6B;IACvC,SAAS,yCAAyC;IAClD,eAAe,2CAA2C;IAC1D,yBAAyB,8DAA8D;IACvF,iBAAiB,yDAAyD;IAC1E,sBAAsB,+DAA+D;IACrF,oBAAoB,kDAAkD;IACtE,cAAc,iDAAiD;IAC/D,iBAAiB,4EAA4E;IAC7F,UAAU,gEAAgE;IAC1E,cAAc,qEAAqE;IACnF,8BAA8B,8EAA8E;IAC5G,iCAAiC,gGAAgG;IACjI,wBAAwB,uGAAuG;IAC/H,wBAAwB,uGAAuG;IAC/H,0BAA0B,yGAAyG;IACnI,sBAAsB,qGAAqG;IAC3H,8BAA8B,6GAA6G;IAC3I,mCAAmC,kHAAkH;IACrJ,iCAAiC,gHAAgH;IACjJ,yBAAyB,wGAAwG;IACjI,2BAA2B,0GAA0G;IACrI,2BAA2B,0GAA0G;IACrI,iCAAiC,gHAAgH;IACjJ,+BAA+B,8GAA8G;IAC7I,6BAA6B,4GAA4G;IACzI,4BAA4B,2GAA2G;IACvI,2BAA2B,kFAAkF;IAC7G,0CAA0C,6FAA6F;IACvI,mBAAmB,4DAA4D;IAC/E,gBAAgB,0FAA0F;IAC1G,kBAAkB,iFAAiF;IACnG,gBAAgB,uEAAuE;IACvF,kBAAkB,qEAAqE;IACvF,gBAAgB,4DAA4D;IAC5E,QAAQ,qDAAqD;IAC7D,WAAW,4CAA4C;IACvD,sBAAsB,0FAA0F;IAChH,2BAA2B,0EAA0E;IACrG,mBAAmB,+CAA+C;CACnE"}
|
package/dist/constants.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare enum
|
|
1
|
+
export declare enum KeyringControllerErrorMessage {
|
|
2
2
|
NoKeyring = "KeyringController - No keyring found",
|
|
3
3
|
KeyringNotFound = "KeyringController - Keyring not found.",
|
|
4
4
|
UnsafeDirectKeyringAccess = "KeyringController - Returning keyring instances is unsafe",
|
package/dist/constants.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.mts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,oBAAY,
|
|
1
|
+
{"version":3,"file":"constants.d.mts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,oBAAY,6BAA6B;IACvC,SAAS,yCAAyC;IAClD,eAAe,2CAA2C;IAC1D,yBAAyB,8DAA8D;IACvF,iBAAiB,yDAAyD;IAC1E,sBAAsB,+DAA+D;IACrF,oBAAoB,kDAAkD;IACtE,cAAc,iDAAiD;IAC/D,iBAAiB,4EAA4E;IAC7F,UAAU,gEAAgE;IAC1E,cAAc,qEAAqE;IACnF,8BAA8B,8EAA8E;IAC5G,iCAAiC,gGAAgG;IACjI,wBAAwB,uGAAuG;IAC/H,wBAAwB,uGAAuG;IAC/H,0BAA0B,yGAAyG;IACnI,sBAAsB,qGAAqG;IAC3H,8BAA8B,6GAA6G;IAC3I,mCAAmC,kHAAkH;IACrJ,iCAAiC,gHAAgH;IACjJ,yBAAyB,wGAAwG;IACjI,2BAA2B,0GAA0G;IACrI,2BAA2B,0GAA0G;IACrI,iCAAiC,gHAAgH;IACjJ,+BAA+B,8GAA8G;IAC7I,6BAA6B,4GAA4G;IACzI,4BAA4B,2GAA2G;IACvI,2BAA2B,kFAAkF;IAC7G,0CAA0C,6FAA6F;IACvI,mBAAmB,4DAA4D;IAC/E,gBAAgB,0FAA0F;IAC1G,kBAAkB,iFAAiF;IACnG,gBAAgB,uEAAuE;IACvF,kBAAkB,qEAAqE;IACvF,gBAAgB,4DAA4D;IAC5E,QAAQ,qDAAqD;IAC7D,WAAW,4CAA4C;IACvD,sBAAsB,0FAA0F;IAChH,2BAA2B,0EAA0E;IACrG,mBAAmB,+CAA+C;CACnE"}
|
package/dist/constants.mjs
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
export var
|
|
2
|
-
(function (
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
})(
|
|
1
|
+
export var KeyringControllerErrorMessage;
|
|
2
|
+
(function (KeyringControllerErrorMessage) {
|
|
3
|
+
KeyringControllerErrorMessage["NoKeyring"] = "KeyringController - No keyring found";
|
|
4
|
+
KeyringControllerErrorMessage["KeyringNotFound"] = "KeyringController - Keyring not found.";
|
|
5
|
+
KeyringControllerErrorMessage["UnsafeDirectKeyringAccess"] = "KeyringController - Returning keyring instances is unsafe";
|
|
6
|
+
KeyringControllerErrorMessage["WrongPasswordType"] = "KeyringController - Password must be of type string.";
|
|
7
|
+
KeyringControllerErrorMessage["WrongEncryptionKeyType"] = "KeyringController - Encryption key must be of type string.";
|
|
8
|
+
KeyringControllerErrorMessage["InvalidEmptyPassword"] = "KeyringController - Password cannot be empty.";
|
|
9
|
+
KeyringControllerErrorMessage["NoFirstAccount"] = "KeyringController - First Account not found.";
|
|
10
|
+
KeyringControllerErrorMessage["DuplicatedAccount"] = "KeyringController - The account you are trying to import is a duplicate";
|
|
11
|
+
KeyringControllerErrorMessage["VaultError"] = "KeyringController - Cannot unlock without a previous vault.";
|
|
12
|
+
KeyringControllerErrorMessage["VaultDataError"] = "KeyringController - The decrypted vault has an unexpected shape.";
|
|
13
|
+
KeyringControllerErrorMessage["UnsupportedEncryptionKeyExport"] = "KeyringController - The encryptor does not support encryption key export.";
|
|
14
|
+
KeyringControllerErrorMessage["UnsupportedGenerateRandomMnemonic"] = "KeyringController - The current keyring does not support the method generateRandomMnemonic.";
|
|
15
|
+
KeyringControllerErrorMessage["UnsupportedExportAccount"] = "`KeyringController - The keyring for the current address does not support the method exportAccount";
|
|
16
|
+
KeyringControllerErrorMessage["UnsupportedRemoveAccount"] = "`KeyringController - The keyring for the current address does not support the method removeAccount";
|
|
17
|
+
KeyringControllerErrorMessage["UnsupportedSignTransaction"] = "KeyringController - The keyring for the current address does not support the method signTransaction.";
|
|
18
|
+
KeyringControllerErrorMessage["UnsupportedSignMessage"] = "KeyringController - The keyring for the current address does not support the method signMessage.";
|
|
19
|
+
KeyringControllerErrorMessage["UnsupportedSignPersonalMessage"] = "KeyringController - The keyring for the current address does not support the method signPersonalMessage.";
|
|
20
|
+
KeyringControllerErrorMessage["UnsupportedSignEip7702Authorization"] = "KeyringController - The keyring for the current address does not support the method signEip7702Authorization.";
|
|
21
|
+
KeyringControllerErrorMessage["UnsupportedGetEncryptionPublicKey"] = "KeyringController - The keyring for the current address does not support the method getEncryptionPublicKey.";
|
|
22
|
+
KeyringControllerErrorMessage["UnsupportedDecryptMessage"] = "KeyringController - The keyring for the current address does not support the method decryptMessage.";
|
|
23
|
+
KeyringControllerErrorMessage["UnsupportedSignTypedMessage"] = "KeyringController - The keyring for the current address does not support the method signTypedMessage.";
|
|
24
|
+
KeyringControllerErrorMessage["UnsupportedGetAppKeyAddress"] = "KeyringController - The keyring for the current address does not support the method getAppKeyAddress.";
|
|
25
|
+
KeyringControllerErrorMessage["UnsupportedExportAppKeyForAddress"] = "KeyringController - The keyring for the current address does not support the method exportAppKeyForAddress.";
|
|
26
|
+
KeyringControllerErrorMessage["UnsupportedPrepareUserOperation"] = "KeyringController - The keyring for the current address does not support the method prepareUserOperation.";
|
|
27
|
+
KeyringControllerErrorMessage["UnsupportedPatchUserOperation"] = "KeyringController - The keyring for the current address does not support the method patchUserOperation.";
|
|
28
|
+
KeyringControllerErrorMessage["UnsupportedSignUserOperation"] = "KeyringController - The keyring for the current address does not support the method signUserOperation.";
|
|
29
|
+
KeyringControllerErrorMessage["UnsupportedVerifySeedPhrase"] = "KeyringController - The keyring does not support the method verifySeedPhrase.";
|
|
30
|
+
KeyringControllerErrorMessage["MissingEip7702AuthorizationContractAddress"] = "KeyringController - The EIP-7702 Authorization is invalid. No contract address provided.";
|
|
31
|
+
KeyringControllerErrorMessage["NoAccountOnKeychain"] = "KeyringController - The keychain doesn't have accounts.";
|
|
32
|
+
KeyringControllerErrorMessage["ControllerLocked"] = "KeyringController - The operation cannot be completed while the controller is locked.";
|
|
33
|
+
KeyringControllerErrorMessage["MissingCredentials"] = "KeyringController - Cannot persist vault without password and encryption key";
|
|
34
|
+
KeyringControllerErrorMessage["MissingVaultData"] = "KeyringController - Cannot persist vault without vault information";
|
|
35
|
+
KeyringControllerErrorMessage["ExpiredCredentials"] = "KeyringController - Encryption key and salt provided are expired";
|
|
36
|
+
KeyringControllerErrorMessage["NoKeyringBuilder"] = "KeyringController - No keyringBuilder found for keyring";
|
|
37
|
+
KeyringControllerErrorMessage["DataType"] = "KeyringController - Incorrect data type provided";
|
|
38
|
+
KeyringControllerErrorMessage["NoHdKeyring"] = "KeyringController - No HD Keyring found";
|
|
39
|
+
KeyringControllerErrorMessage["ControllerLockRequired"] = "KeyringController - attempt to update vault during a non mutually exclusive operation";
|
|
40
|
+
KeyringControllerErrorMessage["LastAccountInPrimaryKeyring"] = "KeyringController - Last account in primary keyring cannot be removed";
|
|
41
|
+
KeyringControllerErrorMessage["EncryptionKeyNotSet"] = "KeyringController - Encryption key not set";
|
|
42
|
+
})(KeyringControllerErrorMessage || (KeyringControllerErrorMessage = {}));
|
|
43
43
|
//# sourceMappingURL=constants.mjs.map
|
package/dist/constants.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,6BAwCX;AAxCD,WAAY,6BAA6B;IACvC,mFAAkD,CAAA;IAClD,2FAA0D,CAAA;IAC1D,wHAAuF,CAAA;IACvF,2GAA0E,CAAA;IAC1E,sHAAqF,CAAA;IACrF,uGAAsE,CAAA;IACtE,gGAA+D,CAAA;IAC/D,8HAA6F,CAAA;IAC7F,2GAA0E,CAAA;IAC1E,oHAAmF,CAAA;IACnF,6IAA4G,CAAA;IAC5G,kKAAiI,CAAA;IACjI,gKAA+H,CAAA;IAC/H,gKAA+H,CAAA;IAC/H,oKAAmI,CAAA;IACnI,4JAA2H,CAAA;IAC3H,4KAA2I,CAAA;IAC3I,sLAAqJ,CAAA;IACrJ,kLAAiJ,CAAA;IACjJ,kKAAiI,CAAA;IACjI,sKAAqI,CAAA;IACrI,sKAAqI,CAAA;IACrI,kLAAiJ,CAAA;IACjJ,8KAA6I,CAAA;IAC7I,0KAAyI,CAAA;IACzI,wKAAuI,CAAA;IACvI,8IAA6G,CAAA;IAC7G,wKAAuI,CAAA;IACvI,gHAA+E,CAAA;IAC/E,2IAA0G,CAAA;IAC1G,oIAAmG,CAAA;IACnG,wHAAuF,CAAA;IACvF,wHAAuF,CAAA;IACvF,6GAA4E,CAAA;IAC5E,8FAA6D,CAAA;IAC7D,wFAAuD,CAAA;IACvD,iJAAgH,CAAA;IAChH,sIAAqG,CAAA;IACrG,mGAAkE,CAAA;AACpE,CAAC,EAxCW,6BAA6B,KAA7B,6BAA6B,QAwCxC","sourcesContent":["export enum KeyringControllerErrorMessage {\n NoKeyring = 'KeyringController - No keyring found',\n KeyringNotFound = 'KeyringController - Keyring not found.',\n UnsafeDirectKeyringAccess = 'KeyringController - Returning keyring instances is unsafe',\n WrongPasswordType = 'KeyringController - Password must be of type string.',\n WrongEncryptionKeyType = 'KeyringController - Encryption key must be of type string.',\n InvalidEmptyPassword = 'KeyringController - Password cannot be empty.',\n NoFirstAccount = 'KeyringController - First Account not found.',\n DuplicatedAccount = 'KeyringController - The account you are trying to import is a duplicate',\n VaultError = 'KeyringController - Cannot unlock without a previous vault.',\n VaultDataError = 'KeyringController - The decrypted vault has an unexpected shape.',\n UnsupportedEncryptionKeyExport = 'KeyringController - The encryptor does not support encryption key export.',\n UnsupportedGenerateRandomMnemonic = 'KeyringController - The current keyring does not support the method generateRandomMnemonic.',\n UnsupportedExportAccount = '`KeyringController - The keyring for the current address does not support the method exportAccount',\n UnsupportedRemoveAccount = '`KeyringController - The keyring for the current address does not support the method removeAccount',\n UnsupportedSignTransaction = 'KeyringController - The keyring for the current address does not support the method signTransaction.',\n UnsupportedSignMessage = 'KeyringController - The keyring for the current address does not support the method signMessage.',\n UnsupportedSignPersonalMessage = 'KeyringController - The keyring for the current address does not support the method signPersonalMessage.',\n UnsupportedSignEip7702Authorization = 'KeyringController - The keyring for the current address does not support the method signEip7702Authorization.',\n UnsupportedGetEncryptionPublicKey = 'KeyringController - The keyring for the current address does not support the method getEncryptionPublicKey.',\n UnsupportedDecryptMessage = 'KeyringController - The keyring for the current address does not support the method decryptMessage.',\n UnsupportedSignTypedMessage = 'KeyringController - The keyring for the current address does not support the method signTypedMessage.',\n UnsupportedGetAppKeyAddress = 'KeyringController - The keyring for the current address does not support the method getAppKeyAddress.',\n UnsupportedExportAppKeyForAddress = 'KeyringController - The keyring for the current address does not support the method exportAppKeyForAddress.',\n UnsupportedPrepareUserOperation = 'KeyringController - The keyring for the current address does not support the method prepareUserOperation.',\n UnsupportedPatchUserOperation = 'KeyringController - The keyring for the current address does not support the method patchUserOperation.',\n UnsupportedSignUserOperation = 'KeyringController - The keyring for the current address does not support the method signUserOperation.',\n UnsupportedVerifySeedPhrase = 'KeyringController - The keyring does not support the method verifySeedPhrase.',\n MissingEip7702AuthorizationContractAddress = 'KeyringController - The EIP-7702 Authorization is invalid. No contract address provided.',\n NoAccountOnKeychain = \"KeyringController - The keychain doesn't have accounts.\",\n ControllerLocked = 'KeyringController - The operation cannot be completed while the controller is locked.',\n MissingCredentials = 'KeyringController - Cannot persist vault without password and encryption key',\n MissingVaultData = 'KeyringController - Cannot persist vault without vault information',\n ExpiredCredentials = 'KeyringController - Encryption key and salt provided are expired',\n NoKeyringBuilder = 'KeyringController - No keyringBuilder found for keyring',\n DataType = 'KeyringController - Incorrect data type provided',\n NoHdKeyring = 'KeyringController - No HD Keyring found',\n ControllerLockRequired = 'KeyringController - attempt to update vault during a non mutually exclusive operation',\n LastAccountInPrimaryKeyring = 'KeyringController - Last account in primary keyring cannot be removed',\n EncryptionKeyNotSet = 'KeyringController - Encryption key not set',\n}\n"]}
|
package/dist/errors.cjs
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KeyringControllerError = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Error class for KeyringController-related errors.
|
|
6
|
+
*
|
|
7
|
+
* This error class extends the standard Error class and supports:
|
|
8
|
+
* - Error chaining via the `cause` property (ES2022 standard)
|
|
9
|
+
* - Optional error codes for programmatic error handling
|
|
10
|
+
* - Additional context data for debugging
|
|
11
|
+
* - Backward compatibility with the legacy `originalError` property
|
|
12
|
+
*/
|
|
13
|
+
class KeyringControllerError extends Error {
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new KeyringControllerError.
|
|
16
|
+
*
|
|
17
|
+
* @param message - The error message.
|
|
18
|
+
* @param options - Error options or an Error object for backward compatibility.
|
|
19
|
+
*/
|
|
20
|
+
constructor(message, options) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.name = 'KeyringControllerError';
|
|
23
|
+
// Support both new signature (options object) and legacy signature (Error as second param)
|
|
24
|
+
const cause = options instanceof Error ? options : options?.cause;
|
|
25
|
+
const code = options instanceof Error ? undefined : options?.code;
|
|
26
|
+
const context = options instanceof Error ? undefined : options?.context;
|
|
27
|
+
// Set cause property for error chaining (ES2022 standard)
|
|
28
|
+
if (cause) {
|
|
29
|
+
this.cause = cause;
|
|
30
|
+
// Maintain backward compatibility with originalError
|
|
31
|
+
this.originalError = cause;
|
|
32
|
+
}
|
|
33
|
+
// Set code and data if provided
|
|
34
|
+
if (code) {
|
|
35
|
+
this.code = code;
|
|
36
|
+
}
|
|
37
|
+
if (context) {
|
|
38
|
+
this.context = context;
|
|
39
|
+
}
|
|
40
|
+
// Ensure proper prototype chain for instanceof checks
|
|
41
|
+
Object.setPrototypeOf(this, KeyringControllerError.prototype);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Returns a JSON representation of the error.
|
|
45
|
+
* Useful for logging and error reporting.
|
|
46
|
+
*
|
|
47
|
+
* @returns JSON representation of the error.
|
|
48
|
+
*/
|
|
49
|
+
toJSON() {
|
|
50
|
+
return {
|
|
51
|
+
name: this.name,
|
|
52
|
+
message: this.message,
|
|
53
|
+
code: this.code,
|
|
54
|
+
context: this.context,
|
|
55
|
+
stack: this.stack,
|
|
56
|
+
cause: this.cause
|
|
57
|
+
? {
|
|
58
|
+
name: this.cause.name,
|
|
59
|
+
message: this.cause.message,
|
|
60
|
+
stack: this.cause.stack,
|
|
61
|
+
}
|
|
62
|
+
: undefined,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Returns a string representation of the error chain.
|
|
67
|
+
* Includes all chained errors for better debugging.
|
|
68
|
+
*
|
|
69
|
+
* @returns String representation of the error chain.
|
|
70
|
+
*/
|
|
71
|
+
toString() {
|
|
72
|
+
let result = `${this.name}: ${this.message}`;
|
|
73
|
+
if (this.code) {
|
|
74
|
+
result += ` [${this.code}]`;
|
|
75
|
+
}
|
|
76
|
+
if (this.cause) {
|
|
77
|
+
result += `\n Caused by: ${this.cause}`;
|
|
78
|
+
}
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.KeyringControllerError = KeyringControllerError;
|
|
83
|
+
//# sourceMappingURL=errors.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.cjs","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;AAqBA;;;;;;;;GAQG;AACH,MAAa,sBAAuB,SAAQ,KAAK;IAsB/C;;;;;OAKG;IACH,YACE,OAAe,EACf,OAA+C;QAE/C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;QAErC,2FAA2F;QAC3F,MAAM,KAAK,GAAG,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC;QAClE,MAAM,IAAI,GAAG,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC;QAClE,MAAM,OAAO,GAAG,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC;QAExE,0DAA0D;QAC1D,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;YACnB,qDAAqD;YACrD,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;QAC7B,CAAC;QAED,gCAAgC;QAChC,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACnB,CAAC;QACD,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACzB,CAAC;QAED,sDAAsD;QACtD,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAChE,CAAC;IAED;;;;;OAKG;IACH,MAAM;QACJ,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,KAAK,EAAE,IAAI,CAAC,KAAK;gBACf,CAAC,CAAC;oBACE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI;oBACrB,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO;oBAC3B,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK;iBACxB;gBACH,CAAC,CAAC,SAAS;SACd,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,QAAQ;QACN,IAAI,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;QAE7C,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,IAAI,CAAC,IAAI,GAAG,CAAC;QAC9B,CAAC;QAED,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,kBAAkB,IAAI,CAAC,KAAK,EAAE,CAAC;QAC3C,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AArGD,wDAqGC","sourcesContent":["/**\n * Options for creating a KeyringControllerError.\n */\nexport type KeyringControllerErrorOptions = {\n /**\n * The underlying error that caused this error (for error chaining).\n * Uses the standard Error.cause property (ES2022).\n */\n cause?: Error;\n /**\n * Optional error code for programmatic error handling.\n * This can be used to identify specific error types without string matching.\n */\n code?: string;\n /**\n * Additional context data associated with the error.\n * Useful for debugging and error reporting.\n */\n context?: Record<string, unknown>;\n};\n\n/**\n * Error class for KeyringController-related errors.\n *\n * This error class extends the standard Error class and supports:\n * - Error chaining via the `cause` property (ES2022 standard)\n * - Optional error codes for programmatic error handling\n * - Additional context data for debugging\n * - Backward compatibility with the legacy `originalError` property\n */\nexport class KeyringControllerError extends Error {\n /**\n * Optional error code for programmatic error handling.\n */\n code?: string;\n\n /**\n * Additional context data associated with the error.\n */\n context?: Record<string, unknown>;\n\n /**\n * The underlying error that caused this error (ES2022 standard).\n * This is set manually for compatibility with older TypeScript versions.\n */\n cause?: Error;\n\n /**\n * @deprecated Use `cause` instead. This property is maintained for backward compatibility.\n */\n originalError?: Error;\n\n /**\n * Creates a new KeyringControllerError.\n *\n * @param message - The error message.\n * @param options - Error options or an Error object for backward compatibility.\n */\n constructor(\n message: string,\n options?: KeyringControllerErrorOptions | Error,\n ) {\n super(message);\n this.name = 'KeyringControllerError';\n\n // Support both new signature (options object) and legacy signature (Error as second param)\n const cause = options instanceof Error ? options : options?.cause;\n const code = options instanceof Error ? undefined : options?.code;\n const context = options instanceof Error ? undefined : options?.context;\n\n // Set cause property for error chaining (ES2022 standard)\n if (cause) {\n this.cause = cause;\n // Maintain backward compatibility with originalError\n this.originalError = cause;\n }\n\n // Set code and data if provided\n if (code) {\n this.code = code;\n }\n if (context) {\n this.context = context;\n }\n\n // Ensure proper prototype chain for instanceof checks\n Object.setPrototypeOf(this, KeyringControllerError.prototype);\n }\n\n /**\n * Returns a JSON representation of the error.\n * Useful for logging and error reporting.\n *\n * @returns JSON representation of the error.\n */\n toJSON(): Record<string, unknown> {\n return {\n name: this.name,\n message: this.message,\n code: this.code,\n context: this.context,\n stack: this.stack,\n cause: this.cause\n ? {\n name: this.cause.name,\n message: this.cause.message,\n stack: this.cause.stack,\n }\n : undefined,\n };\n }\n\n /**\n * Returns a string representation of the error chain.\n * Includes all chained errors for better debugging.\n *\n * @returns String representation of the error chain.\n */\n toString(): string {\n let result = `${this.name}: ${this.message}`;\n\n if (this.code) {\n result += ` [${this.code}]`;\n }\n\n if (this.cause) {\n result += `\\n Caused by: ${this.cause}`;\n }\n\n return result;\n }\n}\n"]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for creating a KeyringControllerError.
|
|
3
|
+
*/
|
|
4
|
+
export type KeyringControllerErrorOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* The underlying error that caused this error (for error chaining).
|
|
7
|
+
* Uses the standard Error.cause property (ES2022).
|
|
8
|
+
*/
|
|
9
|
+
cause?: Error;
|
|
10
|
+
/**
|
|
11
|
+
* Optional error code for programmatic error handling.
|
|
12
|
+
* This can be used to identify specific error types without string matching.
|
|
13
|
+
*/
|
|
14
|
+
code?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Additional context data associated with the error.
|
|
17
|
+
* Useful for debugging and error reporting.
|
|
18
|
+
*/
|
|
19
|
+
context?: Record<string, unknown>;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Error class for KeyringController-related errors.
|
|
23
|
+
*
|
|
24
|
+
* This error class extends the standard Error class and supports:
|
|
25
|
+
* - Error chaining via the `cause` property (ES2022 standard)
|
|
26
|
+
* - Optional error codes for programmatic error handling
|
|
27
|
+
* - Additional context data for debugging
|
|
28
|
+
* - Backward compatibility with the legacy `originalError` property
|
|
29
|
+
*/
|
|
30
|
+
export declare class KeyringControllerError extends Error {
|
|
31
|
+
/**
|
|
32
|
+
* Optional error code for programmatic error handling.
|
|
33
|
+
*/
|
|
34
|
+
code?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Additional context data associated with the error.
|
|
37
|
+
*/
|
|
38
|
+
context?: Record<string, unknown>;
|
|
39
|
+
/**
|
|
40
|
+
* The underlying error that caused this error (ES2022 standard).
|
|
41
|
+
* This is set manually for compatibility with older TypeScript versions.
|
|
42
|
+
*/
|
|
43
|
+
cause?: Error;
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated Use `cause` instead. This property is maintained for backward compatibility.
|
|
46
|
+
*/
|
|
47
|
+
originalError?: Error;
|
|
48
|
+
/**
|
|
49
|
+
* Creates a new KeyringControllerError.
|
|
50
|
+
*
|
|
51
|
+
* @param message - The error message.
|
|
52
|
+
* @param options - Error options or an Error object for backward compatibility.
|
|
53
|
+
*/
|
|
54
|
+
constructor(message: string, options?: KeyringControllerErrorOptions | Error);
|
|
55
|
+
/**
|
|
56
|
+
* Returns a JSON representation of the error.
|
|
57
|
+
* Useful for logging and error reporting.
|
|
58
|
+
*
|
|
59
|
+
* @returns JSON representation of the error.
|
|
60
|
+
*/
|
|
61
|
+
toJSON(): Record<string, unknown>;
|
|
62
|
+
/**
|
|
63
|
+
* Returns a string representation of the error chain.
|
|
64
|
+
* Includes all chained errors for better debugging.
|
|
65
|
+
*
|
|
66
|
+
* @returns String representation of the error chain.
|
|
67
|
+
*/
|
|
68
|
+
toString(): string;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=errors.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.cts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF;;;;;;;;GAQG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAElC;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC;IAEtB;;;;;OAKG;gBAED,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,6BAA6B,GAAG,KAAK;IA6BjD;;;;;OAKG;IACH,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAiBjC;;;;;OAKG;IACH,QAAQ,IAAI,MAAM;CAanB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for creating a KeyringControllerError.
|
|
3
|
+
*/
|
|
4
|
+
export type KeyringControllerErrorOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* The underlying error that caused this error (for error chaining).
|
|
7
|
+
* Uses the standard Error.cause property (ES2022).
|
|
8
|
+
*/
|
|
9
|
+
cause?: Error;
|
|
10
|
+
/**
|
|
11
|
+
* Optional error code for programmatic error handling.
|
|
12
|
+
* This can be used to identify specific error types without string matching.
|
|
13
|
+
*/
|
|
14
|
+
code?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Additional context data associated with the error.
|
|
17
|
+
* Useful for debugging and error reporting.
|
|
18
|
+
*/
|
|
19
|
+
context?: Record<string, unknown>;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Error class for KeyringController-related errors.
|
|
23
|
+
*
|
|
24
|
+
* This error class extends the standard Error class and supports:
|
|
25
|
+
* - Error chaining via the `cause` property (ES2022 standard)
|
|
26
|
+
* - Optional error codes for programmatic error handling
|
|
27
|
+
* - Additional context data for debugging
|
|
28
|
+
* - Backward compatibility with the legacy `originalError` property
|
|
29
|
+
*/
|
|
30
|
+
export declare class KeyringControllerError extends Error {
|
|
31
|
+
/**
|
|
32
|
+
* Optional error code for programmatic error handling.
|
|
33
|
+
*/
|
|
34
|
+
code?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Additional context data associated with the error.
|
|
37
|
+
*/
|
|
38
|
+
context?: Record<string, unknown>;
|
|
39
|
+
/**
|
|
40
|
+
* The underlying error that caused this error (ES2022 standard).
|
|
41
|
+
* This is set manually for compatibility with older TypeScript versions.
|
|
42
|
+
*/
|
|
43
|
+
cause?: Error;
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated Use `cause` instead. This property is maintained for backward compatibility.
|
|
46
|
+
*/
|
|
47
|
+
originalError?: Error;
|
|
48
|
+
/**
|
|
49
|
+
* Creates a new KeyringControllerError.
|
|
50
|
+
*
|
|
51
|
+
* @param message - The error message.
|
|
52
|
+
* @param options - Error options or an Error object for backward compatibility.
|
|
53
|
+
*/
|
|
54
|
+
constructor(message: string, options?: KeyringControllerErrorOptions | Error);
|
|
55
|
+
/**
|
|
56
|
+
* Returns a JSON representation of the error.
|
|
57
|
+
* Useful for logging and error reporting.
|
|
58
|
+
*
|
|
59
|
+
* @returns JSON representation of the error.
|
|
60
|
+
*/
|
|
61
|
+
toJSON(): Record<string, unknown>;
|
|
62
|
+
/**
|
|
63
|
+
* Returns a string representation of the error chain.
|
|
64
|
+
* Includes all chained errors for better debugging.
|
|
65
|
+
*
|
|
66
|
+
* @returns String representation of the error chain.
|
|
67
|
+
*/
|
|
68
|
+
toString(): string;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=errors.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.mts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF;;;;;;;;GAQG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAElC;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC;IAEtB;;;;;OAKG;gBAED,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,6BAA6B,GAAG,KAAK;IA6BjD;;;;;OAKG;IACH,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAiBjC;;;;;OAKG;IACH,QAAQ,IAAI,MAAM;CAanB"}
|
package/dist/errors.mjs
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error class for KeyringController-related errors.
|
|
3
|
+
*
|
|
4
|
+
* This error class extends the standard Error class and supports:
|
|
5
|
+
* - Error chaining via the `cause` property (ES2022 standard)
|
|
6
|
+
* - Optional error codes for programmatic error handling
|
|
7
|
+
* - Additional context data for debugging
|
|
8
|
+
* - Backward compatibility with the legacy `originalError` property
|
|
9
|
+
*/
|
|
10
|
+
export class KeyringControllerError extends Error {
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new KeyringControllerError.
|
|
13
|
+
*
|
|
14
|
+
* @param message - The error message.
|
|
15
|
+
* @param options - Error options or an Error object for backward compatibility.
|
|
16
|
+
*/
|
|
17
|
+
constructor(message, options) {
|
|
18
|
+
super(message);
|
|
19
|
+
this.name = 'KeyringControllerError';
|
|
20
|
+
// Support both new signature (options object) and legacy signature (Error as second param)
|
|
21
|
+
const cause = options instanceof Error ? options : options?.cause;
|
|
22
|
+
const code = options instanceof Error ? undefined : options?.code;
|
|
23
|
+
const context = options instanceof Error ? undefined : options?.context;
|
|
24
|
+
// Set cause property for error chaining (ES2022 standard)
|
|
25
|
+
if (cause) {
|
|
26
|
+
this.cause = cause;
|
|
27
|
+
// Maintain backward compatibility with originalError
|
|
28
|
+
this.originalError = cause;
|
|
29
|
+
}
|
|
30
|
+
// Set code and data if provided
|
|
31
|
+
if (code) {
|
|
32
|
+
this.code = code;
|
|
33
|
+
}
|
|
34
|
+
if (context) {
|
|
35
|
+
this.context = context;
|
|
36
|
+
}
|
|
37
|
+
// Ensure proper prototype chain for instanceof checks
|
|
38
|
+
Object.setPrototypeOf(this, KeyringControllerError.prototype);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Returns a JSON representation of the error.
|
|
42
|
+
* Useful for logging and error reporting.
|
|
43
|
+
*
|
|
44
|
+
* @returns JSON representation of the error.
|
|
45
|
+
*/
|
|
46
|
+
toJSON() {
|
|
47
|
+
return {
|
|
48
|
+
name: this.name,
|
|
49
|
+
message: this.message,
|
|
50
|
+
code: this.code,
|
|
51
|
+
context: this.context,
|
|
52
|
+
stack: this.stack,
|
|
53
|
+
cause: this.cause
|
|
54
|
+
? {
|
|
55
|
+
name: this.cause.name,
|
|
56
|
+
message: this.cause.message,
|
|
57
|
+
stack: this.cause.stack,
|
|
58
|
+
}
|
|
59
|
+
: undefined,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Returns a string representation of the error chain.
|
|
64
|
+
* Includes all chained errors for better debugging.
|
|
65
|
+
*
|
|
66
|
+
* @returns String representation of the error chain.
|
|
67
|
+
*/
|
|
68
|
+
toString() {
|
|
69
|
+
let result = `${this.name}: ${this.message}`;
|
|
70
|
+
if (this.code) {
|
|
71
|
+
result += ` [${this.code}]`;
|
|
72
|
+
}
|
|
73
|
+
if (this.cause) {
|
|
74
|
+
result += `\n Caused by: ${this.cause}`;
|
|
75
|
+
}
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=errors.mjs.map
|