Identity.iOS is a Swift package that provides client-side components for interacting with an Identity service.
It contains IdentityClient, and its inner Services to handle authentication, device management, user registration, and account operations.
- iOS 13
- macOS 10.15
Add this package as a Swift Package Manager dependency in your Xcode project or Package.swift:
- In Xcode: File → Add Packages… and point to this repository.
- Or add to
Package.swiftdependencies:
.package(url: "https://github.com/indice-co/Indice.Identity.iOS", .upToNextMinor(from: "1.3.2"))Import the module by:
import IdentityClientSee Sources/IdentityClient for available services, repositories, and models (for example Services, Repositories, Models, and Protocols). The package is organized around a small set of service APIs (account, authorization, devices, user registration) and pluggable protocols for configuration and token storage.
A minimal Swift example showing how to create an IdentityClient instance. Replace the placeholders with your real implementations for RequestProcessor and ErrorParser.
import IdentityClient
// 1. Create a configuration for your Identity Server
let config = IdentityConfig(baseUrl: URL(string: "https://identity.example.com")!)
// 2. Create a Client descriptor
let client = Client(
id: "your-client-id",
secret: "your-secret",
userScope: [.openId, .profile],
appScope: [.identity],
urls: .init(commonForRedirectScheme: "myapp"))
// 3. Provide networking options (supply your RequestProcessor and ErrorParser)
let networkOptions = NetworkOptions(
processorBuilder: { /* return your RequestProcessor instance */ },
errorParser: /* your ErrorParser instance */
)
// 4. Construct the IdentityClient (on platforms with UIKit you can omit `currentDeviceInfoProvider`)
let identityClient = IdentityClient(
client: client,
configuration: config,
currentDeviceInfoProvider: /* CurrentDeviceInfoProvider implementation or .uiDevice */,
networkOptions: networkOptions
)
// Use services
// try await identityClient.authService.login(...)