SenseCrypt Docs
SDKs & appsMobile SDK

API reference

Types, data models, and enums in the SenseCrypt Mobile SDK — the SenseCryptAuthenticator handle, flow surfaces, and every payload struct.

Naming follows each platform's convention: lowerCamelCase enum cases in Swift, UPPER_SNAKE_CASE in Kotlin, and property-style accessors on Android where Swift uses computed properties. The shapes are otherwise identical.

Entry point

public enum SenseCryptAuthn {
    public static func open(config: AuthenticatorConfig) throws -> SenseCryptAuthenticator
}
object SenseCryptAuthenticatorSDK {
    fun open(
        context: Context,
        config: AuthenticatorConfig,
        scanTheme: Int = /* default */,
        playIntegrityCloudProjectNumber: Long = /* default */,
    ): SenseCryptAuthenticator
}

SenseCryptAuthenticator

The handle you keep for the process lifetime.

MemberSwiftKotlinNotes
Usable keyskeys: [Key]keys: List<Key>Filtered to keys with live hardware material.
Current keycurrentKey: Key?currentKey: Key?
Branding lookupbrandingFor(keyId:) -> Branding?brandingFor(keyId): Branding?nil → fall back to a default icon.
Audit logauditLog(limit:) -> [AuditEntry]auditLog(limit): List<AuditEntry>limit defaults to 50.
Start registrationstartRegistrationFlow(email:clientId:sessionId:) throwsstartRegistrationFlow(email, clientId, sessionId)
Start loginstartLoginFlow() -> LoginFlowstartLoginFlow(): LoginFlowDoes not throw.
Start revocationstartRevocationFlow(keyId:) throwsstartRevocationFlow(keyId)
Start rotationstartKeyRotationFlow() throwsstartKeyRotationFlow()Throws NoKeys when empty.
Rotation hinttakeKeyRotationHint() -> BooltakeKeyRotationHint(): BooleanOne-shot; reading clears it.
Stage push tokenupdatePushToken(token:platform:)updatePushToken(token, platform)Fire-and-forget.
Upload push tokensyncPushToken()syncPushToken()Fire-and-forget.
Load modelsinitializeInferenceEngine() async throwsinitializeInferenceEngine(context)suspendIdempotent.

Flow surfaces

Observation differs by platform and by flow. Login and registration are hot streams; rotation and revocation hold state.

FlowSwift observationKotlin observation
LoginFlowstateStream(): AsyncStream<LoginState>state: SharedFlow<LoginState>
RegistrationFlowstateStream(): AsyncStream<RegistrationState>state: SharedFlow<RegistrationState>
FaceCaptureDrivercaptureStateStream(): AsyncStream<FaceCaptureUiState>state: SharedFlow<FaceCaptureUiState>
RevocationFlowstateStream(): AsyncStream<RevocationState>state: StateFlow<RevocationState>
KeyRotationFlowstateStream(): AsyncStream<KeyRotationState>state: StateFlow<KeyRotationState>

On Android, LoginFlow, RegistrationFlow, and FaceCaptureDriver expose a SharedFlow — there is no .value. Use the currentState property for a synchronous read. Only RevocationFlow and KeyRotationFlow are StateFlows.

Swift's stateStream() yields the current state first, then transitions — so a collector never has to wait for the next change to learn where it is.

LoginFlow

MemberPurpose
submitQrPayload(payload:)Feed decoded QR bytes. Returns immediately.
submitPassword(password:)Only valid during downloadingFaceToken with passwordRequired.
submitFaceCapture(captureSession:)Submit a passing capture. Prefer the driver for portability.
faceCaptureDriver()Vend the capture driver.
retryPostResult()Re-send the cached proof after postingResultFailed.
resetToScan()Return to awaitingQrScan, clearing lastError.
loginQrPng()PNG bytes of this session's universal-link QR, or nil.
cancel()Local-only cancel; no server notification.
cancelLogin()Signed abort with user_cancelled, then terminal. Idempotent.
id()Flow identifier.
currentState()Synchronous state read.

RegistrationFlow

MemberPurpose
submitPin(pin:)Submit the emailed PIN.
resendPin()Request a new PIN. Respect cooldownUntil.
submitSignupAttributes(values:address:consentAccepted:)Signup branch form submission.
faceCaptureDriver()Vend the capture driver (signup branch).
cancel()Abandon.
currentState()Synchronous state read.

iOS additionally exposes submitFaceCapture(captureSession:), retryPostResult(), and id() directly on RegistrationFlow. Android's wrapper omits them deliberately — route capture and retry through the FaceCaptureDriver, which is the portable path on both platforms.

RevocationFlow / KeyRotationFlow

Both expose exactly approve(), cancel(), and state observation. Rotation additionally throws NoKeys at start.

FaceCaptureDriver

submitFaceCapture(captureSession:), retry(), cancel(), currentState(), and state observation.

Configuration

AuthenticatorConfig

FieldTypeNotes
portalUrlStringNo trailing slash.
appLabelStringShown in audit entries and bundled UI.
tenantIdString?nil → default tenant.
enableLoggingBoolDefaults to false. Panic reporting is unaffected.

Data models

Key

FieldType
idString
emailString
clientIdString
createdAtString
pubkeyFingerprintString

Branding

FieldTypeNotes
orgNameString
shortMessageString?
logoUrlString?
logoBytesData?Pre-fetched bytes — prefer these over re-fetching logoUrl.
logoMimeString?
primaryColorString?
accentColorString?

Branding is cached per relying party on disk. Per-session values — notably a CIBA binding message — are not here; they arrive on the login state instead, so a stale message can't replay on a later sign-in.

RevokedKeyNotice

FieldTypeNotes
emailString
clientIdString
appLabelString
terminatedBooltrue for termination, false for ordinary revocation.

AuditEntry

FieldType
timestampInt64
kindString
identityIdString?
noteString

SignupAttribute

FieldTypeNotes
keyStringKey your submitted value by this.
dataTypeAttributeDataTypeWhich control to render.
labelString
requiredBool
orderingInt32Render in this order.
options[String]Values for choice.
constraintsAttributeConstraints?

AttributeConstraints

FieldType
minLengthInt32?
maxLengthInt32?
minString?
maxString?
decimalPlacesInt32?

SignupAttributeRejection

FieldTypeNotes
keyString?Offending field, or nil for a form-level error.
messageStringServer's reason. Show inline.

FaceMetrics

Normalized quality signals from a capture: pitchness, yawness, rollness, centerness, closeness — all Float.

Enums

AttributeDataType

text, integer, decimal, boolean, date, address, choice, coupon, phoneNumber, timezone, locale, unknown

Notes for form rendering: address uses the structured address map on submission rather than the flat values map. coupon cannot be validated on-device — expect a server rejection round-trip. Treat unknown as text so a newer server's attribute doesn't break your form.

CaptureOutcome

succeeded, cancelled, failed(reason: FailureReason)

FaceCaptureRetryReason

faceMismatch (counts against the budget), livenessFailed (does not)

HeadPose

All 15 cases:

normal, normalNotLive, tooFar, tooClose, notCentered, lookingLeft, lookingRight, lookingUp, lookingDown, lookingTopLeft, lookingTopRight, lookingBottomLeft, lookingBottomRight, tiltedLeft, tiltedRight

Used by the lower-level capture surface for framing guidance. The bundled views render this for you.

BarcodeFormat

qrCode, dataMatrix, aztec, pdf417

PushPlatform

ios, android

Error enums

AuthnInitError, AuthnRuntimeError, SenseCryptInitError, FailureReason, QrScanError, PasswordError — all documented with causes and recovery in Errors.

On this page