SharedWebCredentials 0.2.0

SharedWebCredentials 0.2.0

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Sep 2016
SPMSupports SPM

Maintained by Alek Åström.



SharedWebCredentials

The Shared Web Credentials API is used to store credentials in the iCloud keychain to be shared among and between native iOS apps and web apps on Safari for iOS and MacOS.

This is a Swift wrapper for that Core Foundation API.

References

Apple Developer Documentation: Shared Web Credentials

WWDC Session 506: Your App, Your Website, and Safari

Example usage

// Fetch credentials
SharedWebCredentials.request(fqdn: "webapp.example.com") { credential, error in
    if let credential = credential {
        print("Account: \(credential.account), Password: \(credential.password)")
    }
}

// Save new credential
let credential = Credential(account: "[email protected]", password: "p4ssw0rd")
SharedWebCredentials.save(credential: credential, fqdn: "webapp.example.com") { error in
    print("Saved!")
}

// Delete credential after password reset
SharedWebCredentials.delete(account: "[email protected]", fqdn: "webapp.example.com") { error in
    print("Deleted!")
}

Requirements & Swift versions

  • Version 0.1.x is built for Swift 2.3
  • Version 0.2.x and above is built for Swift 3.0

License

SharedWebCredentials is available under the MIT license. See the LICENSE file for more info.