Skip to content

Advanced Features

import { AlphynSDK } from '@alphyn/react-native-sdk';
const riskFactors = await AlphynSDK.getAllRiskFactors();
console.log('Risk Factors:', riskFactors);
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);

The public interval update helper is Android-specific:

import { Platform } from 'react-native';
if (Platform.OS === 'android') {
await AlphynSDK.setAndroidInterval(60);
}
const modules = await AlphynSDK.getModules();
console.log('Modules:', modules);

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);
// Later
subscription.remove();

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);
});
// Later
unsubscribe();
AlphynSDK.removeAllSecurityListeners();