{"id":18389289,"url":"https://github.com/rightpoint/rzsafarikeychain","last_synced_at":"2025-04-07T02:34:11.030Z","repository":{"id":22977066,"uuid":"26327200","full_name":"Rightpoint/RZSafariKeychain","owner":"Rightpoint","description":"A simple implementation of Safari Keychain","archived":false,"fork":false,"pushed_at":"2017-04-18T15:48:05.000Z","size":11,"stargazers_count":17,"open_issues_count":0,"forks_count":1,"subscribers_count":29,"default_branch":"master","last_synced_at":"2025-04-06T00:02:19.101Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Rightpoint.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}},"created_at":"2014-11-07T16:14:07.000Z","updated_at":"2024-01-20T16:45:14.000Z","dependencies_parsed_at":"2022-08-21T07:40:40.333Z","dependency_job_id":null,"html_url":"https://github.com/Rightpoint/RZSafariKeychain","commit_stats":null,"previous_names":["raizlabs/rzsafarikeychain"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rightpoint%2FRZSafariKeychain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rightpoint%2FRZSafariKeychain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rightpoint%2FRZSafariKeychain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rightpoint%2FRZSafariKeychain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rightpoint","download_url":"https://codeload.github.com/Rightpoint/RZSafariKeychain/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247583226,"owners_count":20961991,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-11-06T01:42:25.052Z","updated_at":"2025-04-07T02:34:06.015Z","avatar_url":"https://github.com/Rightpoint.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"RZSafariKeychain\n================\n\nRZSafariKeychain is a collection of class methods to make getting access to the user credentials in the keychain easier.\n\n### Installation\nEasiest way to install is using cocopods, add this to your pod file to get it working.\n\n```ruby\npod 'RZSafariKeychain', '~\u003e 0.1'\n```\n\nAlternatively you can just add the contents of the source folder to your project.\n\n\n### Use\n\n##### Check for Access\nIf you are building for iOS 7 + 8 you need to make sure that the system has access.  There is a class method to do this `+ (BOOL)isSafariKeychainAvailable;`\n\n##### Ask for credentials\nIf the device has access to safari keychain you can then prompt the user for their credentials.  Here is an example call\n```objc\n[RZSafariKeychain getAccountKeychainCredentialsWithCompletion:^(NSString *accountName, NSString *accountPassword, NSError *error) {\n        if ( error ) {\n            NSLog(@\"Error getting safari Credentials: %@\", error);\n        }\n        else {\n            if ( accountName != nil \u0026\u0026 accountPassword != nil ) {\n                self.emailAddressTextField.text = accountName;\n                self.passwordTextField.text = accountPassword;\n            }\n            else {\n                NSLog( @\"Got back an invalid account name or password\" );\n            }\n        }\n    }];\n\n```\n\nSetup Walkthrough\n=======\n** The remainder of the readme is just a walkthrough to setting up the server/configuration side of Safari Keychain. **\n\n\n### Server Implementation\n#####  Create your web credentials JSON file.\nThis will look something like this:\n \n```json\n{\n    \"webcredentials\": {\n    \t\"apps\": [    \"YWBN8XTPBJ.com.example.myApp\",\n                 \t\"YWBN8XTPBJ.com.example.myOtherApp\" ]\n    }\n}\n```\nNote that the service that is being used is 'webcredentials' and the value used for apps is in the form `App-ID-Prefix`.`bundleID`\n\n**An Important Note:  The value above for YWBN8XTPBJ is the App ID Prefix.  This is generally the same as your TeamID but this is not always the case!  See here for more details: \u003chttps://developer.apple.com/library/ios/technotes/tn2311/_index.html\u003e**\n\n#####Sign the json file.\nNext you need to sign the json file to create an apple-app-site-association file.  This can be done with the following script.\n\n```sh\ncat json.txt | openssl smime -sign -inkey example.com.key\n                             -signer example.com.pem\n                             -certfile intermediate.pem\n                             -noattr -nodetach\n                             -outform DER \u003e apple-app-site-association\n```\n\nYou will need to get the key and certificate for your webserver to pass in above as the `-sign` and `-signer` parameters.\n\nNote that your actual command may be a bit different and most will not have a `-certfile` unless you have intermediate certificates.\n\n##### Host the file.\nThe last step for the server side setup is to actually host the file.  The location for it should be `https://example.com/apple-app-site-association`.\n\nAlso make sure that the `Content-Type` is `application/pkcs7-mime`\n\n### App Configuration\n\nThis is generally the easy part.\n##### Add capabilities.\nIn XCode go to your `Project File` -\u003e `Capabilities` -\u003e `Associated Domains` and turn it on.\n\n##### Add Associated Domains\nInline in xCode hit the `+` and add your domain in the following format:  `service`:`Domain`  An example of this would be `webcredentials:www.example.com`.  This will update your entitlements.plist to look something like this.\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"\u003e\n\u003cplist version=\"1.0\"\u003e\n\u003cdict\u003e\n\t\u003ckey\u003ecom.apple.developer.associated-domains\u003c/key\u003e\n\t\u003carray\u003e\n\t\t\u003cstring\u003ewebcredentials:www.example.com\u003c/string\u003e\n\t\u003c/array\u003e\n\u003c/dict\u003e\n\u003c/plist\u003e\n\n```\n\nFor most people you are done.  Easy.\n\nIf something goes wrong there is the option to configure you app ID through the Developer portal which is also easy.  Just navigate to your app id and add Associated Domains.  After this you will also need to add your domains in the same format as above.\n\n**If you use an enterprise cert or if there is any other reason that you use a wildcard app id (anything with a * in it), this will be annoying...  You will not be able to have an entitlements plist with these keys in it.  To get around this you can have multiple entitlements plist files, one for Production and one for Enterprise/Wildcard.  There is an `code signing entitlements` property on a projects build settings that you can use to differentiate based off of a build configuration**\n\n## Usefull links\nThis is just a collection of links that I found helpful while implementing safari keychain.\n\n- \u003chttps://developer.apple.com/library/prerelease/ios/documentation/UserExperience/Conceptual/Handoff/AdoptingHandoff/AdoptingHandoff.html#//apple_ref/doc/uid/TP40014338-CH2-SW10\u003e ( check out the section titled 'Web Browser-to-Native App Handoff' )\n- \u003chttps://developer.apple.com/videos/wwdc/2014/#506\u003e ( WWDC video )\n- \u003chttps://www.openssl.org/docs/apps/smime.html\u003e ( OpenSSL reference for smime, helpful if you have a complex web setup. )\n- \u003chttps://developer.apple.com/library/ios/technotes/tn2311/_index.html\u003e ( Apple Docs for Managing a different App ID Prefix and Team ID )\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frightpoint%2Frzsafarikeychain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frightpoint%2Frzsafarikeychain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frightpoint%2Frzsafarikeychain/lists"}