Skip to content

5.0.0

Choose a tag to compare

@github-actions github-actions released this 30 Nov 11:00
· 22 commits to develop since this release
5.0.0
f24fb78

What's New

  • Replaced the AWS, pCloud, Box, Google Drive and Dropbox SDKs with direct REST calls on one hardened URLSession layer, so the library depends only on AppAuth, MSAL, cryptolib-swift, GRDB, JOSESwift and CocoaLumberjack (#47, #48, #49, #50, #51)
  • Added a library-owned OAuth token store for Box, Dropbox, Google Drive and pCloud (OAuthPersistence), shared between the app and its extensions, which refreshes each token at most once across processes. Logins stored by the former SDKs keep working without a new sign-in (#49, #50, #51, #52)
  • Added background sessions for every network provider through withBackgroundSession(credential:…, sessionIdentifier:sharedContainerIdentifier:). Only transfers run in the background; all other requests run on a foreground session. Releasing a provider no longer cancels its running transfers (#46, #52)
  • Added hasStoredLogin() and cachedUsername() to the Box, Dropbox, Google Drive and pCloud credentials to read the stored login without a request
  • Cancelling the task of a login dismisses the sign-in page and throws CancellationError. A denied consent throws CocoaError(.userCancelled) (#52)
  • Added S3 region correction and a path-style fallback at login (S3Authenticator.verifyCredential returns the corrected credential), S3Credential.forcePathStyle, and multipart uploads for files over 4768 MiB (#53)
  • Added CloudProviderError.invalidPath, deletionIncomplete, moveCompletedWithSourceRemaining and uploadSourceSizeMismatch, so callers can tell an unusable path, a partly refused delete, a move that left leftovers at its source, and a local file that changed during an upload from other failures (#69)
  • pCloud listings honor maxPageSize, and the identifier caches of Box, pCloud, Google Drive and Microsoft Graph live on disk, which keeps large folders within the File Provider's memory limit (#57)
  • Microsoft Graph requests only the fields it reads and downloads from the pre-authenticated download URL, saving one request per download (#68)
  • Temporary files live in one folder per process, and the folders of processes that iOS killed are deleted, so interrupted uploads no longer leave encrypted copies behind (#66)

Breaking Changes

  • Setups are values passed wherever a credential or login is created. The .constants globals and DropboxClientSetup are removed (#52)
  • Credentials take a user ID and a setup and keep their tokens in the setup's OAuthPersistence (#49, #50, #51, #52)
  • Authenticators are @MainActor enums that take a setup and return the credential (#52)
  • The provider-specific error enums (BoxError, DropboxError, GoogleDriveError, MicrosoftGraphError, PCloudError, LocalFileSystemProviderError, WebDAVProviderError, VaultFormatError, URLSessionError, …) and WebDAVClient are internal. Match on CloudProviderError (#52)
  • WebDAVProvider is renamed to WebDAVCloudProvider and takes a WebDAVCredential. Its HTTP failures are WebDAVError (#52)
  • Only a 401 or a missing-scope 403 maps to CloudProviderError.unauthorized. Item-level 403s from Google Drive, Box, Microsoft Graph and WebDAV and LocalFS's fileReadNoPermission pass through as raw errors (#67, #70)
  • Removed the dependencies on aws-sdk-ios-spm, box-ios-sdk, google-api-objectivec-client-for-rest, GTMAppAuth, gtm-session-fetcher, pcloud-sdk-swift and SwiftyDropbox, and updated cryptolib-swift to 3.0.0, MSAL to 2.18.1 and GRDB to 7.12.0

Migrating from 4.x

  • The library no longer depends on aws-sdk-ios-spm, box-ios-sdk, google-api-objectivec-client-for-rest, GTMAppAuth, gtm-session-fetcher, pcloud-sdk-swift or SwiftyDropbox. If your app keeps using one of them, add the package to your app yourself.
  • The library depends on cryptolib-swift 3.0.0, MSAL 2.18.1 (.upToNextMinor instead of exact) and GRDB 7.12.0. If your app also depends on one of them, update it accordingly. cryptolib-swift 3.0.0 has breaking changes of its own, see its release notes.
  • Create one OAuthPersistence per process with .keychain(accessGroup:tokenLockDirectory:services:), with the same values in the app and every extension, and pass it to BoxSetup, DropboxSetup, GoogleDriveSetup and PCloudSetup. tokenLockDirectory must be a directory in the App Group container. To keep reading existing logins in place, pass the keychain services your app used so far: the Box service, OAuthPersistence.legacyDropboxService(keychainService:) with the former DropboxSetup keychainService (or the bundle ID if you passed nil), and the pCloud SDK's service. Google Drive logins stay in GTMAppAuth's item. See OAuth Persistence. For other storage, implement OAuthTokenStorage and use .custom(storage:tokenLockDirectory:), which replaces the Box SDK's TokenStorage.
  • Replace the setups and their .constants with values that you pass along:
    • BoxSetup(clientID:clientSecret:oauth:) replaces init(clientId:clientSecret:sharedContainerIdentifier:).
    • DropboxSetup(appKey:oauth:) replaces init(appKey:sharedContainerIdentifier:keychainService:forceForegroundSession:). DropboxClientSetup is removed.
    • GoogleDriveSetup(clientID:redirectURL:oauth:) replaces init(clientId:redirectURL:sharedContainerIdentifier:).
    • PCloudSetup(appKey:oauth:) replaces init(appKey:sharedContainerIdentifier:).
    • MicrosoftGraphSetup(clientApplication:) replaces init(clientApplication:sharedContainerIdentifier:).
    • The setups of Box, Dropbox, Google Drive and pCloud are structs now.
  • Re-create credentials from the user ID: BoxCredential(userID:setup:), DropboxCredential(userID:setup:), GoogleDriveCredential(userID:setup:) and PCloudCredential(userID:setup:) throw, and MicrosoftGraphCredential(identifier:type:setup:) replaces init(identifier:scopes:) and init(identifier:type:). Removed: BoxCredential(tokenStorage:) and getUserID(), DropboxCredential(tokenUID:), tokenUID, isAuthorized and setAuthorizedClient(), GoogleDriveCredential.driveService, isAuthorized, save(authState:) and getAccountID(), and PCloudCredential(user:), user and createBackgroundClient(with:sessionIdentifier:). Each credential has userID.
  • deauthenticate() of the Box, Dropbox, Google Drive and pCloud credentials is async throws. A Google Drive sign-out deletes the stored login without revoking its token, because Google revokes a token for all of the user's devices. pCloud's only deletes, because pCloud offers no revocation.
  • BoxCredentialErrors and DropboxCredentialErrors are renamed to BoxCredentialError and DropboxCredentialError. PCloudCredentialError, GoogleDriveAuthenticatorError, OAuthTokenEndpointError and OAuthTokenStoreError are new.
  • Sign in with the setup:
    • BoxAuthenticator.authenticate(from:setup:), DropboxAuthenticator.authenticate(from:setup:), GoogleDriveAuthenticator.authenticate(from:setup:) and PCloudAuthenticator.authenticate(from:setup:) return the credential. GoogleDriveAuthenticator.authenticate(credential:from:) and BoxAuthenticator.authenticate(from:tokenStorage:) are removed.
    • MicrosoftGraphAuthenticator.authenticate(from:for:setup:) replaces authenticate(from:for:) and authenticate(from:with:).
    • DropboxAuthenticator.handleRedirectURL(_:setup:) replaces handleRedirectURL(_:). DropboxAuthenticator.authenticate is static.
    • GoogleDriveAuthenticator.currentAuthorizationFlow is removed. The Google login completes without forwarding its redirect.
    • Handle GoogleDriveAuthenticatorError.driveAccessNotGranted, which Google Drive throws when the user unticks Drive access on Google's consent screen.
    • Handle CancellationError from a login whose task was cancelled.
  • Create background providers with withBackgroundSession(credential:maxPageSize:sessionIdentifier:sharedContainerIdentifier:), which every network provider has now. It replaces PCloudCredential.createBackgroundClient, WebDAVClient.withBackgroundSession and the former S3CloudProvider.withBackgroundSession(credential:sharedContainerIdentifier:maxPageSize:). Box, Google Drive and Microsoft Graph take the new sharedContainerIdentifier there: pass the App Group in an extension and nil in the app. Use one session identifier per account.
  • Replace PCloudCloudProvider(client:) with PCloudCloudProvider(credential:maxPageSize:), BoxCloudProvider(credential:maxPageSize:urlSessionConfiguration:) with BoxCloudProvider(credential:maxPageSize:), and WebDAVProvider(with:maxPageSize:) with WebDAVCloudProvider(credential:maxPageSize:). The pCloud and WebDAV initializers throw. WebDAVAuthenticator.verifyCredential(_:) replaces verifyClient(client:).
  • Store the credential that S3Authenticator.verifyCredential(_:) returns, because it may carry a corrected region, endpoint or forcePathStyle.
  • Stop matching on the provider-specific error types that are internal now, and handle the new CloudProviderError cases in exhaustive switches: invalidPath, deletionIncomplete, moveCompletedWithSourceRemaining and uploadSourceSizeMismatch. WebDAVError (httpError(statusCode:), unexpectedResponse) is public.
  • Expect raw errors instead of unauthorized for item-level 403s (Google Drive, Box, Microsoft Graph, WebDAV) and for an unreadable local file, so that the app doesn't ask the user to sign in again for them.
  • CloudItemMetadata is Equatable. UnverifiedVaultConfig, VaultConfig and TLSCertificateValidator are final, and the credentials are final and Sendable.

Bug Fixes

  • Fixed overlapping listings of one folder on WebDAV and the local file system returning duplicated, shifted or empty pages (#56)
  • Fixed WebDAV metadata requests running as data tasks on a background session, which stalled listings in the File Provider (#46)
  • Fixed S3 folder deletes and moves reporting success when S3 refused to delete some keys, and acting on keys outside the folder (#63, #69)
  • Fixed S3 listings of an empty folder beside a same-named object, an S3 listing page holding one item more than maxPageSize, and more rejected S3 credentials reported as unauthorized (#61, #62)
  • Fixed listings placing items whose name is no single path component (e.g. a/b, ..) at the wrong path (#58)
  • Fixed VF6 folders that old Cryptomator versions shortened at 129 characters missing from listings (#61)
  • Fixed overwriting a long-named file in a VF7/VF8 vault failing with itemAlreadyExists, and leftover .c9s directories failing a listing (#71)
  • Fixed large vault listings and folder deletes timing out by running at most 8 item operations at once (#71)
  • Fixed vault folder deletes that could follow a corrupt dir file into the vault root, an ancestor or a Google Drive shortcut or Graph remote item, or delete a folder another device had moved away (#73, #74)
  • Fixed shortened-name files whose content doesn't hash to the listed name being accepted (#59, #60)
  • Fixed HTTPS→HTTP redirects being followed and WebDAV passwords being sent over a downgraded hop
  • Fixed debug logs containing tokens, presigned URLs, upload-session URLs or file-link paths (#46, #47, #48, #68)

Full Changelog: 4.0.0...5.0.0