{"id":32151342,"url":"https://github.com/snapauthapp/sdk-swift","last_synced_at":"2026-05-16T11:02:32.516Z","repository":{"id":239850297,"uuid":"800776917","full_name":"snapauthapp/sdk-swift","owner":"snapauthapp","description":"Swift SDK for SnapAuth (all Apple platforms)","archived":false,"fork":false,"pushed_at":"2025-07-31T17:25:42.000Z","size":65,"stargazers_count":1,"open_issues_count":16,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-26T18:05:24.633Z","etag":null,"topics":["ios","macos","passkeys","snapauth","swift","tvos","visionos","web-authentication","web-authentication-api","webauthn"],"latest_commit_sha":null,"homepage":"https://www.snapauth.app","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/snapauthapp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-05-15T01:21:19.000Z","updated_at":"2025-07-31T17:25:45.000Z","dependencies_parsed_at":"2025-07-31T19:14:36.505Z","dependency_job_id":"74add0cd-fd2b-4348-a666-906ca5b33db8","html_url":"https://github.com/snapauthapp/sdk-swift","commit_stats":null,"previous_names":["snapauthapp/sdk-swift"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/snapauthapp/sdk-swift","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snapauthapp%2Fsdk-swift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snapauthapp%2Fsdk-swift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snapauthapp%2Fsdk-swift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snapauthapp%2Fsdk-swift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snapauthapp","download_url":"https://codeload.github.com/snapauthapp/sdk-swift/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snapauthapp%2Fsdk-swift/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33100319,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-16T04:41:52.686Z","status":"ssl_error","status_checked_at":"2026-05-16T04:41:52.009Z","response_time":115,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ios","macos","passkeys","snapauth","swift","tvos","visionos","web-authentication","web-authentication-api","webauthn"],"created_at":"2025-10-21T10:42:21.556Z","updated_at":"2026-05-16T11:02:32.511Z","avatar_url":"https://github.com/snapauthapp.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SnapAuth Swift SDK\n\nThis is the official Swift SDK for [SnapAuth](https://www.snapauth.app?utm_source=GitHub\u0026utm_campaign=sdk\u0026utm_content=sdk-swift).\n\nSnapAuth will let you add passkey support to your native app in a snap!\nAdd strong multi-factor authentication or go fully passwordless while maintaining a great, frictionless user experience.\n\n[SnapAuth Homepage](https://www.snapauth.app?utm_source=GitHub\u0026utm_campaign=sdk\u0026utm_content=sdk-swift)\n| [SnapAuth Docs](https://docs.snapauth.app)\n| [Dashboard](https://dashboard.snapauth.app)\n| [Github](https://github.com/snapauthapp/sdk-swift)\n\n[![GitHub Release](https://img.shields.io/github/v/release/snapauthapp/sdk-swift)](https://github.com/snapauthapp/sdk-swift/releases)\n[![Test](https://github.com/snapauthapp/sdk-swift/actions/workflows/test.yml/badge.svg)](https://github.com/snapauthapp/sdk-swift/actions/workflows/test.yml)\n[![GitHub License](https://img.shields.io/github/license/snapauthapp/sdk-typescript)](https://github.com/snapauthapp/sdk-swift/blob/main/LICENSE)\n\n![Swift Versions](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fsnapauthapp%2Fsdk-swift%2Fbadge%3Ftype%3Dswift-versions)\n![Supported Platforms](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fsnapauthapp%2Fsdk-swift%2Fbadge%3Ftype%3Dplatforms)\n\n[Swift Package Index](https://swiftpackageindex.com/snapauthapp/sdk-swift)\n| [SPI docs](https://swiftpackageindex.com/snapauthapp/sdk-swift/main/documentation/snapauth)\n\n## Platform Support\n\nThis SDK supports all major Apple platforms that support passkeys and hardware authenticators:\n\nPlatform | Passkeys | Hardware Keys | Notes\n--- | --- | --- | ---\niOS | ✅ 15.0+ | ✅ 15.0+ |\niPadOS | ✅ 15.0+ | ✅ 15.0+ |\nmacOS | ✅ 12.0+ | ✅ 12.0+ |\nmacOS (Catalyst) | ⚠️ | ⚠️ | Still being tested (should work)\nvisionOS | ✅ 1.0+ | ❌ | Hardware keys are not supported on visionOS\ntvOS | ⚠️ 16.0+ | ❌ | Still being tested, hardware keys are not supported on tvOS\n\nApple Watch does not support passkeys or hardware keys, so watchOS is not supported by this SDK.\nIf support is added in a future watchOS release, we will do the same!\n\n## Getting Started\n\n### Register for SnapAuth\n\nIf you haven't already registered for SnapAuth, you'll need to do so: https://www.snapauth.app/register\n\nUnlike for web integrations, `https` is still required even for `localhost` (web intergrations permit `http://localhost`).\nDepending on your development setup, you may want to immediately add a testing or staging server environment.\n\n\u003e [!TIP]\n\u003e If you need help with this, we're happy to help - just send us an email!\n\n### Set up associated domains\n\n\u003e [!WARNING]\n\u003e This is not SnapAuth-specific, but must be completed or the APIs will immediately return errors.\n\nSee the [Associated Domains setup guide](/DOMAINS.md) to configure your app to support passkeys.\n\n### Add the SnapAuth SDK\n\nXCode \u003e File \u003e Add Package Dependencies...\n\nIn the add package dialog, search for our SDK:\n\n```\nhttps://github.com/snapauthapp/sdk-swift\n```\n\nSelect a Dependency Rule and add it to your development target.\nWe recommend \"Dependency Rule: Up to Next Major Version\".\n\nWe follow Semantic Versioning with all of our SDKs, so this should always be a safe option.\n\n### Import the SDK\n\nIn any files that need to integrate with SnapAuth, be sure to import it:\n\n```swift\nimport SnapAuth\n```\n\n### Call the API\n\nGrab your `publishable key` from the SnapAuth Dashboard; you'll use it below.\n\nThis will typically be done in a Button's action.\nHere's a very simple sign-in View in SwiftUI:\n\n```swift\nimport SnapAuth\nimport SwiftUI\n\nstruct SignInView: View {\n  let snapAuth = SnapAuth(publishableKey: \"pubkey_yourkey\") // Set this value!\n\n  @State var userName: String = \"\"\n\n  var body: some View {\n    VStack {\n      TextField(\"Username\", text: $userName)\n      Button(\"Sign In\", systemImage: \"person.badge.key\") {\n        signIn()\n      }\n    }\n  }\n\n  func signIn() {\n    Task {\n      let result = await snapAuth.startAuth(.username(userName))\n      switch result {\n      case .success(let auth):\n        // Send auth.token to your backend to sign in the user\n      case .failure(let error):\n        // Decide how to proceed\n      }\n    }\n  }\n}\n```\n\n### Autofill-assisted Requests\n\n\u003e [!NOTE]\n\u003e Autofill is (at present) only supported on iOS/iPadOS \u003e= 16 and visionOS.\n\u003e On other platforms or OS versions, this will immediately return a failure code\n\u003e indicating a lack of platform support.\n\nTo have the system suggest a passkey when a username field is focused, make the following additions to start the process and handle the result:\n\n1. Add `.textContentType(.username)` to the username `TextField`, if not already set:\n\n```swift\nTextField(\"Username\", text: $userName)\n  .textContentType(.username) // \u003c-- Add this\n```\n\n2. Run the autofill API when the view is presented:\n\n```swift\n// ...\nvar body: some View {\n  VStack {\n    // ...\n  }\n  .onAppear(perform: autofill) // \u003c-- Add this\n}\n\n// And this\nfunc autofill() {\n  Task {\n    let autofillResult = await snapAuth.handleAutofill()\n    guard case .success(let auth) = autofillResult else {\n      // Autofill failed, this is common and generally safe to ignore\n      return\n    }\n    // Send auth.token to your backend to sign in the user, as above\n  }\n}\n```\n\n## Known issues\n\nIn our testing, the sign in dialog in tvOS doesn't open, at least in the simulator.\n\nEven with the Apple-documented configuration, the AutoFill API does not reliably provide passkey suggestions.\nThere appears to be a display issue inside the SwiftUI and UIKit internals causing the suggestion bar to not render consistently.\nWe have filed a Feedback with Apple, but this is outside of our control.\n\n## Useful resources\n\n - [WWDC21: Move beyond passwords](https://developer.apple.com/videos/play/wwdc2021/10106/)\n - [WWDC22: Meet passkeys](https://developer.apple.com/videos/play/wwdc2022/10092/)\n - [Supporting associated domains](https://developer.apple.com/documentation/xcode/supporting-associated-domains)\n - [Associated domains entitlement](https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_associated-domains)\n - https://forums.developer.apple.com/forums/thread/743890\n\n## License\n\nBSD-3-Clause\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnapauthapp%2Fsdk-swift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnapauthapp%2Fsdk-swift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnapauthapp%2Fsdk-swift/lists"}