mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
20 lines
601 B
TypeScript
20 lines
601 B
TypeScript
|
import { Json } from '@metamask/utils';
|
||
|
import { SECURITY_PROVIDER_MESSAGE_SEVERITY } from '../constants/security-provider';
|
||
|
|
||
|
export function isSuspiciousResponse(
|
||
|
securityProviderResponse: Record<string, Json> | undefined,
|
||
|
): boolean {
|
||
|
if (!securityProviderResponse) {
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
const isFlagged =
|
||
|
securityProviderResponse.flagAsDangerous !== undefined &&
|
||
|
securityProviderResponse.flagAsDangerous !==
|
||
|
SECURITY_PROVIDER_MESSAGE_SEVERITY.NOT_MALICIOUS;
|
||
|
|
||
|
const isNotVerified = Object.keys(securityProviderResponse).length === 0;
|
||
|
|
||
|
return isFlagged || isNotVerified;
|
||
|
}
|