Skip to content

feat: add access group and keychain synchronization #378

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 27 commits into from
Aug 25, 2022
Merged

feat: add access group and keychain synchronization #378

merged 27 commits into from
Aug 25, 2022

Conversation

cbaker6
Copy link
Contributor

@cbaker6 cbaker6 commented Jul 3, 2022

New Pull Request Checklist

Issue Description

Items in keychain currently can't be synced across apps or groups.

Related issue: #n/a

Approach

Follow Apple's guide to add an access group and enable synchronizing keychain across devices. The method below has been added:

/**
     Sets all of the items in the Parse Keychain to a specific access group.
     Apps in the same access group can share Keychain items. See Apple's
      [documentation](https://developer.apple.com/documentation/security/ksecattraccessgroup)
      for more information.
     - parameter accessGroup: The name of the access group.
     - parameter synchronizeAcrossDevices: **true** to synchronize, **false** to disable synchronization.
     - throws: An error of type `ParseError`.
     - returns: **true** if the Keychain was moved to the new `accessGroup`, **false** otherwise.
     - warning: Setting `synchronizeAcrossDevices == true` requires `accessGroup` to be
     set to a valid [keychain group](https://developer.apple.com/documentation/security/ksecattraccessgroup).
     */
    @discardableResult static public func setAccessGroup(_ accessGroup: String?,
                                                         synchronizeAcrossDevices: Bool) throws -> Bool

// Call the method
do {
  try ParseSwift.setAccessGroup("name.of.access.group", synchronizeAcrossDevices: false)
} catch {
  // Handle error
}

All Keychain items can be synced except for ParseInstallation and ParseVersion as both of these are unique to it's respective install.

TODOs before merging

  • Add tests
  • Add entry to changelog
  • Add changes to documentation (guides, repository pages, in-code descriptions)

@parse-github-assistant
Copy link

parse-github-assistant bot commented Jul 3, 2022

Thanks for opening this pull request!

  • 🎉 We are excited about your hands-on contribution!

@codecov
Copy link

codecov bot commented Jul 3, 2022

Codecov Report

Merging #378 (b530234) into main (89e5e69) will increase coverage by 0.23%.
The diff coverage is 98.90%.

@@            Coverage Diff             @@
##             main     #378      +/-   ##
==========================================
+ Coverage   89.06%   89.29%   +0.23%     
==========================================
  Files         156      157       +1     
  Lines       14778    14970     +192     
==========================================
+ Hits        13162    13368     +206     
+ Misses       1616     1602      -14     
Impacted Files Coverage Δ
Sources/ParseSwift/Storage/ParseStorage.swift 82.14% <ø> (ø)
Sources/ParseSwift/Types/ParseACL.swift 93.58% <ø> (ø)
Sources/ParseSwift/Storage/KeychainStore.swift 97.86% <98.40%> (+2.21%) ⬆️
Sources/ParseSwift/Objects/ParseInstallation.swift 85.27% <100.00%> (ø)
Sources/ParseSwift/Objects/ParseObject.swift 87.29% <100.00%> (ø)
Sources/ParseSwift/Objects/ParseUser.swift 86.34% <100.00%> (+0.19%) ⬆️
Sources/ParseSwift/Parse.swift 91.28% <100.00%> (+2.61%) ⬆️
...es/ParseSwift/Protocols/ParseHookRequestable.swift 100.00% <100.00%> (ø)
Sources/ParseSwift/Types/ParseConfig.swift 100.00% <100.00%> (+1.09%) ⬆️
...es/ParseSwift/Types/ParseKeychainAccessGroup.swift 100.00% <100.00%> (ø)
... and 8 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@cbaker6 cbaker6 marked this pull request as draft July 3, 2022 21:30
@cbaker6 cbaker6 marked this pull request as ready for review August 22, 2022 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant