Class: AiRootShield::Platform::AndroidSecurityModule

Inherits:
Object
  • Object
show all
Defined in:
lib/ai_root_shield/platform/android_security_module.rb

Overview

Android-specific security module with SafetyNet and Play Integrity API integration

Constant Summary collapse

SAFETYNET_SUCCESS =

SafetyNet API response codes

'SUCCESS'
SAFETYNET_NETWORK_ERROR =
'NETWORK_ERROR'
SAFETYNET_API_NOT_AVAILABLE =
'API_NOT_AVAILABLE'
PLAY_INTEGRITY_MEETS_DEVICE_INTEGRITY =

Play Integrity API verdict types

'MEETS_DEVICE_INTEGRITY'
PLAY_INTEGRITY_MEETS_BASIC_INTEGRITY =
'MEETS_BASIC_INTEGRITY'
PLAY_INTEGRITY_MEETS_STRONG_INTEGRITY =
'MEETS_STRONG_INTEGRITY'

Instance Method Summary collapse

Constructor Details

#initialize(api_key: nil, package_name: nil) ⇒ AndroidSecurityModule

Returns a new instance of AndroidSecurityModule.



21
22
23
24
25
# File 'lib/ai_root_shield/platform/android_security_module.rb', line 21

def initialize(api_key: nil, package_name: nil)
  @api_key = api_key
  @package_name = package_name
  @cache = {}
end

Instance Method Details

#analyze_device_security(device_logs) ⇒ Object

Analyze Android device security using SafetyNet and Play Integrity APIs



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/ai_root_shield/platform/android_security_module.rb', line 28

def analyze_device_security(device_logs)
  results = {
    safetynet: analyze_safetynet(device_logs),
    play_integrity: analyze_play_integrity(device_logs),
    hardware_security: analyze_hardware_security(device_logs),
    system_integrity: analyze_system_integrity(device_logs),
    risk_factors: [],
    risk_score: 0
  }
  
  calculate_android_risk_score(results)
  results
end