콘텐츠로 이동

기기 고유 식별자 획득

DoveRunner Mobile App Security SDK는 각 기기에 대한 고유 식별자를 생성하고 관리합니다. DoveRunner Mobile App Security SDK를 사용하는 고객은 필요한 경우 DoveRunner Mobile App Security의 인터페이스를 사용하여 기기 고유 식별자를 확인할 수 있습니다. 그리고 DoveRunner Mobile App Security에서 제공하는 해킹 데이터 서비스를 사용하는 비즈니스에 사용할 수 있습니다.

import React, {useEffect, useState} from 'react';
import {View, Text, Alert, Button, NativeModules} from 'react-native';
const {AppSealingModule} = NativeModules;
const getDeviceId = async () => {
try {
const deviceId = await AppSealingModule.getDeviceId();
return deviceId;
} catch (error) {
console.error('기기 ID 획득 오류:', error);
return null;
}
};
const DeviceIdDisplay = () => {
const [deviceId, setDeviceId] = useState('');
useEffect(() => {
fetchDeviceId();
}, []);
const fetchDeviceId = async () => {
const id = await getDeviceId();
if (id) {
setDeviceId(id);
}
};
const showDeviceIdAlert = () => {
Alert.alert(
'DoveRunner Mobile App Security 기기 ID',
deviceId,
[{text: '확인', style: 'default'}],
{cancelable: false}
);
};
return (
<View style={{padding: 20}}>
<Text style={{fontSize: 16, marginBottom: 10}}>
기기 ID: {deviceId}
</Text>
<Button
title="기기 ID 알림 표시"
onPress={showDeviceIdAlert}
/>
</View>
);
};
import {useEffect, useState} from 'react';
import {NativeModules} from 'react-native';
const useAppSealingDeviceId = () => {
const [deviceId, setDeviceId] = useState(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
useEffect(() => {
const fetchDeviceId = async () => {
try {
const {AppSealingModule} = NativeModules;
const id = await AppSealingModule.getDeviceId();
setDeviceId(id);
} catch (err) {
setError(err);
} finally {
setLoading(false);
}
};
fetchDeviceId();
}, []);
return {deviceId, loading, error};
};
// 사용 예시
const MyComponent = () => {
const {deviceId, loading, error} = useAppSealingDeviceId();
if (loading) return <Text>기기 ID 로딩 중...</Text>;
if (error) return <Text>오류: {error.message}</Text>;
return <Text>기기 ID: {deviceId}</Text>;
};
#import <React/RCTBridgeModule.h>
@interface AppSealingModule : NSObject <RCTBridgeModule>
@end
#import "AppSealingModule.h"
#import "AppsealingiOS.h"
@implementation AppSealingModule
RCT_EXPORT_MODULE();
RCT_EXPORT_METHOD(getDeviceId:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject)
{
char appSealingDeviceID[64] = {0};
if (ObjC_GetAppSealingDeviceID(appSealingDeviceID) == 0) {
NSString *deviceIdString = [NSString stringWithUTF8String:appSealingDeviceID];
resolve(deviceIdString);
} else {
NSError *error = [NSError errorWithDomain:@"AppSealingError"
code:-1
userInfo:@{NSLocalizedDescriptionKey: @"기기 ID 획득 실패"}];
reject(@"GET_DEVICE_ID_ERROR", @"기기 ID를 획득할 수 없습니다", error);
}
}
RCT_EXPORT_METHOD(getDeviceIdSync:(RCTResponseSenderBlock)callback)
{
char appSealingDeviceID[64] = {0};
if (ObjC_GetAppSealingDeviceID(appSealingDeviceID) == 0) {
NSString *deviceIdString = [NSString stringWithUTF8String:appSealingDeviceID];
callback(@[[NSNull null], deviceIdString]);
} else {
callback(@[@"기기 ID 획득 실패", [NSNull null]]);
}
}
@end
import {useEffect} from 'react';
import {NativeModules} from 'react-native';
const AppInitializer = () => {
useEffect(() => {
const initializeApp = async () => {
try {
const {AppSealingModule} = NativeModules;
const deviceId = await AppSealingModule.getDeviceId();
// 분석 도구에 기기 ID 전송
console.log('DoveRunner Mobile App Security 기기 ID:', deviceId);
// 서버에 기기 ID 등록 (선택사항)
// await registerDeviceId(deviceId);
} catch (error) {
console.error('앱 초기화 중 오류:', error);
}
};
initializeApp();
}, []);
return null;
};
import React, {useState} from 'react';
import {Modal, View, Text, TouchableOpacity, StyleSheet} from 'react-native';
const DeviceIdModal = ({visible, deviceId, onClose}) => {
return (
<Modal
visible={visible}
transparent={true}
animationType="fade"
onRequestClose={onClose}>
<View style={styles.overlay}>
<View style={styles.modal}>
<Text style={styles.title}>기기 식별자</Text>
<Text style={styles.deviceId}>{deviceId}</Text>
<TouchableOpacity style={styles.button} onPress={onClose}>
<Text style={styles.buttonText}>확인</Text>
</TouchableOpacity>
</View>
</View>
</Modal>
);
};
const styles = StyleSheet.create({
overlay: {
flex: 1,
backgroundColor: 'rgba(0, 0, 0, 0.5)',
justifyContent: 'center',
alignItems: 'center',
},
modal: {
backgroundColor: 'white',
padding: 20,
borderRadius: 10,
minWidth: 300,
},
title: {
fontSize: 18,
fontWeight: 'bold',
textAlign: 'center',
marginBottom: 15,
},
deviceId: {
fontSize: 14,
textAlign: 'center',
backgroundColor: '#f0f0f0',
padding: 10,
borderRadius: 5,
marginBottom: 15,
fontFamily: 'monospace',
},
button: {
backgroundColor: '#007AFF',
padding: 12,
borderRadius: 5,
alignItems: 'center',
},
buttonText: {
color: 'white',
fontSize: 16,
fontWeight: 'bold',
},
});

획득한 기기 고유 식별자는 다음과 같은 용도로 사용할 수 있습니다:

  • 사용자 기기 추적: 각 사용자의 기기를 고유하게 식별
  • 보안 분석: 해킹 시도와 기기 간의 상관관계 분석
  • 고객 지원: 사용자 문의 시 기기 특정
  • 사용 패턴 분석: 기기별 앱 사용 패턴 추적
  • A/B 테스팅: 기기 단위로 실험 그룹 분할
  • 기기 ID는 앱 재설치 시에도 동일하게 유지됩니다
  • 이 식별자는 개인정보보호 규정을 준수하여 사용해야 합니다
  • 기기 ID는 DoveRunner Mobile App Security 서비스 전반에서 일관되게 사용됩니다
  • 네트워크 오류나 SDK 초기화 실패 시 기기 ID 획득이 실패할 수 있습니다