# dashlane/apple-credential-provider-example architecture

> Architecture diagram of the GitHub repository dashlane/apple-credential-provider-example, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dashlane/apple-credential-provider-example
- Repository: https://github.com/dashlane/apple-credential-provider-example

## Overview

This iOS demo lets a website register and authenticate passkeys through an enabled credential-provider extension. The extension handles registration confirmation and credential selection, then builds WebAuthn responses and returns them to iOS. Shared storage persists private keys and metadata and syncs credential identities for AutoFill; the host app lists and deletes passkeys. Registration and authentication orchestration are documented in the README, but the controller implementation was not sampled, so those links reflect documented behavior rather than inspected calls.

Main entry points: [`PasskeyProviderExtension/CredentialProviderViewController.swift`](https://github.com/dashlane/apple-credential-provider-example/blob/main/PasskeyProviderExtension/CredentialProviderViewController.swift) (Provider controller), [`Shared/Sources/Shared/Storage/PasskeyStore.swift`](https://github.com/dashlane/apple-credential-provider-example/blob/main/Shared/Sources/Shared/Storage/PasskeyStore.swift) (Passkey store), [`Shared/Sources/Shared/WebAuthn/AuthenticatorData.swift`](https://github.com/dashlane/apple-credential-provider-example/blob/main/Shared/Sources/Shared/WebAuthn/AuthenticatorData.swift) (Authenticator data), [`PasskeyProviderDemo/ContentView.swift`](https://github.com/dashlane/apple-credential-provider-example/blob/main/PasskeyProviderDemo/ContentView.swift) (Passkey list)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_host["Host app"]
  node_app["Demo app"]
  node_home["Passkey list<br/>[ContentView.swift]"]
  node_setup["Setup guide"]
end

subgraph group_extension["Credential extension"]
  node_controller["Provider controller"]
  node_confirm["Registration confirmation"]
  node_chooser["Credential chooser"]
end

subgraph group_webauthn["WebAuthn encoding"]
  node_authdata["Authenticator data"]
  node_cose["COSE key encoding<br/>[COSEKey.swift]"]
  node_attestation["Attestation builder"]
  node_assertion["Assertion builder"]
end

subgraph group_storage["Credential storage"]
  node_model["Passkey metadata"]
  node_store["Passkey store<br/>[PasskeyStore.swift]"]
  node_keychain[("Keychain")]
  node_metadata[("App Group metadata")]
  node_identity["Identity store manager"]
end

node_website(("Website"))
node_ios{{"iOS credential system"}}
node_identityservice[("iOS identity store")]

node_website -->|"requests credentials"| node_ios
node_ios -->|"dispatches request"| node_controller
node_controller -->|"presents registration"| node_confirm
node_controller -->|"presents credentials"| node_chooser
node_confirm -->|"confirms creation"| node_controller
node_chooser -->|"selects credential"| node_controller
node_controller -->|"saves or retrieves"| node_store
node_controller -->|"builds authenticator data"| node_authdata
node_controller -->|"builds attestation"| node_attestation
node_controller -->|"builds assertion"| node_assertion
node_attestation -->|"encodes data"| node_authdata
node_assertion -->|"encodes data"| node_authdata
node_authdata -->|"encodes public key"| node_cose
node_controller -->|"returns credential"| node_ios
node_app -->|"shows home"| node_home
node_home -->|"lists or deletes"| node_store
node_home -->|"opens guide"| node_setup
node_store -->|"stores metadata"| node_model
node_store -->|"writes private key"| node_keychain
node_store -->|"reads and writes"| node_metadata
node_store -->|"syncs identities"| node_identity
node_identity -->|"updates identities"| node_identityservice
node_website -->|"receives response"| node_ios

click node_app "https://github.com/dashlane/apple-credential-provider-example/blob/main/PasskeyProviderDemo/PasskeyProviderDemoApp.swift"
click node_home "https://github.com/dashlane/apple-credential-provider-example/blob/main/PasskeyProviderDemo/ContentView.swift"
click node_setup "https://github.com/dashlane/apple-credential-provider-example/blob/main/PasskeyProviderDemo/SetupInstructionsView.swift"
click node_controller "https://github.com/dashlane/apple-credential-provider-example/blob/main/PasskeyProviderExtension/CredentialProviderViewController.swift"
click node_confirm "https://github.com/dashlane/apple-credential-provider-example/blob/main/PasskeyProviderExtension/Views/RegistrationConfirmView.swift"
click node_chooser "https://github.com/dashlane/apple-credential-provider-example/blob/main/PasskeyProviderExtension/Views/CredentialListView.swift"
click node_model "https://github.com/dashlane/apple-credential-provider-example/blob/main/Shared/Sources/Shared/Models/StoredPasskey.swift"
click node_store "https://github.com/dashlane/apple-credential-provider-example/blob/main/Shared/Sources/Shared/Storage/PasskeyStore.swift"
click node_identity "https://github.com/dashlane/apple-credential-provider-example/blob/main/Shared/Sources/Shared/Storage/CredentialIdentityStoreManager.swift"
click node_authdata "https://github.com/dashlane/apple-credential-provider-example/blob/main/Shared/Sources/Shared/WebAuthn/AuthenticatorData.swift"
click node_cose "https://github.com/dashlane/apple-credential-provider-example/blob/main/Shared/Sources/Shared/WebAuthn/COSEKey.swift"
click node_attestation "https://github.com/dashlane/apple-credential-provider-example/blob/main/Shared/Sources/Shared/WebAuthn/AttestationBuilder.swift"
click node_assertion "https://github.com/dashlane/apple-credential-provider-example/blob/main/Shared/Sources/Shared/WebAuthn/AssertionBuilder.swift"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_home,node_setup toneBlue
class node_controller,node_confirm,node_chooser,node_identityservice toneAmber
class node_authdata,node_cose,node_attestation,node_assertion toneMint
class node_model,node_store,node_keychain,node_metadata,node_identity toneRose
class node_website,node_ios toneIndigo
```

## Components

### Host app

- [Demo app](https://github.com/dashlane/apple-credential-provider-example/blob/main/PasskeyProviderDemo/PasskeyProviderDemoApp.swift): `PasskeyProviderDemo/PasskeyProviderDemoApp.swift`
- [Passkey list](https://github.com/dashlane/apple-credential-provider-example/blob/main/PasskeyProviderDemo/ContentView.swift): `PasskeyProviderDemo/ContentView.swift`
- [Setup guide](https://github.com/dashlane/apple-credential-provider-example/blob/main/PasskeyProviderDemo/SetupInstructionsView.swift): `PasskeyProviderDemo/SetupInstructionsView.swift`

### Credential extension

- [Provider controller](https://github.com/dashlane/apple-credential-provider-example/blob/main/PasskeyProviderExtension/CredentialProviderViewController.swift): `PasskeyProviderExtension/CredentialProviderViewController.swift`
- [Registration confirmation](https://github.com/dashlane/apple-credential-provider-example/blob/main/PasskeyProviderExtension/Views/RegistrationConfirmView.swift): `PasskeyProviderExtension/Views/RegistrationConfirmView.swift`
- [Credential chooser](https://github.com/dashlane/apple-credential-provider-example/blob/main/PasskeyProviderExtension/Views/CredentialListView.swift): `PasskeyProviderExtension/Views/CredentialListView.swift`

### WebAuthn encoding

- [Authenticator data](https://github.com/dashlane/apple-credential-provider-example/blob/main/Shared/Sources/Shared/WebAuthn/AuthenticatorData.swift): `Shared/Sources/Shared/WebAuthn/AuthenticatorData.swift`
- [COSE key encoding](https://github.com/dashlane/apple-credential-provider-example/blob/main/Shared/Sources/Shared/WebAuthn/COSEKey.swift): `Shared/Sources/Shared/WebAuthn/COSEKey.swift`
- [Attestation builder](https://github.com/dashlane/apple-credential-provider-example/blob/main/Shared/Sources/Shared/WebAuthn/AttestationBuilder.swift): `Shared/Sources/Shared/WebAuthn/AttestationBuilder.swift`
- [Assertion builder](https://github.com/dashlane/apple-credential-provider-example/blob/main/Shared/Sources/Shared/WebAuthn/AssertionBuilder.swift): `Shared/Sources/Shared/WebAuthn/AssertionBuilder.swift`

### Credential storage

- [Passkey metadata](https://github.com/dashlane/apple-credential-provider-example/blob/main/Shared/Sources/Shared/Models/StoredPasskey.swift): `Shared/Sources/Shared/Models/StoredPasskey.swift`
- [Passkey store](https://github.com/dashlane/apple-credential-provider-example/blob/main/Shared/Sources/Shared/Storage/PasskeyStore.swift): `Shared/Sources/Shared/Storage/PasskeyStore.swift`
- **Keychain**
- **App Group metadata**
- [Identity store manager](https://github.com/dashlane/apple-credential-provider-example/blob/main/Shared/Sources/Shared/Storage/CredentialIdentityStoreManager.swift): `Shared/Sources/Shared/Storage/CredentialIdentityStoreManager.swift`

### Other components

- **Website**
- **iOS credential system**
- **iOS identity store**

## Connections

- Website → iOS credential system: requests credentials
- iOS credential system → Provider controller: dispatches request
- Provider controller → Registration confirmation: presents registration
- Provider controller → Credential chooser: presents credentials
- Registration confirmation → Provider controller: confirms creation
- Credential chooser → Provider controller: selects credential
- Provider controller → Passkey store: saves or retrieves
- Provider controller → Authenticator data: builds authenticator data
- Provider controller → Attestation builder: builds attestation
- Provider controller → Assertion builder: builds assertion
- Attestation builder → Authenticator data: encodes data
- Assertion builder → Authenticator data: encodes data
- Authenticator data → COSE key encoding: encodes public key
- Provider controller → iOS credential system: returns credential
- Demo app → Passkey list: shows home
- Passkey list → Passkey store: lists or deletes
- Passkey list → Setup guide: opens guide
- Passkey store → Passkey metadata: stores metadata
- Passkey store → Keychain: writes private key
- Passkey store → App Group metadata: reads and writes
- Passkey store → Identity store manager: syncs identities
- Identity store manager → iOS identity store: updates identities
- Website → iOS credential system: receives response
