Skip to content

API Reference

Main SDK class providing core functionality. All methods are static. Getters throw AlphynException if the SDK is not initialized or the operation fails (getCode() returns codes such as SDK_NOT_INITIALIZED, INVALID_PARAMETER, OPERATION_FAILED).

initialize(Context context)

  • Description: Initializes the SDK keyless - the recommended mode for production. The app’s attestation identity is the SHA-256 of its signing certificate, which is stable across builds signed with the same key.
  • Returns: AlphynSDK instance (for call chaining)
  • Throws: IllegalArgumentException if parameters are null or invalid
  • Thread: Call from main thread

initialize(Context context, String applicationKey)

  • Description: Initializes the SDK with a development-only debug hash obtained from the Alphyn Portal. Do not use in production - a supplied value overrides the app’s attestation hash.
  • Throws: IllegalArgumentException if parameters are null or invalid

setInterval(float interval)

  • Description: Sets the background scan interval in minutes (default 0.75 = 45 seconds). Call before initialize for chaining: AlphynSDK.setInterval(1.0f).initialize(context);
  • Returns: AlphynSDK instance

isInitialized()

  • Returns: boolean - true if initialized, false otherwise
  • Thread: Thread-safe

addSecurityListener(AlphynSecurityListener listener) / removeSecurityListener(AlphynSecurityListener listener)

  • Description: Adds/removes a security event listener (callbacks are delivered on the main thread)
  • Thread: Thread-safe
MethodReturnsDescription
getScanResult()StringLatest security scan result summary
getAppHash()StringApp integrity hash (whole-APK SHA-256 in keyless mode)
getDeviceId()StringPersistent unique device identifier
getModules()StringJSON array of active security modules (e.g. ["ROOT-V1", ...])
getAllRiskFactors()List<String>All detected risk factors
getLastScanDate()StringTimestamp of the last scan (e.g. "2025-09-18 12:55:01")
getRejectReasons()StringDetected rejection reasons
getAllScanResults() / getAllScanResults(Date, Date)List<String>Historical scan results, optionally date-filtered
MethodReturnsDescription
enableScreenshotProtection(Activity) / disableScreenshotProtection(Activity) / isScreenshotProtectionEnabled(Activity)booleanToggle/query screenshot protection (FLAG_SECURE)
enableOverlayProtection(Activity) / disableOverlayProtection(Activity)booleanToggle protection against overlay attacks
isOverlayProtectionAvailable() / isOverlayProtectionAvailable(Context)booleanAvailability check (requires Android 12+ / API 31)

High-risk actions are verified with signAction, which signs the transaction with a hardware-backed key belonging to an enrolled user and returns a short-lived token your backend validates server-side. See MFA Transaction Signing for the three-call flow, and MFA on Android for the signatures.

Interface for receiving security events from the SDK.

onSuccess(AlphynCallbackResult result)

  • Description: Called when any operation completes successfully
  • Parameters: result - Details about the successful operation
  • Thread: Main thread

onFailure(AlphynCallbackResult result)

  • Description: Called when any operation fails
  • Parameters: result - Details about the failed operation and error information
  • Thread: Main thread

onThreatDetected(AlphynCallbackResult result)

  • Description: Called when a security threat is detected
  • Parameters: result - Details about the detected threat
  • Thread: Main thread

Contains detailed information about SDK operations and events.

OperationType

  • INITIALIZATION - SDK initialization operations
  • SECURITY_SCAN - Security scanning operations
  • SCAN_RESPONSE - Scan result operations
  • NETWORK - Network-related operations
  • STORAGE - Secure storage operations
  • CALLBACK - Callback system operations

OperationResult

  • SUCCESS - Operation completed successfully
  • FAILURE - Operation failed
  • THREAT_DETECTED - Security threat identified

getOperationType()

  • Returns: OperationType - Type of operation that triggered this result

getOperationResult()

  • Returns: OperationResult - Result status of the operation

getOriginalEventType()

  • Returns: AlphynEventType - Original event type from the SDK

getMessage()

  • Returns: String - Human-readable message describing the event

getDetails()

  • Returns: String - Additional details about the event

getScanResult()

  • Returns: AlphynScanResult - Scan result enum (only for scan response events) !!! info

    isInitialization() - Returns true if this is an initialization event

    isSecurityScan() - Returns true if this is a security scan event

    isScanResponse() - Returns true if this is a scan response event

    isNetwork() - Returns true if this is a network event

    isStorage() - Returns true if this is a storage event

    isCallback() - Returns true if this is a callback event

    isSuccess() - Returns true if the operation was successful

    isFailure() - Returns true if the operation failed

    isThreatDetected() - Returns true if a threat was detected

Enumeration of possible security scan results. !!! tip ### Values

**`TRUSTED`** - Application passed all security checks
**`FLAGGED`** - Application has potential security concerns
**`UNTRUSTED`** - Application failed critical security checks
**`UNKNOWN`** - Scan result unclear or invalid
**`INITIALIZATION_ERROR`** - SDK initialization failed

fromString(String value)

  • Description: Converts string value to AlphynScanResult enum
  • Parameters: value - String representation of scan result
  • Returns: AlphynScanResult - Corresponding enum value or UNKNOWN

getDisplayName()

  • Returns: String - Human-readable display name

getEmoji()

  • Returns: String - Emoji representation for UI display

isThreat()

  • Returns: boolean - True if result indicates a security threat

isCriticalThreat()

  • Returns: boolean - True if result indicates a critical threat

Enumeration of all possible SDK events.

  • INIT_COMPLETE - SDK initialization completed successfully
  • INIT_FAILED - SDK initialization failed
  • FIRST_INIT - First-time initialization
  • INVALID_APP_KEY - Invalid application key provided
  • THREAT_DETECTED - Security threat identified
  • SECURE_DEVICE - Device verified as secure
  • INVALID_DATE_OR_TIME - Device date/time is invalid
  • SCAN_SUCCESS - Security scan completed successfully
  • SCAN_RESPONSE - Scan results are available
  • SCAN_FAILED - Security scan failed
  • RISK_FACTOR_DETECTED - A risk factor was detected during a scan
  • NETWORK_INIT - Network initialization
  • NETWORK_MTLS - Mutual TLS connection established
  • JWT_AUTH_SUCCESS - JWT authentication successful
  • NETWORK_ERROR - Network connectivity error
  • AUTH_FAILED - Authentication failed
  • REQUEST_FAILED - API request failed
  • KEYSTORE_SUCCESS - Keystore operation successful
  • KEYSTORE_FAILED - Keystore operation failed
  • KEY_EXCHANGE_SUCCESS - Key exchange completed
  • KEYS_FOUND_STORAGE - Existing keys found in storage
  • KEYS_CREATED_NEW - New keys created
  • CALLBACK_SUCCESS - Callback operation successful
  • CALLBACK_FAILED - Callback operation failed