Skip to main content
Version: Guardian v0.5.3

Configuration Options

note

The SDK takes no API key. Authentication is handled by a short-lived JWT minted by your backend and passed to verify(). See Authentication.

GuardianOptions​

FieldTypeDefaultPlatformsDescription
failurePolicyFailurePolicyfailiOS, AndroidWhat verify() returns when the call fails. React Native does not expose this option and always uses fail.
logLevelLogLevelwarniOSLog verbosity. Android ignores this option at initialization and logs at INFO level.
collectLocationbooleanfalseiOS, AndroidGPS collection (requires the location permission)
collectWifiInfobooleanfalseAndroidWiFi details (requires the location permission). No effect on iOS.
collectSimCardInfobooleanfalseAndroidSIM/carrier info (requires READ_PHONE_STATE). No effect on iOS.
collectCameraInfobooleanfalseAndroidCamera count. No permission required. No effect on iOS.

In React Native, the same options are props of GuardianProvider and fields of GuardianSDK.initialize(), and each one behaves as it does on the underlying platform.

FailurePolicy​

failurePolicy applies to verify() only. collect() always returns the error.

PolicyBehavior
fail (default)verify() returns the error. Your code decides what to do.
allowverify() returns allowed: true with riskLevel unknown, and the error message in errors.
custom(handler)verify() returns the VerificationResult your handler builds from the error. In Swift: .custom { error in ... }. In Kotlin: FailurePolicy.Custom { error -> ... }.

On iOS the policy applies to every verify() failure. On Android it applies only when the SDK hits an unexpected internal error. A network failure or an HTTP error from Surt is returned as a failure whatever the policy is.