Advanced Features
Get All Risk Factors
Section titled “Get All Risk Factors”import { AlphynSDK } from '@alphyn/react-native-sdk';
const riskFactors = await AlphynSDK.getAllRiskFactors();console.log('Risk Factors:', riskFactors);Get All Scan Results with Date Filtering
Section titled “Get All Scan Results with Date Filtering”const allResults = await AlphynSDK.getAllScanResults();
const yesterday = new Date(Date.now() - 24 * 60 * 60 * 1000);const recentResults = await AlphynSDK.getAllScanResults(yesterday, new Date());
console.log('All Results:', allResults);console.log('Recent Results:', recentResults);Update Scan Interval
Section titled “Update Scan Interval”The public interval update helper is Android-specific:
import { Platform } from 'react-native';
if (Platform.OS === 'android') { await AlphynSDK.setAndroidInterval(60);}Get Security Modules
Section titled “Get Security Modules”const modules = await AlphynSDK.getModules();console.log('Modules:', modules);Security Event Listeners
Section titled “Security Event Listeners”Cross-Platform Listener
Section titled “Cross-Platform Listener”addSecurityListener() works on both iOS and Android and accepts an AlphynSecurityListener:
import { AlphynSDK, type AlphynSecurityListener,} from '@alphyn/react-native-sdk';
const listener: AlphynSecurityListener = (event) => { console.log('Operation Type:', event.operationType); console.log('Operation Result:', event.operationResult); console.log('Original Event Type:', event.originalEventType); console.log('Message:', event.message); console.log('Details:', event.details);};
const subscription = AlphynSDK.addSecurityListener(listener);
// Latersubscription.remove();Shared Android Event Stream Helper
Section titled “Shared Android Event Stream Helper”securityEvents() is an Android-only shared helper that lets multiple AlphynSecurityListener subscribers reuse a single native listener:
const unsubscribe = AlphynSDK.securityEvents((event) => { console.log('Shared Android event:', event.originalEventType);});
// Laterunsubscribe();Remove All Listeners
Section titled “Remove All Listeners”AlphynSDK.removeAllSecurityListeners();