API Reference
AlphynSDK Class
Section titled “AlphynSDK Class”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).
Initialization
Section titled “Initialization”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:
AlphynSDKinstance (for call chaining) - Throws:
IllegalArgumentExceptionif 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:
IllegalArgumentExceptionif parameters are null or invalid
setInterval(float interval)
- Description: Sets the background scan interval in minutes (default
0.75= 45 seconds). Call beforeinitializefor chaining:AlphynSDK.setInterval(1.0f).initialize(context); - Returns:
AlphynSDKinstance
isInitialized()
- Returns:
boolean- true if initialized, false otherwise - Thread: Thread-safe
Listeners
Section titled “Listeners”addSecurityListener(AlphynSecurityListener listener) / removeSecurityListener(AlphynSecurityListener listener)
- Description: Adds/removes a security event listener (callbacks are delivered on the main thread)
- Thread: Thread-safe
Scan & Device Information
Section titled “Scan & Device Information”| Method | Returns | Description |
|---|---|---|
getScanResult() | String | Latest security scan result summary |
getAppHash() | String | App integrity hash (whole-APK SHA-256 in keyless mode) |
getDeviceId() | String | Persistent unique device identifier |
getModules() | String | JSON array of active security modules (e.g. ["ROOT-V1", ...]) |
getAllRiskFactors() | List<String> | All detected risk factors |
getLastScanDate() | String | Timestamp of the last scan (e.g. "2025-09-18 12:55:01") |
getRejectReasons() | String | Detected rejection reasons |
getAllScanResults() / getAllScanResults(Date, Date) | List<String> | Historical scan results, optionally date-filtered |
Screen Protection
Section titled “Screen Protection”| Method | Returns | Description |
|---|---|---|
enableScreenshotProtection(Activity) / disableScreenshotProtection(Activity) / isScreenshotProtectionEnabled(Activity) | boolean | Toggle/query screenshot protection (FLAG_SECURE) |
enableOverlayProtection(Activity) / disableOverlayProtection(Activity) | boolean | Toggle protection against overlay attacks |
isOverlayProtectionAvailable() / isOverlayProtectionAvailable(Context) | boolean | Availability check (requires Android 12+ / API 31) |
Action Verification
Section titled “Action Verification”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.
AlphynSecurityListener Interface
Section titled “AlphynSecurityListener Interface”Interface for receiving security events from the SDK.
Methods
Section titled “Methods”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
AlphynCallbackResult Class
Section titled “AlphynCallbackResult Class”Contains detailed information about SDK operations and events.
OperationType
INITIALIZATION- SDK initialization operationsSECURITY_SCAN- Security scanning operationsSCAN_RESPONSE- Scan result operationsNETWORK- Network-related operationsSTORAGE- Secure storage operationsCALLBACK- Callback system operations
OperationResult
SUCCESS- Operation completed successfullyFAILURE- Operation failedTHREAT_DETECTED- Security threat identified
Methods
Section titled “Methods”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) !!! infoConvenience Methods
Section titled “Convenience Methods”isInitialization()- Returns true if this is an initialization eventisSecurityScan()- Returns true if this is a security scan eventisScanResponse()- Returns true if this is a scan response eventisNetwork()- Returns true if this is a network eventisStorage()- Returns true if this is a storage eventisCallback()- Returns true if this is a callback eventisSuccess()- Returns true if the operation was successfulisFailure()- Returns true if the operation failedisThreatDetected()- Returns true if a threat was detected
AlphynScanResult Enum
Section titled “AlphynScanResult Enum”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 failedMethods
Section titled “Methods”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
AlphynEventType Enum
Section titled “AlphynEventType Enum”Enumeration of all possible SDK events.
Initialization Events
Section titled “Initialization Events”INIT_COMPLETE- SDK initialization completed successfullyINIT_FAILED- SDK initialization failedFIRST_INIT- First-time initializationINVALID_APP_KEY- Invalid application key provided
Security Events
Section titled “Security Events”THREAT_DETECTED- Security threat identifiedSECURE_DEVICE- Device verified as secureINVALID_DATE_OR_TIME- Device date/time is invalidSCAN_SUCCESS- Security scan completed successfullySCAN_RESPONSE- Scan results are availableSCAN_FAILED- Security scan failedRISK_FACTOR_DETECTED- A risk factor was detected during a scan
Network Events
Section titled “Network Events”NETWORK_INIT- Network initializationNETWORK_MTLS- Mutual TLS connection establishedJWT_AUTH_SUCCESS- JWT authentication successfulNETWORK_ERROR- Network connectivity errorAUTH_FAILED- Authentication failedREQUEST_FAILED- API request failed
Storage Events
Section titled “Storage Events”KEYSTORE_SUCCESS- Keystore operation successfulKEYSTORE_FAILED- Keystore operation failedKEY_EXCHANGE_SUCCESS- Key exchange completedKEYS_FOUND_STORAGE- Existing keys found in storageKEYS_CREATED_NEW- New keys created
Callback Events
Section titled “Callback Events”CALLBACK_SUCCESS- Callback operation successfulCALLBACK_FAILED- Callback operation failed