Installation

1. Server Setup

This section covers setting up your backend to generate authentication tokens for the ContactsManager SDK.

Installation

pip install contactsmanager

Token Generation

from contactsmanager import ContactsManagerClient

# Initialize the client with your API credentials
client = ContactsManagerClient(
    api_key="your-api-key",
    api_secret="your-api-secret",
    org_id="your-org-id"
)

# Generate a token for a user
token_data = client.generate_token(
    user_id="user-123",
    device_info={"device_name": "iPhone 15", "os_version": "iOS 17.5"},
    expiration_seconds=86400  # 24 hours
)

# The token to be used in client SDK initialization
token = token_data["token"]

2. Client Setup

Install and initialize the ContactsManager SDK in your client application.

Swift Package Manager

Add the ContactsManager package to your Swift project by adding it as a dependency in your Package.swift file:

dependencies: [
    .package(url: "https://github.com/arpwal/contactsmanager-ios.git", from: "<latest-version>")
]

Or in Xcode:

  1. Go to File > Swift Packages > Add Package Dependency
  2. Enter the repository URL: https://github.com/arpwal/contactsmanager-ios.git
  3. Specify a minimum version of <latest-version> from the repository
  4. Click Next and complete the integration

SDK Initialization

import ContactsManager

// Initialize the SDK with the token generated from your server
try await ContactsService.shared.initialize(
    withAPIKey: "your-api-key",
    token: "user-auth-token",  // From server token generation
    userInfo: userInfo
)

Next Steps