Upgrade — iOS WebAuthn buildParameters#

The iOS SDK’s WebAuthnRegistrationClientOperationStep and WebAuthnAuthenticationClientOperationStep build the parameters for their continue form with buildParameters, the method name, parameters, and output the Android SDK already uses, and expose the form to submit them with as continueFormActionModel. The earlier methods keep working and are deprecated; the next major version removes them.

How to complete a WebAuthn step with any WebAuthn driver is in iOS Representations.

What Changed#

BeforeAfter
formattedParametersForRegistration(credentialOptions:attestationObject:rawClientDataJSON:credentialID:credentialParamType:)buildParameters(publicKey:clientDataJSON:attestationObject:type:rawId:)
formattedParametersForAssertion(rawAuthenticatorData:rawClientDataJSON:signature:credentialID:credentialParamType:userId:)buildParameters(authenticatorData:clientDataJSON:signature:userHandle:rawId:type:)
continueAction.modelcontinueFormActionModel; continueAction remains
Returns [String: Any], which does not pass to submitForm under Swift 6 without a castReturns [String: any Sendable], ready for submitForm
Returns empty parameters when the step has no context field for the ceremonyThrows an IdsvrError and logs the cause under the HAAPI_SDK_MAPPING follow-up tag
A nil user id sent as "userHandle": nullA nil user handle left out; the server treats both the same

Migrate#

The arguments map one to one, and two become required:

Deprecated argumentbuildParameters argument
credentialOptionspublicKey
rawClientDataJSONclientDataJSON
rawAuthenticatorDataauthenticatorData
credentialIDrawId
credentialParamType (defaulted to "public-key")type, required: pass "public-key"
userId (defaulted to nil)userHandle, required: pass nil when the assertion has none
// Before
let parameters = registrationStep.formattedParametersForRegistration(credentialOptions: options,
                                                                     attestationObject: attestationObject,
                                                                     rawClientDataJSON: clientDataJSON,
                                                                     credentialID: credentialID)

// After
let parameters = try registrationStep.buildParameters(publicKey: options,
                                                      clientDataJSON: clientDataJSON,
                                                      attestationObject: attestationObject,
                                                      type: "public-key",
                                                      rawId: credentialID)
let result = await haapiManager.submitForm(registrationStep.continueFormActionModel, parameters: parameters)
// Before
let parameters = authenticationStep.formattedParametersForAssertion(rawAuthenticatorData: authenticatorData,
                                                                    rawClientDataJSON: clientDataJSON,
                                                                    signature: signature,
                                                                    credentialID: credentialID,
                                                                    userId: userHandle)

// After
let parameters = try authenticationStep.buildParameters(authenticatorData: authenticatorData,
                                                        clientDataJSON: clientDataJSON,
                                                        signature: signature,
                                                        userHandle: userHandle,
                                                        rawId: credentialID,
                                                        type: "public-key")
let result = await haapiManager.submitForm(authenticationStep.continueFormActionModel, parameters: parameters)

Handle the thrown error where the empty result was handled before. It only occurs when the step’s continue form lacks the field for the ceremony, or when the registration options did not come from a WebAuthn registration step.

iOS UIKit#

The UIKit builds its WebAuthn parameters with buildParameters, so no code change is needed. A WebAuthn step whose continue form has no field for the credential now ends in the WebAuthn error handling instead of submitting empty parameters, and a registration fails before the passkey is created.

Was this helpful?