iOS SDK

The Arculus FIDO SDK for iOS provides a simple API for FIDO2 authentication using NFC-enabled Arculus cards. The SDK handles all complexity of attestation object creation, cryptographic operations, and server communication.

Key Features:

  • Simple 4-method API

  • Async/await support

  • Automatic NFC session management

  • Built-in attestation payload construction

Obtaining the SDK

Contact your Arculus representative to obtain the iOS SDK distribution package. The package includes:

Component
Description

ArculusFidoSDKFramework.xcframework

The main SDK framework for iOS

ArculusFidoSDK (Swift Package)

Swift Package Manager distribution (Xcode 16+)

Sample Applications

Complete iOS sample apps demonstrating SDK usage

API Documentation

SwiftDoc documentation for all public APIs

The SDK is distributed as either a zipped XCFramework or a Swift binary package. See 5.2 iOS Sample Applications for complete sample code.

2.3.1 Installation

Requirements

  • iOS 14.0+

  • Xcode 14.0+ (Xcode 16+ recommended for Swift Package Manager support)

  • Physical device with NFC (Simulator not supported)

Installation Methods

The Arculus FIDO SDK for iOS can be integrated using either XCFramework (manual) or Swift Package Manager (Xcode 16+).

Method 1: XCFramework (Manual Integration)

  1. Download the ArculusFidoSDKFramework.zip

  2. Unzip the archive to reveal ArculusFidoSDKFramework.xcframework

  3. Drag the .xcframework folder into your Xcode project's Frameworks directory

  4. Configure Build Phases:

    • Go to your target's Build Phases

    • Under Embed Frameworks, click +

    • Add ArculusFidoSDKFramework.xcframework

  5. Import in code:

Method 2: Swift Package Manager (Xcode 16+)

  1. Add Package Dependency:

    • In Xcode, go to FileAdd Package Dependencies...

    • Enter the package URL or local path to ArculusFidoSDK binary Swift package

    • Select the version or branch you want to use

  2. Import in code:

Note: The Swift Package Manager option uses a binary Swift package that wraps the XCFramework. Both methods require the same Build Phases configuration (Embed Frameworks) for device builds.

Basic Setup

2.3.2 Registration Flow

Registration creates a new FIDO2 credential and stores it on both the Arculus card and the FIDO server.

The iOS SDK supports two deployment patterns: client-direct (direct FIDO2 server communication) and backend-proxied (backend services proxy FIDO2 requests).

Client-Direct Pattern

In client-direct deployments, the iOS app communicates directly with the FIDO2 server.

API Signature

Parameters

Parameter
Type
Description

fidoServer

ArculusFidoServer

Server configuration object

pin

String

6+ digit PIN for the card

username

String

User identifier (e.g., email)

displayName

String

Human-readable name

relyingParty

String

Relying party ID (domain)

resetDevice

Bool

If true, resets card and sets PIN

registrationInfo

String?

Optional device metadata JSON

Example

Backend-Proxied Pattern

In backend-proxied deployments, the iOS app communicates with backend services that proxy FIDO2 requests.

Why Use Backend-Proxied?

Choose the backend-proxied pattern when:

Requirement
Benefit

Security isolation

FIDO2 server is not directly accessible from the internet

Business logic

Add custom validation, logging, or processing before/after FIDO2 operations

Audit trails

Centralized logging and monitoring of all authentication events

Session management

Backend controls session cookies and can integrate with existing auth systems

Rate limiting

Backend can implement throttling and abuse prevention

Trade-off: Backend-proxied requires implementing a 3-phase flow (begin → card operation → complete) instead of direct SDK calls, but provides greater control and security.

Session Cookies (Important)

FIDO2 authentication is a two-step process (begin + complete). The server uses session cookies to link these steps:

  1. Begin call: Server generates a challenge and stores it in a session, returning a session cookie

  2. Complete call: Server retrieves the challenge using the session cookie to verify the response

Without proper cookie handling:

  • The "complete" call won't find the challenge from the "begin" call

  • You'll get "Session expired" (E0024R) errors

Ensure your HTTP client stores cookies from the "begin" response and sends them with the "complete" request.

API Signature

Parameters

Parameter
Type
Description

pin

String

6+ digit PIN for the card

username

String

User identifier (e.g., email)

displayName

String

Human-readable name

rpId

String

Relying party ID (domain)

challenge

String

Base64-encoded challenge from backend's /register/begin response

origin

String

Origin URL for clientDataJSON (typically FIDO2 server URL)

Note: Unlike authenticateCardOnly(), registerCardOnly() takes challenge and origin directly rather than an optionsResponse object.

Helper Functions: The backend-proxied pattern requires helper classes and functions for backend communication and response transformation. See Backend Integration Helpers for complete implementations of BackendApiClient and createOptionsResponseFromBackend().

Phase 1: Get Challenge from Backend

Phase 2: Perform Card Registration

Phase 3: Complete Registration with Backend

Note: The registerCardOnly() method performs only card operations and does not communicate with the FIDO2 server. All FIDO2 server communication is handled by your backend services. Unlike authenticateCardOnly(), registerCardOnly() takes challenge and origin directly rather than an optionsResponse object.

Registration Sequence Diagrams

Client-Direct Pattern

spinner

Backend-Proxied Pattern

spinner

2.3.3 Authentication Flow

Authentication verifies a user's credential stored on the Arculus card.

The iOS SDK supports two deployment patterns: client-direct (direct FIDO2 server communication) and backend-proxied (backend services proxy FIDO2 requests).

Client-Direct Pattern

In client-direct deployments, the iOS app communicates directly with the FIDO2 server.

API Signature

Parameters

Parameter
Type
Description

fidoServer

ArculusFidoServer

Server configuration object

pin

String

Card PIN

username

String

User identifier

displayName

String

Human-readable name

relyingParty

String

Relying party ID (must match registration)

Example

Backend-Proxied Pattern

In backend-proxied deployments, the iOS app communicates with backend services that proxy FIDO2 requests. This provides enhanced security by isolating the FIDO2 server from client applications.

API Signature

Parameters

Parameter
Type
Description

pin

String

Card PIN

username

String

User identifier

rpId

String

Relying party ID (must match registration)

optionsResponse

ArculusFidoOptionsAuthorizationResponse

Pre-constructed options response containing challenge from backend

Note: Unlike registerCardOnly(), authenticateCardOnly() uses an optionsResponse object that must be constructed from the backend's response.

Phase 1: Get Challenge from Backend

Phase 2: Perform Card Authentication

Phase 3: Complete Authentication with Backend

Note: The authenticateCardOnly() method performs only card operations and does not communicate with the FIDO2 server. All FIDO2 server communication is handled by your backend services.

Authentication Sequence Diagrams

Client-Direct Pattern

spinner

Backend-Proxied Pattern

spinner

2.3.4 Reset Flow

Set PIN (Reset Card)

Resets the card and sets a new PIN. Warning: This erases all credentials on the card.

Example:

Change PIN (Preserve Data)

Changes the PIN while preserving all credentials on the card.

Example:

2.3.5 Error Handling

Response Format

All methods return a JSON string:

Or on failure:

Error Handling Example

Common Error Codes

Code
Description
Resolution

600

Tag lost

Hold card steady during NFC

602

No credentials

Register card first

608

PIN failed

Check PIN is correct

611

Set PIN failed

Retry operation

615

NFC not available

Use device with NFC

E2017R

Invalid signature

Credential may be corrupted

E2019R

Unknown credential

User not registered

See 2.7 Error Codes for complete reference.

ArculusFidoServer Class

Configure server connection details:

Server Properties

Property
Type
Description

registrationBeginEndpoint

String

Registration options endpoint

registrationCompleteEndpoint

String

Registration result endpoint

authorizationBeginEndpoint

String

Authentication options endpoint

authorizationCompleteEndpoint

String

Authentication result endpoint

Complete Sample Application

For complete iOS sample applications demonstrating both client-direct and backend-proxied deployment patterns, see 5.2 iOS Sample Applications in the Appendix.

Last updated