| 1 | // swift-tools-version:6.1 |
| 2 | import PackageDescription |
| 3 | |
| 4 | let package = Package( |
| 5 | name: "SmbCloudAuth", |
| 6 | platforms: [ |
| 7 | .iOS(.v16), .macOS(.v14), .tvOS(.v16), .visionOS(.v1), |
| 8 | ], |
| 9 | products: [ |
| 10 | .library(name: "AuthCore", targets: ["AuthCore"]), |
| 11 | .library(name: "SmbCloudAuth", targets: ["SmbCloudAuth"]), |
| 12 | ], |
| 13 | dependencies: [ |
| 14 | .package( |
| 15 | url: "https://github.com/apple/swift-crypto.git", |
| 16 | "3.0.0" ..< "5.0.0" |
| 17 | ) |
| 18 | ], |
| 19 | targets: [ |
| 20 | // Cross-platform core. Builds on Apple platforms, Linux, Windows, and |
| 21 | // Android. No UIKit/AppKit, AuthenticationServices, or Keychain. |
| 22 | // |
| 23 | // A faithful native Swift port of the canonical client SDK, |
| 24 | // `smbcloud-cli/crates/smbcloud-auth-sdk` (the crate the `-py`/`-wasm` |
| 25 | // bindings wrap). The Rust crate is the contract authority; AuthCore is |
| 26 | // pinned to it by a shared conformance suite — there is intentionally no |
| 27 | // Rust/UniFFI dependency, so this builds with plain `swift build` |
| 28 | // everywhere, including server-side. |
| 29 | .target( |
| 30 | name: "AuthCore", |
| 31 | dependencies: [ |
| 32 | // CryptoKit is used on Apple platforms; swift-crypto provides the |
| 33 | // same SHA256 API everywhere else (used for OIDC PKCE). |
| 34 | .product( |
| 35 | name: "Crypto", |
| 36 | package: "swift-crypto", |
| 37 | condition: .when(platforms: [.linux, .windows, .android]) |
| 38 | ) |
| 39 | ], |
| 40 | path: "Sources/AuthCore" |
| 41 | ), |
| 42 | // Apple-platform UI layer: ASWebAuthenticationSession hosted login and |
| 43 | // the Keychain-backed credentials manager. Re-exports AuthCore. |
| 44 | .target( |
| 45 | name: "SmbCloudAuth", |
| 46 | dependencies: ["AuthCore"], |
| 47 | path: "Sources/SmbCloudAuth" |
| 48 | ), |
| 49 | .testTarget( |
| 50 | name: "AuthCoreTests", |
| 51 | dependencies: ["AuthCore"], |
| 52 | path: "Tests/AuthCoreTests" |
| 53 | ), |
| 54 | .testTarget( |
| 55 | name: "SmbCloudAuthTests", |
| 56 | dependencies: ["SmbCloudAuth"], |
| 57 | path: "Tests/SmbCloudAuthTests" |
| 58 | ), |
| 59 | ] |
| 60 | ) |