Android SDK

The Arculus FIDO SDK for Android 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

  • Callback-based async operations

  • Automatic NFC lifecycle management

  • Built-in attestation payload construction

  • No Activity transitions required

Obtaining the SDK

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

Component
Description

ArculusFidoSDK-release.aar

The main SDK library (AAR format)

Sample Applications

Complete Android sample apps demonstrating SDK usage

API Documentation

JavaDoc documentation for all public APIs

The AAR library is self-contained and includes all necessary dependencies (Kotlin runtime, AndroidX libraries, and the bundled Java SDK). See 5.3 Android Sample Applications for complete sample code.

2.4.1 Installation

Requirements

  • Android SDK 26+ (Android 8.0 Oreo)

  • Android Studio Arctic Fox or later

  • Physical device with NFC (Emulator not supported)

Adding the AAR Library

  1. Copy ArculusFidoSDK-release.aar (or ArculusFidoSDK.aar) to your project's libs/ directory

  2. Add dependencies to build.gradle (app module):

  1. Add NFC permission to AndroidManifest.xml:

Note: The Arculus FIDO SDK AAR is self-contained and includes all necessary dependencies:

  • Java SDK fat JAR (bundled internally) includes: gson, commons-text, jna, jna-platform

  • Kotlin runtime (kotlin-stdlib, kotlin-parcelize-runtime) is included

  • AndroidX libraries (appcompat, material, core-ktx) are included

You only need to add additional dependencies if your application requires specific versions or additional libraries like Kotlin coroutines or Guava.

Basic Setup

2.4.2 Registration Flow

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

The Android 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 Android 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

boolean

If true, resets card and sets PIN

registrationInfo

String

Optional device metadata JSON

Example

Backend-Proxied Pattern

In backend-proxied deployments, the Android 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 FidoOptionsHelper.

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.4.3 Authentication Flow

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

The Android 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 Android 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 Android 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.4.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.4.5 Error Handling

Callback Interface

Implement ArculusFidoResultCallback to receive all operation results:

Response Format

All callbacks receive 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 Methods

Method
Description

setBeginRegistrationPath(path, params)

Set registration options endpoint

setCompleteRegistrationPath(path, params)

Set registration result endpoint

setBeginAuthenticatePath(path, params)

Set authentication options endpoint

setCompleteAuthenticatePath(path, params)

Set authentication result endpoint

setRequestProperty(key, value)

Add custom HTTP header

setDeviceinfo(json)

Set device metadata for registration

Complete Sample Application

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

Last updated