1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-25 03:20:23 +01:00
metamask-extension/shared/modules/security-provider.utils.ts

20 lines
601 B
TypeScript
Raw Normal View History

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;
}