1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 01:47:00 +01:00

feat: use siwe detection from @metamask/controller-utils (#18409)

This commit is contained in:
OGPoyraz 2023-04-04 17:25:57 +02:00 committed by GitHub
parent 7a8d0273a0
commit 6e40a0eb7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 447 additions and 496 deletions

View File

@ -8,7 +8,6 @@ import {
OriginalRequest, OriginalRequest,
} from '@metamask/message-manager/dist/AbstractMessageManager'; } from '@metamask/message-manager/dist/AbstractMessageManager';
import { MetaMetricsEventCategory } from '../../../shared/constants/metametrics'; import { MetaMetricsEventCategory } from '../../../shared/constants/metametrics';
import { detectSIWE } from '../../../shared/modules/siwe';
import SignController, { import SignController, {
SignControllerMessenger, SignControllerMessenger,
SignControllerOptions, SignControllerOptions,
@ -20,10 +19,6 @@ jest.mock('@metamask/message-manager', () => ({
TypedMessageManager: jest.fn(), TypedMessageManager: jest.fn(),
})); }));
jest.mock('../../../shared/modules/siwe', () => ({
detectSIWE: jest.fn(),
}));
const messageIdMock = '123'; const messageIdMock = '123';
const messageIdMock2 = '456'; const messageIdMock2 = '456';
const versionMock = '1'; const versionMock = '1';
@ -69,13 +64,6 @@ const requestMock = {
origin: 'http://test2.com', origin: 'http://test2.com',
} as OriginalRequest; } as OriginalRequest;
const siweMockFound = {
isSIWEMessage: true,
parsedMessage: { domain: 'test.com', test: 'value' },
};
const siweMockNotFound = { isSIWEMessage: false };
const createMessengerMock = () => const createMessengerMock = () =>
({ ({
registerActionHandler: jest.fn(), registerActionHandler: jest.fn(),
@ -128,7 +116,6 @@ describe('SignController', () => {
const messengerMock = createMessengerMock(); const messengerMock = createMessengerMock();
const preferencesControllerMock = createPreferencesControllerMock(); const preferencesControllerMock = createPreferencesControllerMock();
const keyringControllerMock = createKeyringControllerMock(); const keyringControllerMock = createKeyringControllerMock();
const detectSIWEMock = detectSIWE as jest.MockedFunction<typeof detectSIWE>;
const getStateMock = jest.fn(); const getStateMock = jest.fn();
const securityProviderRequestMock = jest.fn(); const securityProviderRequestMock = jest.fn();
const metricsEventMock = jest.fn(); const metricsEventMock = jest.fn();
@ -147,8 +134,6 @@ describe('SignController', () => {
disabledRpcMethodPreferences: { eth_sign: true }, disabledRpcMethodPreferences: { eth_sign: true },
}); });
detectSIWEMock.mockReturnValue(siweMockNotFound);
signController = new SignController({ signController = new SignController({
messenger: messengerMock as any, messenger: messengerMock as any,
preferencesController: preferencesControllerMock as any, preferencesController: preferencesControllerMock as any,
@ -354,29 +339,6 @@ describe('SignController', () => {
requestMock, requestMock,
); );
}); });
it('adds message to personal message manager including Ethereum sign in data', async () => {
detectSIWEMock.mockReturnValueOnce(siweMockFound);
await signController.newUnsignedPersonalMessage(
messageParamsMock,
requestMock,
);
expect(
personalMessageManagerMock.addUnapprovedMessageAsync,
).toHaveBeenCalledTimes(1);
expect(
personalMessageManagerMock.addUnapprovedMessageAsync,
).toHaveBeenCalledWith(
{
...messageParamsMock,
siwe: siweMockFound,
},
requestMock,
);
});
}); });
describe('newUnsignedTypedMessage', () => { describe('newUnsignedTypedMessage', () => {

View File

@ -33,7 +33,6 @@ import {
RejectRequest, RejectRequest,
} from '@metamask/approval-controller'; } from '@metamask/approval-controller';
import { MetaMetricsEventCategory } from '../../../shared/constants/metametrics'; import { MetaMetricsEventCategory } from '../../../shared/constants/metametrics';
import { detectSIWE } from '../../../shared/modules/siwe';
import PreferencesController from './preferences'; import PreferencesController from './preferences';
const controllerName = 'SignController'; const controllerName = 'SignController';
@ -321,11 +320,8 @@ export default class SignController extends BaseControllerV2<
msgParams: PersonalMessageParams, msgParams: PersonalMessageParams,
req: OriginalRequest, req: OriginalRequest,
): Promise<string> { ): Promise<string> {
const ethereumSignInData = this._getEthereumSignInData(msgParams);
const finalMsgParams = { ...msgParams, siwe: ethereumSignInData };
return this._personalMessageManager.addUnapprovedMessageAsync( return this._personalMessageManager.addUnapprovedMessageAsync(
finalMsgParams, msgParams,
req, req,
); );
} }
@ -618,10 +614,6 @@ export default class SignController extends BaseControllerV2<
}[messageId]; }[messageId];
} }
private _getEthereumSignInData(messgeParams: PersonalMessageParams): any {
return detectSIWE(messgeParams);
}
private _requestApproval( private _requestApproval(
msgParams: AbstractMessageParamsMetamask, msgParams: AbstractMessageParamsMetamask,
type: string, type: string,

View File

@ -1,8 +1,9 @@
import { errorCodes } from 'eth-rpc-errors'; import { errorCodes } from 'eth-rpc-errors';
import { detectSIWE } from '@metamask/controller-utils';
import { MESSAGE_TYPE, ORIGIN_METAMASK } from '../../../shared/constants/app'; import { MESSAGE_TYPE, ORIGIN_METAMASK } from '../../../shared/constants/app';
import { TransactionStatus } from '../../../shared/constants/transaction'; import { TransactionStatus } from '../../../shared/constants/transaction';
import { SECOND } from '../../../shared/constants/time'; import { SECOND } from '../../../shared/constants/time';
import { detectSIWE } from '../../../shared/modules/siwe';
import { import {
MetaMetricsEventCategory, MetaMetricsEventCategory,
MetaMetricsEventName, MetaMetricsEventName,

View File

@ -1,11 +1,11 @@
import { errorCodes } from 'eth-rpc-errors'; import { errorCodes } from 'eth-rpc-errors';
import { detectSIWE } from '@metamask/controller-utils';
import { MESSAGE_TYPE } from '../../../shared/constants/app'; import { MESSAGE_TYPE } from '../../../shared/constants/app';
import { import {
MetaMetricsEventName, MetaMetricsEventName,
MetaMetricsEventUiCustomization, MetaMetricsEventUiCustomization,
} from '../../../shared/constants/metametrics'; } from '../../../shared/constants/metametrics';
import { SECOND } from '../../../shared/constants/time'; import { SECOND } from '../../../shared/constants/time';
import { detectSIWE } from '../../../shared/modules/siwe';
import createRPCMethodTrackingMiddleware from './createRPCMethodTrackingMiddleware'; import createRPCMethodTrackingMiddleware from './createRPCMethodTrackingMiddleware';
const trackEvent = jest.fn(); const trackEvent = jest.fn();
@ -56,7 +56,7 @@ function getNext(timeout = 500) {
const waitForSeconds = async (seconds) => const waitForSeconds = async (seconds) =>
await new Promise((resolve) => setTimeout(resolve, SECOND * seconds)); await new Promise((resolve) => setTimeout(resolve, SECOND * seconds));
jest.mock('../../../shared/modules/siwe', () => ({ jest.mock('@metamask/controller-utils', () => ({
detectSIWE: jest.fn().mockImplementation(() => { detectSIWE: jest.fn().mockImplementation(() => {
return { isSIWEMessage: false }; return { isSIWEMessage: false };
}), }),

View File

@ -661,7 +661,7 @@
"@metamask/address-book-controller": { "@metamask/address-book-controller": {
"packages": { "packages": {
"@metamask/address-book-controller>@metamask/base-controller": true, "@metamask/address-book-controller>@metamask/base-controller": true,
"@metamask/controller-utils": true "@metamask/address-book-controller>@metamask/controller-utils": true
} }
}, },
"@metamask/address-book-controller>@metamask/base-controller": { "@metamask/address-book-controller>@metamask/base-controller": {
@ -669,6 +669,21 @@
"immer": true "immer": true
} }
}, },
"@metamask/address-book-controller>@metamask/controller-utils": {
"globals": {
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/phishing-controller>isomorphic-fetch": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/announcement-controller": { "@metamask/announcement-controller": {
"packages": { "packages": {
"@metamask/announcement-controller>@metamask/base-controller": true "@metamask/announcement-controller>@metamask/base-controller": true
@ -680,6 +695,9 @@
} }
}, },
"@metamask/approval-controller": { "@metamask/approval-controller": {
"globals": {
"console.log": true
},
"packages": { "packages": {
"@metamask/approval-controller>nanoid": true, "@metamask/approval-controller>nanoid": true,
"@metamask/base-controller": true, "@metamask/base-controller": true,
@ -747,7 +765,7 @@
"setTimeout": true "setTimeout": true
}, },
"packages": { "packages": {
"@metamask/controller-utils>isomorphic-fetch": true, "@metamask/phishing-controller>isomorphic-fetch": true,
"browserify>buffer": true, "browserify>buffer": true,
"eslint>fast-deep-equal": true, "eslint>fast-deep-equal": true,
"eth-ens-namehash": true, "eth-ens-namehash": true,
@ -791,7 +809,8 @@
"setTimeout": true "setTimeout": true
}, },
"packages": { "packages": {
"@metamask/controller-utils>isomorphic-fetch": true, "@metamask/controller-utils>@metamask/utils": true,
"@metamask/controller-utils>@spruceid/siwe-parser": true,
"browserify>buffer": true, "browserify>buffer": true,
"eslint>fast-deep-equal": true, "eslint>fast-deep-equal": true,
"eth-ens-namehash": true, "eth-ens-namehash": true,
@ -799,23 +818,34 @@
"ethjs>ethjs-unit": true "ethjs>ethjs-unit": true
} }
}, },
"@metamask/controller-utils>isomorphic-fetch": { "@metamask/controller-utils>@metamask/utils": {
"globals": { "globals": {
"fetch.bind": true "TextDecoder": true,
"TextEncoder": true
}, },
"packages": { "packages": {
"@metamask/controller-utils>isomorphic-fetch>whatwg-fetch": true "@metamask/utils>superstruct": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true
} }
}, },
"@metamask/controller-utils>isomorphic-fetch>whatwg-fetch": { "@metamask/controller-utils>@spruceid/siwe-parser": {
"globals": { "globals": {
"Blob": true, "console.error": true,
"FileReader": true, "console.log": true
"FormData": true, },
"URLSearchParams.prototype.isPrototypeOf": true, "packages": {
"XMLHttpRequest": true, "@metamask/controller-utils>@spruceid/siwe-parser>apg-js": true
"define": true, }
"setTimeout": true },
"@metamask/controller-utils>@spruceid/siwe-parser>apg-js": {
"globals": {
"mode": true
},
"packages": {
"browserify>buffer": true,
"browserify>insert-module-globals>is-buffer": true
} }
}, },
"@metamask/controllers>nanoid": { "@metamask/controllers>nanoid": {
@ -1171,8 +1201,8 @@
"setInterval": true "setInterval": true
}, },
"packages": { "packages": {
"@metamask/controller-utils": true,
"@metamask/gas-fee-controller>@metamask/base-controller": true, "@metamask/gas-fee-controller>@metamask/base-controller": true,
"@metamask/gas-fee-controller>@metamask/controller-utils": true,
"eth-query": true, "eth-query": true,
"ethereumjs-util": true, "ethereumjs-util": true,
"ethjs>ethjs-unit": true, "ethjs>ethjs-unit": true,
@ -1184,6 +1214,21 @@
"immer": true "immer": true
} }
}, },
"@metamask/gas-fee-controller>@metamask/controller-utils": {
"globals": {
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/phishing-controller>isomorphic-fetch": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/jazzicon": { "@metamask/jazzicon": {
"globals": { "globals": {
"document.createElement": true, "document.createElement": true,
@ -1282,8 +1327,8 @@
}, },
"@metamask/message-manager": { "@metamask/message-manager": {
"packages": { "packages": {
"@metamask/controller-utils": true,
"@metamask/message-manager>@metamask/base-controller": true, "@metamask/message-manager>@metamask/base-controller": true,
"@metamask/message-manager>@metamask/controller-utils": true,
"@metamask/message-manager>jsonschema": true, "@metamask/message-manager>jsonschema": true,
"browserify>buffer": true, "browserify>buffer": true,
"browserify>events": true, "browserify>events": true,
@ -1297,34 +1342,6 @@
"immer": true "immer": true
} }
}, },
"@metamask/message-manager>@metamask/controller-utils": {
"globals": {
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/message-manager>@metamask/controller-utils>@metamask/utils": true,
"@spruceid/siwe-parser": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/message-manager>@metamask/controller-utils>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/utils>superstruct": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true
}
},
"@metamask/message-manager>jsonschema": { "@metamask/message-manager>jsonschema": {
"packages": { "packages": {
"browserify>url": true "browserify>url": true
@ -1355,8 +1372,8 @@
"console.error": true "console.error": true
}, },
"packages": { "packages": {
"@metamask/controller-utils": true,
"@metamask/permission-controller>@metamask/base-controller": true, "@metamask/permission-controller>@metamask/base-controller": true,
"@metamask/permission-controller>@metamask/controller-utils": true,
"@metamask/permission-controller>nanoid": true, "@metamask/permission-controller>nanoid": true,
"deep-freeze-strict": true, "deep-freeze-strict": true,
"eth-rpc-errors": true, "eth-rpc-errors": true,
@ -1369,34 +1386,6 @@
"immer": true "immer": true
} }
}, },
"@metamask/permission-controller>@metamask/controller-utils": {
"globals": {
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/permission-controller>@metamask/controller-utils>@metamask/utils": true,
"@spruceid/siwe-parser": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/permission-controller>@metamask/controller-utils>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/utils>superstruct": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true
}
},
"@metamask/permission-controller>nanoid": { "@metamask/permission-controller>nanoid": {
"globals": { "globals": {
"crypto.getRandomValues": true "crypto.getRandomValues": true
@ -1408,8 +1397,8 @@
}, },
"packages": { "packages": {
"@metamask/base-controller": true, "@metamask/base-controller": true,
"@metamask/controller-utils>isomorphic-fetch": true,
"@metamask/phishing-controller>@metamask/controller-utils": true, "@metamask/phishing-controller>@metamask/controller-utils": true,
"@metamask/phishing-controller>isomorphic-fetch": true,
"@metamask/phishing-warning>eth-phishing-detect": true, "@metamask/phishing-warning>eth-phishing-detect": true,
"punycode": true "punycode": true
} }
@ -1421,7 +1410,7 @@
"setTimeout": true "setTimeout": true
}, },
"packages": { "packages": {
"@metamask/controller-utils>isomorphic-fetch": true, "@metamask/phishing-controller>isomorphic-fetch": true,
"browserify>buffer": true, "browserify>buffer": true,
"eslint>fast-deep-equal": true, "eslint>fast-deep-equal": true,
"eth-ens-namehash": true, "eth-ens-namehash": true,
@ -1429,6 +1418,25 @@
"ethjs>ethjs-unit": true "ethjs>ethjs-unit": true
} }
}, },
"@metamask/phishing-controller>isomorphic-fetch": {
"globals": {
"fetch.bind": true
},
"packages": {
"@metamask/phishing-controller>isomorphic-fetch>whatwg-fetch": true
}
},
"@metamask/phishing-controller>isomorphic-fetch>whatwg-fetch": {
"globals": {
"Blob": true,
"FileReader": true,
"FormData": true,
"URLSearchParams.prototype.isPrototypeOf": true,
"XMLHttpRequest": true,
"define": true,
"setTimeout": true
}
},
"@metamask/phishing-warning>eth-phishing-detect": { "@metamask/phishing-warning>eth-phishing-detect": {
"packages": { "packages": {
"eslint>optionator>fast-levenshtein": true "eslint>optionator>fast-levenshtein": true
@ -1492,13 +1500,28 @@
"@ethersproject/bignumber": true, "@ethersproject/bignumber": true,
"@ethersproject/providers": true, "@ethersproject/providers": true,
"@metamask/base-controller": true, "@metamask/base-controller": true,
"@metamask/controller-utils": true, "@metamask/phishing-controller>isomorphic-fetch": true,
"@metamask/controller-utils>isomorphic-fetch": true, "@metamask/smart-transactions-controller>@metamask/controller-utils": true,
"@metamask/smart-transactions-controller>bignumber.js": true, "@metamask/smart-transactions-controller>bignumber.js": true,
"fast-json-patch": true, "fast-json-patch": true,
"lodash": true "lodash": true
} }
}, },
"@metamask/smart-transactions-controller>@metamask/controller-utils": {
"globals": {
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/phishing-controller>isomorphic-fetch": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/smart-transactions-controller>@metamask/controllers>nanoid": { "@metamask/smart-transactions-controller>@metamask/controllers>nanoid": {
"globals": { "globals": {
"crypto.getRandomValues": true "crypto.getRandomValues": true
@ -1770,24 +1793,6 @@
"define": true "define": true
} }
}, },
"@spruceid/siwe-parser": {
"globals": {
"console.error": true,
"console.log": true
},
"packages": {
"@spruceid/siwe-parser>apg-js": true
}
},
"@spruceid/siwe-parser>apg-js": {
"globals": {
"mode": true
},
"packages": {
"browserify>buffer": true,
"browserify>insert-module-globals>is-buffer": true
}
},
"@storybook/api>regenerator-runtime": { "@storybook/api>regenerator-runtime": {
"globals": { "globals": {
"regeneratorRuntime": "write" "regeneratorRuntime": "write"

View File

@ -661,7 +661,7 @@
"@metamask/address-book-controller": { "@metamask/address-book-controller": {
"packages": { "packages": {
"@metamask/address-book-controller>@metamask/base-controller": true, "@metamask/address-book-controller>@metamask/base-controller": true,
"@metamask/controller-utils": true "@metamask/address-book-controller>@metamask/controller-utils": true
} }
}, },
"@metamask/address-book-controller>@metamask/base-controller": { "@metamask/address-book-controller>@metamask/base-controller": {
@ -669,6 +669,21 @@
"immer": true "immer": true
} }
}, },
"@metamask/address-book-controller>@metamask/controller-utils": {
"globals": {
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/phishing-controller>isomorphic-fetch": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/announcement-controller": { "@metamask/announcement-controller": {
"packages": { "packages": {
"@metamask/announcement-controller>@metamask/base-controller": true "@metamask/announcement-controller>@metamask/base-controller": true
@ -680,6 +695,9 @@
} }
}, },
"@metamask/approval-controller": { "@metamask/approval-controller": {
"globals": {
"console.log": true
},
"packages": { "packages": {
"@metamask/approval-controller>nanoid": true, "@metamask/approval-controller>nanoid": true,
"@metamask/base-controller": true, "@metamask/base-controller": true,
@ -747,7 +765,7 @@
"setTimeout": true "setTimeout": true
}, },
"packages": { "packages": {
"@metamask/controller-utils>isomorphic-fetch": true, "@metamask/phishing-controller>isomorphic-fetch": true,
"browserify>buffer": true, "browserify>buffer": true,
"eslint>fast-deep-equal": true, "eslint>fast-deep-equal": true,
"eth-ens-namehash": true, "eth-ens-namehash": true,
@ -791,7 +809,8 @@
"setTimeout": true "setTimeout": true
}, },
"packages": { "packages": {
"@metamask/controller-utils>isomorphic-fetch": true, "@metamask/controller-utils>@metamask/utils": true,
"@metamask/controller-utils>@spruceid/siwe-parser": true,
"browserify>buffer": true, "browserify>buffer": true,
"eslint>fast-deep-equal": true, "eslint>fast-deep-equal": true,
"eth-ens-namehash": true, "eth-ens-namehash": true,
@ -799,23 +818,34 @@
"ethjs>ethjs-unit": true "ethjs>ethjs-unit": true
} }
}, },
"@metamask/controller-utils>isomorphic-fetch": { "@metamask/controller-utils>@metamask/utils": {
"globals": { "globals": {
"fetch.bind": true "TextDecoder": true,
"TextEncoder": true
}, },
"packages": { "packages": {
"@metamask/controller-utils>isomorphic-fetch>whatwg-fetch": true "@metamask/utils>superstruct": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true
} }
}, },
"@metamask/controller-utils>isomorphic-fetch>whatwg-fetch": { "@metamask/controller-utils>@spruceid/siwe-parser": {
"globals": { "globals": {
"Blob": true, "console.error": true,
"FileReader": true, "console.log": true
"FormData": true, },
"URLSearchParams.prototype.isPrototypeOf": true, "packages": {
"XMLHttpRequest": true, "@metamask/controller-utils>@spruceid/siwe-parser>apg-js": true
"define": true, }
"setTimeout": true },
"@metamask/controller-utils>@spruceid/siwe-parser>apg-js": {
"globals": {
"mode": true
},
"packages": {
"browserify>buffer": true,
"browserify>insert-module-globals>is-buffer": true
} }
}, },
"@metamask/controllers>nanoid": { "@metamask/controllers>nanoid": {
@ -1243,8 +1273,8 @@
"setInterval": true "setInterval": true
}, },
"packages": { "packages": {
"@metamask/controller-utils": true,
"@metamask/gas-fee-controller>@metamask/base-controller": true, "@metamask/gas-fee-controller>@metamask/base-controller": true,
"@metamask/gas-fee-controller>@metamask/controller-utils": true,
"eth-query": true, "eth-query": true,
"ethereumjs-util": true, "ethereumjs-util": true,
"ethjs>ethjs-unit": true, "ethjs>ethjs-unit": true,
@ -1256,6 +1286,21 @@
"immer": true "immer": true
} }
}, },
"@metamask/gas-fee-controller>@metamask/controller-utils": {
"globals": {
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/phishing-controller>isomorphic-fetch": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/jazzicon": { "@metamask/jazzicon": {
"globals": { "globals": {
"document.createElement": true, "document.createElement": true,
@ -1354,8 +1399,8 @@
}, },
"@metamask/message-manager": { "@metamask/message-manager": {
"packages": { "packages": {
"@metamask/controller-utils": true,
"@metamask/message-manager>@metamask/base-controller": true, "@metamask/message-manager>@metamask/base-controller": true,
"@metamask/message-manager>@metamask/controller-utils": true,
"@metamask/message-manager>jsonschema": true, "@metamask/message-manager>jsonschema": true,
"browserify>buffer": true, "browserify>buffer": true,
"browserify>events": true, "browserify>events": true,
@ -1369,34 +1414,6 @@
"immer": true "immer": true
} }
}, },
"@metamask/message-manager>@metamask/controller-utils": {
"globals": {
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/message-manager>@metamask/controller-utils>@metamask/utils": true,
"@spruceid/siwe-parser": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/message-manager>@metamask/controller-utils>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/utils>superstruct": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true
}
},
"@metamask/message-manager>jsonschema": { "@metamask/message-manager>jsonschema": {
"packages": { "packages": {
"browserify>url": true "browserify>url": true
@ -1404,8 +1421,8 @@
}, },
"@metamask/notification-controller": { "@metamask/notification-controller": {
"packages": { "packages": {
"@metamask/controller-utils": true,
"@metamask/notification-controller>@metamask/base-controller": true, "@metamask/notification-controller>@metamask/base-controller": true,
"@metamask/notification-controller>@metamask/controller-utils": true,
"@metamask/notification-controller>nanoid": true "@metamask/notification-controller>nanoid": true
} }
}, },
@ -1414,6 +1431,21 @@
"immer": true "immer": true
} }
}, },
"@metamask/notification-controller>@metamask/controller-utils": {
"globals": {
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/phishing-controller>isomorphic-fetch": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/notification-controller>nanoid": { "@metamask/notification-controller>nanoid": {
"globals": { "globals": {
"crypto.getRandomValues": true "crypto.getRandomValues": true
@ -1439,8 +1471,8 @@
"console.error": true "console.error": true
}, },
"packages": { "packages": {
"@metamask/controller-utils": true,
"@metamask/permission-controller>@metamask/base-controller": true, "@metamask/permission-controller>@metamask/base-controller": true,
"@metamask/permission-controller>@metamask/controller-utils": true,
"@metamask/permission-controller>nanoid": true, "@metamask/permission-controller>nanoid": true,
"deep-freeze-strict": true, "deep-freeze-strict": true,
"eth-rpc-errors": true, "eth-rpc-errors": true,
@ -1453,34 +1485,6 @@
"immer": true "immer": true
} }
}, },
"@metamask/permission-controller>@metamask/controller-utils": {
"globals": {
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/permission-controller>@metamask/controller-utils>@metamask/utils": true,
"@spruceid/siwe-parser": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/permission-controller>@metamask/controller-utils>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/utils>superstruct": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true
}
},
"@metamask/permission-controller>nanoid": { "@metamask/permission-controller>nanoid": {
"globals": { "globals": {
"crypto.getRandomValues": true "crypto.getRandomValues": true
@ -1492,8 +1496,8 @@
}, },
"packages": { "packages": {
"@metamask/base-controller": true, "@metamask/base-controller": true,
"@metamask/controller-utils>isomorphic-fetch": true,
"@metamask/phishing-controller>@metamask/controller-utils": true, "@metamask/phishing-controller>@metamask/controller-utils": true,
"@metamask/phishing-controller>isomorphic-fetch": true,
"@metamask/phishing-warning>eth-phishing-detect": true, "@metamask/phishing-warning>eth-phishing-detect": true,
"punycode": true "punycode": true
} }
@ -1505,7 +1509,7 @@
"setTimeout": true "setTimeout": true
}, },
"packages": { "packages": {
"@metamask/controller-utils>isomorphic-fetch": true, "@metamask/phishing-controller>isomorphic-fetch": true,
"browserify>buffer": true, "browserify>buffer": true,
"eslint>fast-deep-equal": true, "eslint>fast-deep-equal": true,
"eth-ens-namehash": true, "eth-ens-namehash": true,
@ -1513,6 +1517,25 @@
"ethjs>ethjs-unit": true "ethjs>ethjs-unit": true
} }
}, },
"@metamask/phishing-controller>isomorphic-fetch": {
"globals": {
"fetch.bind": true
},
"packages": {
"@metamask/phishing-controller>isomorphic-fetch>whatwg-fetch": true
}
},
"@metamask/phishing-controller>isomorphic-fetch>whatwg-fetch": {
"globals": {
"Blob": true,
"FileReader": true,
"FormData": true,
"URLSearchParams.prototype.isPrototypeOf": true,
"XMLHttpRequest": true,
"define": true,
"setTimeout": true
}
},
"@metamask/phishing-warning>eth-phishing-detect": { "@metamask/phishing-warning>eth-phishing-detect": {
"packages": { "packages": {
"eslint>optionator>fast-levenshtein": true "eslint>optionator>fast-levenshtein": true
@ -1665,13 +1688,28 @@
"@ethersproject/bignumber": true, "@ethersproject/bignumber": true,
"@ethersproject/providers": true, "@ethersproject/providers": true,
"@metamask/base-controller": true, "@metamask/base-controller": true,
"@metamask/controller-utils": true, "@metamask/phishing-controller>isomorphic-fetch": true,
"@metamask/controller-utils>isomorphic-fetch": true, "@metamask/smart-transactions-controller>@metamask/controller-utils": true,
"@metamask/smart-transactions-controller>bignumber.js": true, "@metamask/smart-transactions-controller>bignumber.js": true,
"fast-json-patch": true, "fast-json-patch": true,
"lodash": true "lodash": true
} }
}, },
"@metamask/smart-transactions-controller>@metamask/controller-utils": {
"globals": {
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/phishing-controller>isomorphic-fetch": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/smart-transactions-controller>@metamask/controllers>nanoid": { "@metamask/smart-transactions-controller>@metamask/controllers>nanoid": {
"globals": { "globals": {
"crypto.getRandomValues": true "crypto.getRandomValues": true
@ -2183,24 +2221,6 @@
"define": true "define": true
} }
}, },
"@spruceid/siwe-parser": {
"globals": {
"console.error": true,
"console.log": true
},
"packages": {
"@spruceid/siwe-parser>apg-js": true
}
},
"@spruceid/siwe-parser>apg-js": {
"globals": {
"mode": true
},
"packages": {
"browserify>buffer": true,
"browserify>insert-module-globals>is-buffer": true
}
},
"@storybook/api>regenerator-runtime": { "@storybook/api>regenerator-runtime": {
"globals": { "globals": {
"regeneratorRuntime": "write" "regeneratorRuntime": "write"

View File

@ -661,7 +661,7 @@
"@metamask/address-book-controller": { "@metamask/address-book-controller": {
"packages": { "packages": {
"@metamask/address-book-controller>@metamask/base-controller": true, "@metamask/address-book-controller>@metamask/base-controller": true,
"@metamask/controller-utils": true "@metamask/address-book-controller>@metamask/controller-utils": true
} }
}, },
"@metamask/address-book-controller>@metamask/base-controller": { "@metamask/address-book-controller>@metamask/base-controller": {
@ -669,6 +669,21 @@
"immer": true "immer": true
} }
}, },
"@metamask/address-book-controller>@metamask/controller-utils": {
"globals": {
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/phishing-controller>isomorphic-fetch": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/announcement-controller": { "@metamask/announcement-controller": {
"packages": { "packages": {
"@metamask/announcement-controller>@metamask/base-controller": true "@metamask/announcement-controller>@metamask/base-controller": true
@ -680,6 +695,9 @@
} }
}, },
"@metamask/approval-controller": { "@metamask/approval-controller": {
"globals": {
"console.log": true
},
"packages": { "packages": {
"@metamask/approval-controller>nanoid": true, "@metamask/approval-controller>nanoid": true,
"@metamask/base-controller": true, "@metamask/base-controller": true,
@ -747,7 +765,7 @@
"setTimeout": true "setTimeout": true
}, },
"packages": { "packages": {
"@metamask/controller-utils>isomorphic-fetch": true, "@metamask/phishing-controller>isomorphic-fetch": true,
"browserify>buffer": true, "browserify>buffer": true,
"eslint>fast-deep-equal": true, "eslint>fast-deep-equal": true,
"eth-ens-namehash": true, "eth-ens-namehash": true,
@ -791,7 +809,8 @@
"setTimeout": true "setTimeout": true
}, },
"packages": { "packages": {
"@metamask/controller-utils>isomorphic-fetch": true, "@metamask/controller-utils>@metamask/utils": true,
"@metamask/controller-utils>@spruceid/siwe-parser": true,
"browserify>buffer": true, "browserify>buffer": true,
"eslint>fast-deep-equal": true, "eslint>fast-deep-equal": true,
"eth-ens-namehash": true, "eth-ens-namehash": true,
@ -799,23 +818,34 @@
"ethjs>ethjs-unit": true "ethjs>ethjs-unit": true
} }
}, },
"@metamask/controller-utils>isomorphic-fetch": { "@metamask/controller-utils>@metamask/utils": {
"globals": { "globals": {
"fetch.bind": true "TextDecoder": true,
"TextEncoder": true
}, },
"packages": { "packages": {
"@metamask/controller-utils>isomorphic-fetch>whatwg-fetch": true "@metamask/utils>superstruct": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true
} }
}, },
"@metamask/controller-utils>isomorphic-fetch>whatwg-fetch": { "@metamask/controller-utils>@spruceid/siwe-parser": {
"globals": { "globals": {
"Blob": true, "console.error": true,
"FileReader": true, "console.log": true
"FormData": true, },
"URLSearchParams.prototype.isPrototypeOf": true, "packages": {
"XMLHttpRequest": true, "@metamask/controller-utils>@spruceid/siwe-parser>apg-js": true
"define": true, }
"setTimeout": true },
"@metamask/controller-utils>@spruceid/siwe-parser>apg-js": {
"globals": {
"mode": true
},
"packages": {
"browserify>buffer": true,
"browserify>insert-module-globals>is-buffer": true
} }
}, },
"@metamask/controllers>nanoid": { "@metamask/controllers>nanoid": {
@ -1243,8 +1273,8 @@
"setInterval": true "setInterval": true
}, },
"packages": { "packages": {
"@metamask/controller-utils": true,
"@metamask/gas-fee-controller>@metamask/base-controller": true, "@metamask/gas-fee-controller>@metamask/base-controller": true,
"@metamask/gas-fee-controller>@metamask/controller-utils": true,
"eth-query": true, "eth-query": true,
"ethereumjs-util": true, "ethereumjs-util": true,
"ethjs>ethjs-unit": true, "ethjs>ethjs-unit": true,
@ -1256,6 +1286,21 @@
"immer": true "immer": true
} }
}, },
"@metamask/gas-fee-controller>@metamask/controller-utils": {
"globals": {
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/phishing-controller>isomorphic-fetch": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/jazzicon": { "@metamask/jazzicon": {
"globals": { "globals": {
"document.createElement": true, "document.createElement": true,
@ -1354,8 +1399,8 @@
}, },
"@metamask/message-manager": { "@metamask/message-manager": {
"packages": { "packages": {
"@metamask/controller-utils": true,
"@metamask/message-manager>@metamask/base-controller": true, "@metamask/message-manager>@metamask/base-controller": true,
"@metamask/message-manager>@metamask/controller-utils": true,
"@metamask/message-manager>jsonschema": true, "@metamask/message-manager>jsonschema": true,
"browserify>buffer": true, "browserify>buffer": true,
"browserify>events": true, "browserify>events": true,
@ -1369,34 +1414,6 @@
"immer": true "immer": true
} }
}, },
"@metamask/message-manager>@metamask/controller-utils": {
"globals": {
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/message-manager>@metamask/controller-utils>@metamask/utils": true,
"@spruceid/siwe-parser": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/message-manager>@metamask/controller-utils>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/utils>superstruct": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true
}
},
"@metamask/message-manager>jsonschema": { "@metamask/message-manager>jsonschema": {
"packages": { "packages": {
"browserify>url": true "browserify>url": true
@ -1404,8 +1421,8 @@
}, },
"@metamask/notification-controller": { "@metamask/notification-controller": {
"packages": { "packages": {
"@metamask/controller-utils": true,
"@metamask/notification-controller>@metamask/base-controller": true, "@metamask/notification-controller>@metamask/base-controller": true,
"@metamask/notification-controller>@metamask/controller-utils": true,
"@metamask/notification-controller>nanoid": true "@metamask/notification-controller>nanoid": true
} }
}, },
@ -1414,6 +1431,21 @@
"immer": true "immer": true
} }
}, },
"@metamask/notification-controller>@metamask/controller-utils": {
"globals": {
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/phishing-controller>isomorphic-fetch": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/notification-controller>nanoid": { "@metamask/notification-controller>nanoid": {
"globals": { "globals": {
"crypto.getRandomValues": true "crypto.getRandomValues": true
@ -1439,8 +1471,8 @@
"console.error": true "console.error": true
}, },
"packages": { "packages": {
"@metamask/controller-utils": true,
"@metamask/permission-controller>@metamask/base-controller": true, "@metamask/permission-controller>@metamask/base-controller": true,
"@metamask/permission-controller>@metamask/controller-utils": true,
"@metamask/permission-controller>nanoid": true, "@metamask/permission-controller>nanoid": true,
"deep-freeze-strict": true, "deep-freeze-strict": true,
"eth-rpc-errors": true, "eth-rpc-errors": true,
@ -1453,34 +1485,6 @@
"immer": true "immer": true
} }
}, },
"@metamask/permission-controller>@metamask/controller-utils": {
"globals": {
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/permission-controller>@metamask/controller-utils>@metamask/utils": true,
"@spruceid/siwe-parser": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/permission-controller>@metamask/controller-utils>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/utils>superstruct": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true
}
},
"@metamask/permission-controller>nanoid": { "@metamask/permission-controller>nanoid": {
"globals": { "globals": {
"crypto.getRandomValues": true "crypto.getRandomValues": true
@ -1492,8 +1496,8 @@
}, },
"packages": { "packages": {
"@metamask/base-controller": true, "@metamask/base-controller": true,
"@metamask/controller-utils>isomorphic-fetch": true,
"@metamask/phishing-controller>@metamask/controller-utils": true, "@metamask/phishing-controller>@metamask/controller-utils": true,
"@metamask/phishing-controller>isomorphic-fetch": true,
"@metamask/phishing-warning>eth-phishing-detect": true, "@metamask/phishing-warning>eth-phishing-detect": true,
"punycode": true "punycode": true
} }
@ -1505,7 +1509,7 @@
"setTimeout": true "setTimeout": true
}, },
"packages": { "packages": {
"@metamask/controller-utils>isomorphic-fetch": true, "@metamask/phishing-controller>isomorphic-fetch": true,
"browserify>buffer": true, "browserify>buffer": true,
"eslint>fast-deep-equal": true, "eslint>fast-deep-equal": true,
"eth-ens-namehash": true, "eth-ens-namehash": true,
@ -1513,6 +1517,25 @@
"ethjs>ethjs-unit": true "ethjs>ethjs-unit": true
} }
}, },
"@metamask/phishing-controller>isomorphic-fetch": {
"globals": {
"fetch.bind": true
},
"packages": {
"@metamask/phishing-controller>isomorphic-fetch>whatwg-fetch": true
}
},
"@metamask/phishing-controller>isomorphic-fetch>whatwg-fetch": {
"globals": {
"Blob": true,
"FileReader": true,
"FormData": true,
"URLSearchParams.prototype.isPrototypeOf": true,
"XMLHttpRequest": true,
"define": true,
"setTimeout": true
}
},
"@metamask/phishing-warning>eth-phishing-detect": { "@metamask/phishing-warning>eth-phishing-detect": {
"packages": { "packages": {
"eslint>optionator>fast-levenshtein": true "eslint>optionator>fast-levenshtein": true
@ -1665,13 +1688,28 @@
"@ethersproject/bignumber": true, "@ethersproject/bignumber": true,
"@ethersproject/providers": true, "@ethersproject/providers": true,
"@metamask/base-controller": true, "@metamask/base-controller": true,
"@metamask/controller-utils": true, "@metamask/phishing-controller>isomorphic-fetch": true,
"@metamask/controller-utils>isomorphic-fetch": true, "@metamask/smart-transactions-controller>@metamask/controller-utils": true,
"@metamask/smart-transactions-controller>bignumber.js": true, "@metamask/smart-transactions-controller>bignumber.js": true,
"fast-json-patch": true, "fast-json-patch": true,
"lodash": true "lodash": true
} }
}, },
"@metamask/smart-transactions-controller>@metamask/controller-utils": {
"globals": {
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/phishing-controller>isomorphic-fetch": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/smart-transactions-controller>@metamask/controllers>nanoid": { "@metamask/smart-transactions-controller>@metamask/controllers>nanoid": {
"globals": { "globals": {
"crypto.getRandomValues": true "crypto.getRandomValues": true
@ -2183,24 +2221,6 @@
"define": true "define": true
} }
}, },
"@spruceid/siwe-parser": {
"globals": {
"console.error": true,
"console.log": true
},
"packages": {
"@spruceid/siwe-parser>apg-js": true
}
},
"@spruceid/siwe-parser>apg-js": {
"globals": {
"mode": true
},
"packages": {
"browserify>buffer": true,
"browserify>insert-module-globals>is-buffer": true
}
},
"@storybook/api>regenerator-runtime": { "@storybook/api>regenerator-runtime": {
"globals": { "globals": {
"regeneratorRuntime": "write" "regeneratorRuntime": "write"

View File

@ -661,7 +661,7 @@
"@metamask/address-book-controller": { "@metamask/address-book-controller": {
"packages": { "packages": {
"@metamask/address-book-controller>@metamask/base-controller": true, "@metamask/address-book-controller>@metamask/base-controller": true,
"@metamask/controller-utils": true "@metamask/address-book-controller>@metamask/controller-utils": true
} }
}, },
"@metamask/address-book-controller>@metamask/base-controller": { "@metamask/address-book-controller>@metamask/base-controller": {
@ -669,6 +669,21 @@
"immer": true "immer": true
} }
}, },
"@metamask/address-book-controller>@metamask/controller-utils": {
"globals": {
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/phishing-controller>isomorphic-fetch": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/announcement-controller": { "@metamask/announcement-controller": {
"packages": { "packages": {
"@metamask/announcement-controller>@metamask/base-controller": true "@metamask/announcement-controller>@metamask/base-controller": true
@ -680,6 +695,9 @@
} }
}, },
"@metamask/approval-controller": { "@metamask/approval-controller": {
"globals": {
"console.log": true
},
"packages": { "packages": {
"@metamask/approval-controller>nanoid": true, "@metamask/approval-controller>nanoid": true,
"@metamask/base-controller": true, "@metamask/base-controller": true,
@ -747,7 +765,7 @@
"setTimeout": true "setTimeout": true
}, },
"packages": { "packages": {
"@metamask/controller-utils>isomorphic-fetch": true, "@metamask/phishing-controller>isomorphic-fetch": true,
"browserify>buffer": true, "browserify>buffer": true,
"eslint>fast-deep-equal": true, "eslint>fast-deep-equal": true,
"eth-ens-namehash": true, "eth-ens-namehash": true,
@ -791,7 +809,8 @@
"setTimeout": true "setTimeout": true
}, },
"packages": { "packages": {
"@metamask/controller-utils>isomorphic-fetch": true, "@metamask/controller-utils>@metamask/utils": true,
"@metamask/controller-utils>@spruceid/siwe-parser": true,
"browserify>buffer": true, "browserify>buffer": true,
"eslint>fast-deep-equal": true, "eslint>fast-deep-equal": true,
"eth-ens-namehash": true, "eth-ens-namehash": true,
@ -799,23 +818,34 @@
"ethjs>ethjs-unit": true "ethjs>ethjs-unit": true
} }
}, },
"@metamask/controller-utils>isomorphic-fetch": { "@metamask/controller-utils>@metamask/utils": {
"globals": { "globals": {
"fetch.bind": true "TextDecoder": true,
"TextEncoder": true
}, },
"packages": { "packages": {
"@metamask/controller-utils>isomorphic-fetch>whatwg-fetch": true "@metamask/utils>superstruct": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true
} }
}, },
"@metamask/controller-utils>isomorphic-fetch>whatwg-fetch": { "@metamask/controller-utils>@spruceid/siwe-parser": {
"globals": { "globals": {
"Blob": true, "console.error": true,
"FileReader": true, "console.log": true
"FormData": true, },
"URLSearchParams.prototype.isPrototypeOf": true, "packages": {
"XMLHttpRequest": true, "@metamask/controller-utils>@spruceid/siwe-parser>apg-js": true
"define": true, }
"setTimeout": true },
"@metamask/controller-utils>@spruceid/siwe-parser>apg-js": {
"globals": {
"mode": true
},
"packages": {
"browserify>buffer": true,
"browserify>insert-module-globals>is-buffer": true
} }
}, },
"@metamask/controllers>nanoid": { "@metamask/controllers>nanoid": {
@ -1171,8 +1201,8 @@
"setInterval": true "setInterval": true
}, },
"packages": { "packages": {
"@metamask/controller-utils": true,
"@metamask/gas-fee-controller>@metamask/base-controller": true, "@metamask/gas-fee-controller>@metamask/base-controller": true,
"@metamask/gas-fee-controller>@metamask/controller-utils": true,
"eth-query": true, "eth-query": true,
"ethereumjs-util": true, "ethereumjs-util": true,
"ethjs>ethjs-unit": true, "ethjs>ethjs-unit": true,
@ -1184,6 +1214,21 @@
"immer": true "immer": true
} }
}, },
"@metamask/gas-fee-controller>@metamask/controller-utils": {
"globals": {
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/phishing-controller>isomorphic-fetch": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/jazzicon": { "@metamask/jazzicon": {
"globals": { "globals": {
"document.createElement": true, "document.createElement": true,
@ -1282,8 +1327,8 @@
}, },
"@metamask/message-manager": { "@metamask/message-manager": {
"packages": { "packages": {
"@metamask/controller-utils": true,
"@metamask/message-manager>@metamask/base-controller": true, "@metamask/message-manager>@metamask/base-controller": true,
"@metamask/message-manager>@metamask/controller-utils": true,
"@metamask/message-manager>jsonschema": true, "@metamask/message-manager>jsonschema": true,
"browserify>buffer": true, "browserify>buffer": true,
"browserify>events": true, "browserify>events": true,
@ -1297,34 +1342,6 @@
"immer": true "immer": true
} }
}, },
"@metamask/message-manager>@metamask/controller-utils": {
"globals": {
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/message-manager>@metamask/controller-utils>@metamask/utils": true,
"@spruceid/siwe-parser": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/message-manager>@metamask/controller-utils>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/utils>superstruct": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true
}
},
"@metamask/message-manager>jsonschema": { "@metamask/message-manager>jsonschema": {
"packages": { "packages": {
"browserify>url": true "browserify>url": true
@ -1355,8 +1372,8 @@
"console.error": true "console.error": true
}, },
"packages": { "packages": {
"@metamask/controller-utils": true,
"@metamask/permission-controller>@metamask/base-controller": true, "@metamask/permission-controller>@metamask/base-controller": true,
"@metamask/permission-controller>@metamask/controller-utils": true,
"@metamask/permission-controller>nanoid": true, "@metamask/permission-controller>nanoid": true,
"deep-freeze-strict": true, "deep-freeze-strict": true,
"eth-rpc-errors": true, "eth-rpc-errors": true,
@ -1369,34 +1386,6 @@
"immer": true "immer": true
} }
}, },
"@metamask/permission-controller>@metamask/controller-utils": {
"globals": {
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/permission-controller>@metamask/controller-utils>@metamask/utils": true,
"@spruceid/siwe-parser": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/permission-controller>@metamask/controller-utils>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/utils>superstruct": true,
"browserify>buffer": true,
"nock>debug": true,
"semver": true
}
},
"@metamask/permission-controller>nanoid": { "@metamask/permission-controller>nanoid": {
"globals": { "globals": {
"crypto.getRandomValues": true "crypto.getRandomValues": true
@ -1408,8 +1397,8 @@
}, },
"packages": { "packages": {
"@metamask/base-controller": true, "@metamask/base-controller": true,
"@metamask/controller-utils>isomorphic-fetch": true,
"@metamask/phishing-controller>@metamask/controller-utils": true, "@metamask/phishing-controller>@metamask/controller-utils": true,
"@metamask/phishing-controller>isomorphic-fetch": true,
"@metamask/phishing-warning>eth-phishing-detect": true, "@metamask/phishing-warning>eth-phishing-detect": true,
"punycode": true "punycode": true
} }
@ -1421,7 +1410,7 @@
"setTimeout": true "setTimeout": true
}, },
"packages": { "packages": {
"@metamask/controller-utils>isomorphic-fetch": true, "@metamask/phishing-controller>isomorphic-fetch": true,
"browserify>buffer": true, "browserify>buffer": true,
"eslint>fast-deep-equal": true, "eslint>fast-deep-equal": true,
"eth-ens-namehash": true, "eth-ens-namehash": true,
@ -1429,6 +1418,25 @@
"ethjs>ethjs-unit": true "ethjs>ethjs-unit": true
} }
}, },
"@metamask/phishing-controller>isomorphic-fetch": {
"globals": {
"fetch.bind": true
},
"packages": {
"@metamask/phishing-controller>isomorphic-fetch>whatwg-fetch": true
}
},
"@metamask/phishing-controller>isomorphic-fetch>whatwg-fetch": {
"globals": {
"Blob": true,
"FileReader": true,
"FormData": true,
"URLSearchParams.prototype.isPrototypeOf": true,
"XMLHttpRequest": true,
"define": true,
"setTimeout": true
}
},
"@metamask/phishing-warning>eth-phishing-detect": { "@metamask/phishing-warning>eth-phishing-detect": {
"packages": { "packages": {
"eslint>optionator>fast-levenshtein": true "eslint>optionator>fast-levenshtein": true
@ -1492,13 +1500,28 @@
"@ethersproject/bignumber": true, "@ethersproject/bignumber": true,
"@ethersproject/providers": true, "@ethersproject/providers": true,
"@metamask/base-controller": true, "@metamask/base-controller": true,
"@metamask/controller-utils": true, "@metamask/phishing-controller>isomorphic-fetch": true,
"@metamask/controller-utils>isomorphic-fetch": true, "@metamask/smart-transactions-controller>@metamask/controller-utils": true,
"@metamask/smart-transactions-controller>bignumber.js": true, "@metamask/smart-transactions-controller>bignumber.js": true,
"fast-json-patch": true, "fast-json-patch": true,
"lodash": true "lodash": true
} }
}, },
"@metamask/smart-transactions-controller>@metamask/controller-utils": {
"globals": {
"console.error": true,
"fetch": true,
"setTimeout": true
},
"packages": {
"@metamask/phishing-controller>isomorphic-fetch": true,
"browserify>buffer": true,
"eslint>fast-deep-equal": true,
"eth-ens-namehash": true,
"ethereumjs-util": true,
"ethjs>ethjs-unit": true
}
},
"@metamask/smart-transactions-controller>@metamask/controllers>nanoid": { "@metamask/smart-transactions-controller>@metamask/controllers>nanoid": {
"globals": { "globals": {
"crypto.getRandomValues": true "crypto.getRandomValues": true
@ -1770,24 +1793,6 @@
"define": true "define": true
} }
}, },
"@spruceid/siwe-parser": {
"globals": {
"console.error": true,
"console.log": true
},
"packages": {
"@spruceid/siwe-parser>apg-js": true
}
},
"@spruceid/siwe-parser>apg-js": {
"globals": {
"mode": true
},
"packages": {
"browserify>buffer": true,
"browserify>insert-module-globals>is-buffer": true
}
},
"@storybook/api>regenerator-runtime": { "@storybook/api>regenerator-runtime": {
"globals": { "globals": {
"regeneratorRuntime": "write" "regeneratorRuntime": "write"

View File

@ -231,7 +231,7 @@
"@metamask/assets-controllers": "^4.0.1", "@metamask/assets-controllers": "^4.0.1",
"@metamask/base-controller": "^1.0.0", "@metamask/base-controller": "^1.0.0",
"@metamask/contract-metadata": "^2.3.1", "@metamask/contract-metadata": "^2.3.1",
"@metamask/controller-utils": "^1.0.0", "@metamask/controller-utils": "^3.1.0",
"@metamask/design-tokens": "^1.9.0", "@metamask/design-tokens": "^1.9.0",
"@metamask/desktop": "^0.3.0", "@metamask/desktop": "^0.3.0",
"@metamask/eth-json-rpc-infura": "^8.0.0", "@metamask/eth-json-rpc-infura": "^8.0.0",
@ -245,7 +245,7 @@
"@metamask/jazzicon": "^2.0.0", "@metamask/jazzicon": "^2.0.0",
"@metamask/key-tree": "^7.0.0", "@metamask/key-tree": "^7.0.0",
"@metamask/logo": "^3.1.1", "@metamask/logo": "^3.1.1",
"@metamask/message-manager": "^2.0.0", "@metamask/message-manager": "^2.1.0",
"@metamask/metamask-eth-abis": "^3.0.0", "@metamask/metamask-eth-abis": "^3.0.0",
"@metamask/notification-controller": "^1.0.0", "@metamask/notification-controller": "^1.0.0",
"@metamask/obs-store": "^8.0.0", "@metamask/obs-store": "^8.0.0",
@ -273,7 +273,6 @@
"@sentry/integrations": "^6.0.0", "@sentry/integrations": "^6.0.0",
"@sentry/types": "^6.0.1", "@sentry/types": "^6.0.1",
"@sentry/utils": "^6.0.1", "@sentry/utils": "^6.0.1",
"@spruceid/siwe-parser": "^1.1.3",
"@truffle/codec": "^0.14.12", "@truffle/codec": "^0.14.12",
"@truffle/decoder": "^5.3.5", "@truffle/decoder": "^5.3.5",
"@zxing/browser": "^0.0.10", "@zxing/browser": "^0.0.10",

View File

@ -1,55 +1,3 @@
import { ParsedMessage } from '@spruceid/siwe-parser';
import log from 'loglevel';
import { stripHexPrefix } from './hexstring-utils';
const msgHexToText = (hex) => {
try {
const stripped = stripHexPrefix(hex);
const buff = Buffer.from(stripped, 'hex');
return buff.length === 32 ? hex : buff.toString('utf8');
} catch (e) {
log.error(e);
return hex;
}
};
/**
* A locally defined object used to provide data to identify a Sign-In With Ethereum (SIWE)(EIP-4361) message and provide the parsed message
*
* @typedef localSIWEObject
* @param {boolean} isSIWEMessage - Does the intercepted message conform to the SIWE specification?
* @param {ParsedMessage} parsedMessage - The data parsed out of the message
*/
/**
* This function intercepts a sign message, detects if it's a
* Sign-In With Ethereum (SIWE)(EIP-4361) message, and returns an object with
* relevant SIWE data.
*
* {@see {@link https://eips.ethereum.org/EIPS/eip-4361}}
*
* @param {object} msgParams - The params of the message to sign
* @returns {localSIWEObject}
*/
export const detectSIWE = (msgParams) => {
try {
const { data } = msgParams;
const message = msgHexToText(data);
const parsedMessage = new ParsedMessage(message);
return {
isSIWEMessage: true,
parsedMessage,
};
} catch (error) {
// ignore error, it's not a valid SIWE message
return {
isSIWEMessage: false,
parsedMessage: null,
};
}
};
/** /**
* Takes in a parsed Sign-In with Ethereum Message (EIP-4361) * Takes in a parsed Sign-In with Ethereum Message (EIP-4361)
* and generates an array of label-value pairs * and generates an array of label-value pairs

View File

@ -4036,18 +4036,18 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@metamask/message-manager@npm:^2.0.0": "@metamask/message-manager@npm:^2.1.0":
version: 2.0.0 version: 2.1.0
resolution: "@metamask/message-manager@npm:2.0.0" resolution: "@metamask/message-manager@npm:2.1.0"
dependencies: dependencies:
"@metamask/base-controller": ^2.0.0 "@metamask/base-controller": ^2.0.0
"@metamask/controller-utils": ^3.0.0 "@metamask/controller-utils": ^3.1.0
"@types/uuid": ^8.3.0 "@types/uuid": ^8.3.0
eth-sig-util: ^3.0.0 eth-sig-util: ^3.0.0
ethereumjs-util: ^7.0.10 ethereumjs-util: ^7.0.10
jsonschema: ^1.2.4 jsonschema: ^1.2.4
uuid: ^8.3.2 uuid: ^8.3.2
checksum: f130b5c58fbbb5ccd69da32cfa43839a09dec906974c6d0f6e2d46f15d1a872c564b0c880aac2979b7ffc8d00bcf328bf1989cb133cc41bc612e1e6e16ef9ef5 checksum: f3a233a84aec73051f8f1183dab32c4d9a976edaa3c6461b118a8e6f20cf43f8757827ad6c877aed635ef850944ce054af03b34592f5b72f5d0667fa8b179dc9
languageName: node languageName: node
linkType: hard linkType: hard
@ -5117,7 +5117,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@spruceid/siwe-parser@npm:1.1.3, @spruceid/siwe-parser@npm:^1.1.3": "@spruceid/siwe-parser@npm:1.1.3":
version: 1.1.3 version: 1.1.3
resolution: "@spruceid/siwe-parser@npm:1.1.3" resolution: "@spruceid/siwe-parser@npm:1.1.3"
dependencies: dependencies:
@ -24283,7 +24283,7 @@ __metadata:
"@metamask/auto-changelog": ^2.1.0 "@metamask/auto-changelog": ^2.1.0
"@metamask/base-controller": ^1.0.0 "@metamask/base-controller": ^1.0.0
"@metamask/contract-metadata": ^2.3.1 "@metamask/contract-metadata": ^2.3.1
"@metamask/controller-utils": ^1.0.0 "@metamask/controller-utils": ^3.1.0
"@metamask/design-tokens": ^1.9.0 "@metamask/design-tokens": ^1.9.0
"@metamask/desktop": ^0.3.0 "@metamask/desktop": ^0.3.0
"@metamask/eslint-config": ^9.0.0 "@metamask/eslint-config": ^9.0.0
@ -24303,7 +24303,7 @@ __metadata:
"@metamask/jazzicon": ^2.0.0 "@metamask/jazzicon": ^2.0.0
"@metamask/key-tree": ^7.0.0 "@metamask/key-tree": ^7.0.0
"@metamask/logo": ^3.1.1 "@metamask/logo": ^3.1.1
"@metamask/message-manager": ^2.0.0 "@metamask/message-manager": ^2.1.0
"@metamask/metamask-eth-abis": ^3.0.0 "@metamask/metamask-eth-abis": ^3.0.0
"@metamask/notification-controller": ^1.0.0 "@metamask/notification-controller": ^1.0.0
"@metamask/obs-store": ^8.0.0 "@metamask/obs-store": ^8.0.0
@ -24334,7 +24334,6 @@ __metadata:
"@sentry/integrations": ^6.0.0 "@sentry/integrations": ^6.0.0
"@sentry/types": ^6.0.1 "@sentry/types": ^6.0.1
"@sentry/utils": ^6.0.1 "@sentry/utils": ^6.0.1
"@spruceid/siwe-parser": ^1.1.3
"@storybook/addon-a11y": ^6.5.13 "@storybook/addon-a11y": ^6.5.13
"@storybook/addon-actions": ^6.5.13 "@storybook/addon-actions": ^6.5.13
"@storybook/addon-essentials": ^6.5.13 "@storybook/addon-essentials": ^6.5.13