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.
| Member | Swift | Kotlin | Notes |
|---|---|---|---|
| Usable keys | keys: [Key] | keys: List<Key> | Filtered to keys with live hardware material. |
| Current key | currentKey: Key? | currentKey: Key? | |
| Branding lookup | brandingFor(keyId:) -> Branding? | brandingFor(keyId): Branding? | nil → fall back to a default icon. |
| Audit log | auditLog(limit:) -> [AuditEntry] | auditLog(limit): List<AuditEntry> | limit defaults to 50. |
| Start registration | startRegistrationFlow(email:clientId:sessionId:) throws | startRegistrationFlow(email, clientId, sessionId) | |
| Start login | startLoginFlow() -> LoginFlow | startLoginFlow(): LoginFlow | Does not throw. |
| Start revocation | startRevocationFlow(keyId:) throws | startRevocationFlow(keyId) | |
| Start rotation | startKeyRotationFlow() throws | startKeyRotationFlow() | Throws NoKeys when empty. |
| Rotation hint | takeKeyRotationHint() -> Bool | takeKeyRotationHint(): Boolean | One-shot; reading clears it. |
| Stage push token | updatePushToken(token:platform:) | updatePushToken(token, platform) | Fire-and-forget. |
| Upload push token | syncPushToken() | syncPushToken() | Fire-and-forget. |
| Load models | initializeInferenceEngine() async throws | initializeInferenceEngine(context) — suspend | Idempotent. |
Flow surfaces
Observation differs by platform and by flow. Login and registration are hot streams; rotation and revocation hold state.
| Flow | Swift observation | Kotlin observation |
|---|---|---|
LoginFlow | stateStream(): AsyncStream<LoginState> | state: SharedFlow<LoginState> |
RegistrationFlow | stateStream(): AsyncStream<RegistrationState> | state: SharedFlow<RegistrationState> |
FaceCaptureDriver | captureStateStream(): AsyncStream<FaceCaptureUiState> | state: SharedFlow<FaceCaptureUiState> |
RevocationFlow | stateStream(): AsyncStream<RevocationState> | state: StateFlow<RevocationState> |
KeyRotationFlow | stateStream(): 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
| Member | Purpose |
|---|---|
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
| Member | Purpose |
|---|---|
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
| Field | Type | Notes |
|---|---|---|
portalUrl | String | No trailing slash. |
appLabel | String | Shown in audit entries and bundled UI. |
tenantId | String? | nil → default tenant. |
enableLogging | Bool | Defaults to false. Panic reporting is unaffected. |
Data models
Key
| Field | Type |
|---|---|
id | String |
email | String |
clientId | String |
createdAt | String |
pubkeyFingerprint | String |
Branding
| Field | Type | Notes |
|---|---|---|
orgName | String | |
shortMessage | String? | |
logoUrl | String? | |
logoBytes | Data? | Pre-fetched bytes — prefer these over re-fetching logoUrl. |
logoMime | String? | |
primaryColor | String? | |
accentColor | String? |
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
| Field | Type | Notes |
|---|---|---|
email | String | |
clientId | String | |
appLabel | String | |
terminated | Bool | true for termination, false for ordinary revocation. |
AuditEntry
| Field | Type |
|---|---|
timestamp | Int64 |
kind | String |
identityId | String? |
note | String |
SignupAttribute
| Field | Type | Notes |
|---|---|---|
key | String | Key your submitted value by this. |
dataType | AttributeDataType | Which control to render. |
label | String | |
required | Bool | |
ordering | Int32 | Render in this order. |
options | [String] | Values for choice. |
constraints | AttributeConstraints? |
AttributeConstraints
| Field | Type |
|---|---|
minLength | Int32? |
maxLength | Int32? |
min | String? |
max | String? |
decimalPlaces | Int32? |
SignupAttributeRejection
| Field | Type | Notes |
|---|---|---|
key | String? | Offending field, or nil for a form-level error. |
message | String | Server'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.
Related
- Initialization — opening the SDK.
- Login · Registration · Key management
- UI components — the bundled surfaces.
- Errors — the full error surface.
Error reference
Every error type and failure reason the SenseCrypt Mobile SDK can produce, what causes it, and whether it is recoverable.
Relying party
Integrate your web application as an OIDC relying party against SenseCrypt using any conformant OIDC client library — no SenseCrypt-specific SDK required.