diff --git a/src/components/DomainWarningBanner.tsx b/src/components/DomainWarningBanner.tsx
index c88a669c..ba9faa4a 100644
--- a/src/components/DomainWarningBanner.tsx
+++ b/src/components/DomainWarningBanner.tsx
@@ -1,16 +1,23 @@
"use client";
import React, { useEffect, useState } from 'react';
-import { AlertTriangle, ShieldAlert, X } from 'lucide-react';
+import { AlertTriangle, ShieldAlert, ShieldCheck, X } from 'lucide-react';
import { PhishingProtection } from '@/utils/security/phishingProtection';
import { Alert, AlertTitle, AlertDescription } from '@/components/ui/alert';
import { Button } from '@/components/ui/button';
import { cn } from '@/lib/utils';
+const OFFICIAL_DOMAINS = [
+ 'propchain.io',
+ 'localhost',
+ '127.0.0.1',
+ '0.0.0.0',
+];
+
export const DomainWarningBanner = () => {
const [warning, setWarning] = useState<{
show: boolean;
- type: 'phishing' | 'unofficial';
+ type: 'phishing' | 'unofficial' | 'verified';
message: string;
riskScore: number;
}>({
@@ -37,7 +44,6 @@ export const DomainWarningBanner = () => {
message: 'This domain is flagged as a known phishing site. Your funds may be at risk.',
riskScore: result.riskScore,
});
- // Auto-report phishing domains
PhishingProtection.reportSuspiciousDomain(domain, 'Known phishing domain');
} else if (result.warnings.includes('Unofficial domain detected')) {
setWarning({
@@ -46,8 +52,14 @@ export const DomainWarningBanner = () => {
message: 'You are accessing PropChain from an unofficial domain. Please ensure you are on propchain.io.',
riskScore: result.riskScore,
});
- // Report unofficial domains for investigation
PhishingProtection.reportSuspiciousDomain(domain, 'Unofficial domain');
+ } else if (OFFICIAL_DOMAINS.some(d => domain === d || domain.endsWith(`.${d}`))) {
+ setWarning({
+ show: true,
+ type: 'verified',
+ message: `You are connected to the official PropChain platform (${domain}).`,
+ riskScore: 0,
+ });
}
};
@@ -57,19 +69,22 @@ export const DomainWarningBanner = () => {
if (!warning.show || isDismissed) return null;
const isPhishing = warning.type === 'phishing';
+ const isVerified = warning.type === 'verified';
return (
{isPhishing ? (
+ ) : isVerified ? (
+
) : (
)}
@@ -77,41 +92,38 @@ export const DomainWarningBanner = () => {
- {isPhishing ? "Security Alert: Phishing Detected" : "Security Warning: Unofficial Domain"}
+ {isPhishing ? "Security Alert: Phishing Detected" : isVerified ? "Verified Domain" : "Security Warning: Unofficial Domain"}
{warning.message}
+ {isPhishing && (
+
+ )}
- {!isPhishing && (
-
- )}