Import a hardware-backed key from your iOS or Android app as a Striga passkey. Striga verifies Apple App Attest or Android Key Attestation before accepting it.
A native iOS or Android app can enrol a hardware-backed key - the Secure Enclave on iOS, the Android Keystore (TEE or StrongBox) on Android - as a Striga passkey without showing the operating-system passkey sheet. The key is released only by the device biometric, your app keeps its own screens and wording, and Striga verifies hardware evidence before accepting the key: Apple App Attest on iOS and Android Key Attestation on Android. Once imported, the key is an ordinary passkey for every SCA ceremony: login, transaction confirmation, trusted beneficiaries, standing orders and passkey removal.
Device-bound passkeys require a separate agreement with LSP EU and a per-platform configuration on your application (see Before you start). Attestation is mandatory: there is no software-only import. Web apps keep using the standard WebAuthn enrolment on
/user/passkey/register/start.
When to use it
- You ship a native app and want the biometric prompt inside your own flow rather than the system passkey sheet.
- You want the factor pinned to one physical device. A passkey synced through iCloud Keychain or Google Password Manager is not.
- You already hold a hardware key per user that your app registered and attested with your own backend - possibly before the user exists at Striga - and want it recognised as the SCA factor. The import takes that key and its existing attestation as they are: no new key and no second biometric prompt.
An imported passkey counts towards the user's two-passkey cap and shows up on /user/passkey/list like any other.
Before you start
Send Striga the following for each platform and environment (sandbox and production are configured separately) and ask for the import to be enabled for your application. Until both are in place the import endpoint answers 100010.
| Platform | What Striga needs |
|---|---|
| iOS | Apple Team ID, the bundle identifiers allowed to import, and the App Attest environment: development for builds whose com.apple.developer.devicecheck.appattest-environment entitlement is development, production for App Store and TestFlight builds. A mismatch fails the attestation with 100012. |
| Android | The package names allowed to import and the signing-certificate digests: standard base64 of the SHA-256 over the DER signing certificate. apksigner verify --print-certs app.apk prints the hex; with Play App Signing use the certificate Play signs with (Play Console → App signing). Optional policy: minSecurityLevel (TRUSTED_ENVIRONMENT, the default, or STRONG_BOX), requireVerifiedBoot (on by default: verified boot and a locked bootloader), allowExpiredFactoryChains (off by default). |
| Both | passkey enabled as an SCA method for the application, and the WebAuthn relying party id plus allowed origins configured as for web passkeys. The assertions your app builds carry an origin, and it must be on that allow-list. |
How it fits together
- On the device, create the key and attest it against a challenge of your own - typically when the app registers the key with your backend. This can happen at any time, including before the user exists at Striga.
- Log the user in with
/user/login/start+/user/login/complete. - Within 15 minutes of that login, call
POST /user/passkey/import/completeonce with the public key and the attestation. Striga verifies them and returns the credential. - From then on the app answers SCA challenges with a WebAuthn assertion it builds itself (see Using the imported passkey).
The import is a single call: there is no start call, no Striga challenge and no biometric prompt at enrolment. The key signs for the first time at the user's first passkey login or approval.
Two keys on iOS, one on Android. On iOS the App Attest key attests your app instance; it is never the passkey itself. The passkey is a second Secure Enclave key, created by you with biometric access control, and the tie between the two is the one your backend established when it registered them. On Android the attested Keystore key is the passkey key, and Striga checks that the public key in the attestation matches the one you import.
Step 1 - Create the key and attest it
iOS
// The passkey key: Secure Enclave, P-256, released only by the current biometric set.
let access = SecAccessControlCreateWithFlags(
nil, kSecAttrAccessibleWhenUnlockedThisDeviceOnly, [.privateKeyUsage, .biometryCurrentSet], nil)!
let attrs: [String: Any] = [
kSecAttrKeyType as String: kSecAttrKeyTypeECSECPrimeRandom,
kSecAttrKeySizeInBits as String: 256,
kSecAttrTokenID as String: kSecAttrTokenIDSecureEnclave,
kSecPrivateKeyAttrs as String: [
kSecAttrIsPermanent as String: true,
kSecAttrApplicationTag as String: "com.example.striga.passkey".data(using: .utf8)!,
kSecAttrAccessControl as String: access]]
let privateKey = SecKeyCreateRandomKey(attrs as CFDictionary, nil)!
let publicKey = SecKeyCopyExternalRepresentation(SecKeyCopyPublicKey(privateKey)!, nil)! as Data // 65-byte X9.63 point
// App Attest: attests the app instance. clientDataHash is yours to define; keep the 32 bytes, Striga needs them.
// Hash a document that names your backend's challenge and the passkey public key, so your backend ties the two keys.
// A key can be attested once.
let keyId = try await DCAppAttestService.shared.generateKey()
let clientDataHash = Data(SHA256.hash(data: registrationDocument))
let attestation = try await DCAppAttestService.shared.attestKey(keyId, clientDataHash: clientDataHash)Keep keyId and attestation exactly as DeviceCheck returns them (standard base64) and the clientDataHash you passed. App Attest is not available on the simulator.
Android
val spec = KeyGenParameterSpec.Builder(alias, KeyProperties.PURPOSE_SIGN)
.setAlgorithmParameterSpec(ECGenParameterSpec("secp256r1"))
.setDigests(KeyProperties.DIGEST_SHA256)
.setUserAuthenticationRequired(true)
.setUserAuthenticationParameters(0, KeyProperties.AUTH_BIOMETRIC_STRONG) // per use, biometric only
.setInvalidatedByBiometricEnrollment(true)
.setAttestationChallenge(challenge) // your backend's challenge
// .setIsStrongBoxBacked(true) // optional; catch StrongBoxUnavailableException and retry without it
.build()
val keyPair = KeyPairGenerator.getInstance(KeyProperties.KEY_ALGORITHM_EC, "AndroidKeyStore")
.apply { initialize(spec) }.generateKeyPair()
val keyStore = KeyStore.getInstance("AndroidKeyStore").apply { load(null) }
val chain = keyStore.getCertificateChain(alias) // leaf first; send each as PEM or base64 DER
val publicKey = keyPair.public.encoded // SPKI DERThe key must satisfy Striga's policy or the import fails with 100012 and a message naming the rule: EC P-256, generated on the device, user authentication required with biometric only and per use (a key that also accepts the PIN, pattern or password, or that carries an authTimeout, is refused), security level TEE or StrongBox, verified boot VERIFIED with a locked bootloader, the package name and signing digest on your allow-list, and a chain to a Google hardware attestation root that is not revoked. Send 2 to 8 certificates, leaf first.
Step 2 - Log the user in
The import needs an active SCA session granted within the last 15 minutes, otherwise it answers 30070 (SCA_REQUIRED, reason NO_SESSION or EXPIRED). Run /user/login/start + /user/login/complete first. For a new user the order is: verify mobile, SMS login, then the import, so the user sees one SMS code and no biometric prompt.
Step 3 - Import
POST /user/passkey/import/complete
Authorization: <HMAC>
{
"userId": "<uuid>",
"preAttested": true,
"platform": "ANDROID",
"app": { "packageName": "com.example.app" },
"passkey": {
"credentialId": "s7biKPyuUzmvB3XAhoWg9g",
"publicKey": "BGt5...X9.63 point or SPKI DER, base64url...",
"algorithm": -7,
"displayName": "Galaxy S20"
},
"attestation": {
"type": "ANDROID_KEY_ATTESTATION",
"certificateChain": ["<leaf PEM>", "...", "<root PEM>"]
}
}On Android nothing else is needed: the certificate chain already carries the challenge your app set on the key. On iOS, app is { "bundleId": "com.example.app" } and attestation is { "type": "APP_ATTEST", "keyId": "<standard base64>", "attestation": "<standard base64 CBOR>", "clientDataHash": "<base64url, 32 bytes>" }.
{
"credential": {
"id": "4a967e2d-a8c4-4329-950f-a37afca9b980",
"credentialId": "s7biKPyuUzmvB3XAhoWg9g",
"displayName": "Galaxy S20",
"name": "native:android:s7biKPyu",
"relyingPartyId": "app.example.com",
"transports": ["internal"],
"insertInstant": 1795427951302,
"lastUseInstant": 1795427951302
},
"attestation": { "type": "ANDROID_KEY_ATTESTATION", "securityLevel": "STRONG_BOX", "preAttested": true },
"multiFactorAuth": { "enabled": true, "primaryMethod": "passkey", "enrolledMethods": ["passkey"], "passkeyCount": 1 }
}The attestation summary is { type: "APP_ATTEST", environment, preAttested } on iOS and { type: "ANDROID_KEY_ATTESTATION", securityLevel, preAttested } on Android, where securityLevel is TRUSTED_ENVIRONMENT or STRONG_BOX. credential.relyingPartyId is the rpId your assertions must hash later. Store credentialId next to the key: it is the WebAuthn credential id for every later assertion. If the user already holds two passkeys the call fails with 100004; remove one first (see Managing passkeys).
| Field | Constraint |
|---|---|
preAttested | true |
platform | IOS or ANDROID |
passkey.credentialId | base64url of 16 to 64 bytes chosen by the app: random, or derived from the key such as SHA-256 of the SPKI; must be unique |
passkey.publicKey | base64url of the 65-byte X9.63 uncompressed P-256 point or of the SPKI DER |
passkey.algorithm | -7 (ES256) only |
passkey.displayName | optional, 1 to 64 characters, shown on the passkey list |
attestation.keyId | iOS, standard base64 as returned by generateKey() |
attestation.attestation | iOS, standard base64, up to 64 KB |
attestation.clientDataHash | iOS, required: the exact 32 bytes your app passed to attestKey as clientDataHash, base64url |
attestation.certificateChain | Android, 2 to 8 entries, leaf first, each PEM or base64 DER up to 16 KB |
attestation.challenge | Android, optional: the exact bytes your app passed to setAttestationChallenge when it generated the key, base64url. The certificate carries it, so you can leave it out; when sent it must match, otherwise 100012 |
What Striga verifies: the Apple or Google certificate chain, on Android the revocation list and the full key policy (hardware-backed, verified boot, biometric-only release) and that the attested key is the key being imported, and that the app is on your application's allow-list. Certificates that have expired since the attestation was made are accepted. What rests with you:
- You vouch for possession. No signature by the device key is taken at import. If
publicKeyis not the key on the device, the import succeeds and the user's first passkey login or approval fails. - On iOS, you vouch for the key binding. App Attest attests your app instance, not the device key, so the tie between the two is the one your own backend established at registration.
- One key, one import. A device key (and on iOS its App Attest key) can back a single import across all users; a second attempt answers
999998.
Using the imported passkey
There is no browser, so your app builds the WebAuthn assertion itself and sends it wherever a passkey assertion is accepted: /user/login/complete, /wallets/transaction/confirm, trusted-beneficiary and standing-order confirmations, and /user/passkey/delete/confirm. The challenge and the allowCredentials list come from the corresponding start call, for example /wallets/passkey/approval/start.
{
"id": "<credentialId>",
"rawId": "<credentialId>",
"type": "public-key",
"authenticatorAttachment": "platform",
"response": {
"clientDataJSON": "<base64url of {\"type\":\"webauthn.get\",\"challenge\":\"<challenge>\",\"origin\":\"https://app.example.com\"}>",
"authenticatorData": "<base64url of SHA-256(rpId) || 0x05 || counter as 4 bytes big-endian>",
"signature": "<base64url DER ECDSA-SHA256 over authenticatorData || SHA-256(clientDataJSON)>"
},
"clientExtensionResults": {}
}rpIdis therelyingPartyIdreturned at import;originmust be one of your application's allowed WebAuthn origins.- The flags byte
0x05declares user presence and user verification; the biometric prompt that releases the key is the verification. - Keep a per-credential signature counter and increase it on every assertion. Striga accepts a counter that stays at
0, but once it is above zero it must strictly increase; an equal or lower value is refused. - Omit
response.userHandle. A device-bound key has no user handle to report; Striga drops the member for imported credentials. - Pass the client
ipand, for transaction confirmations, the sameverificationMethod: "passkey"andoriginas for any passkey.
Per-approval App Attest assertion (iOS, optional)
An iOS app may additionally prove that the request comes from the attested app instance by adding passkeyAssertion.deviceAttestation = { "keyId", "assertion" }, where assertion is the standard base64 of DCAppAttestService.generateAssertion(keyId, clientDataHash: SHA256(clientDataJSON bytes)) with the App Attest key enrolled at import. When present it is verified before the WebAuthn check: the key must be the one bound to this credential, the assertion must be over this exact clientDataJSON, and the App Attest counter must have increased. A replayed or mismatched assertion fails the confirmation; the member is removed before the assertion reaches the WebAuthn verifier. Android keys have no App Attest equivalent; a deviceAttestation sent with an Android credential is ignored.
On confirmation endpoints a failed
deviceAttestationsurfaces as the generic factor error31028; themessagenames the failing step, for exampleAttestation failed (SIGNATURE): signature does not verify over the nonce. On/user/login/completethe same failure keeps its own code,100012, as on/passkey/import/complete.
Lifecycle and fallbacks
- SMS is the standing fallback. Every consumer has a mobile number on file, so
smsis always available as an SCA factor, and TOTP can be enrolled as well. Attestation fails on a small share of genuine devices - unlocked bootloaders, custom ROMs, devices whose attestation chain has expired, or an App Attest outage - and the user must still be able to transact. Treat100012as "offer another factor", not as fraud. - Keys do not survive the device. A Secure Enclave or Keystore key is lost on uninstall, on a device restore to new hardware, and when biometrics are re-enrolled (
.biometryCurrentSet,setInvalidatedByBiometricEnrollment). Detect the missing key and recover through the liveness-gated 2FA reset opened with that credential'scredentialId(the one whose key your app can no longer load): it removes that passkey and its device binding only and hands back creation options, after which the app logs the user in and imports a fresh key; without acredentialIdthe reset clears every passkey and device binding. A passkey can only be deleted with the passkey itself (/user/passkey/delete+/user/passkey/delete/confirm), so a dead key is never removed that way. An import never replaces an existing credential: removing a strong factor always needs the user's own proof or a liveness check. - One import per credential id. A
credentialIdalready in use, from an earlier import or any other passkey, is refused with999998; generate a fresh one. - Two passkeys per user. A third import fails with
100004. - New keys after a loss. Apple allows an App Attest key to be attested once, and a device key backs one import; after a reinstall or a biometric change generate and attest new ones.
Business accounts
POST /business/passkey/import/complete follows the same contract keyed by businessId, after /business/login/start + /business/login/complete. The imported key is then used on the business login and confirmation endpoints.
Errors
| Code | Where | Meaning |
|---|---|---|
00002 | import | Request validation failed; message lists the fields (Invalid fields --> Invalid attestation.keyId, …). |
100004 | import | Passkey limit reached (two per user or business). Remove one first. |
100010 | import | Device-bound passkeys are not configured for this platform on your application, or the import is not enabled for it. Contact Striga. |
30070 | import | No SCA login within the last 15 minutes (reason NO_SESSION or EXPIRED). Log the user in and retry. |
100012 | import, login complete | Attestation failed. The message names the step: INPUT, FORMAT, APP_ID / PACKAGE (not on the allow-list), NONCE (clientDataHash or challenge does not match the attestation), CHAIN / ROOT, AUTH_DATA, RP_ID, POLICY (Android key rules), KEY_BINDING (attested key is not the passkey key), COUNTER. |
999998 | import | credentialId already in use, or the device key or its App Attest key is already enrolled. |
31028 | confirmations | The optional deviceAttestation failed on a transaction or other confirmation endpoint (the message names the step), or another factor error on the assertion. On /user/login/complete the same failure is returned as 100012. |
Testing on sandbox
- Sandbox and production hold separate configurations. For sandbox, send the Team ID, bundle id and
developmentenvironment of your development builds, or the package name and the digest of the certificate your debug builds are signed with. - App Attest needs a physical iPhone; Android Key Attestation needs a physical device with a locked bootloader and enrolled biometrics (emulators fail
POLICY). - The sandbox SMS code
123456lets you exercise the passkey-removal and fallback paths without a phone number.

