{"id":17090854,"url":"https://github.com/phimage/cryptoprephirences","last_synced_at":"2025-06-20T09:34:02.023Z","repository":{"id":56906842,"uuid":"48848743","full_name":"phimage/CryptoPrephirences","owner":"phimage","description":"Add some encryption to your sensitive preferences","archived":false,"fork":false,"pushed_at":"2018-02-01T12:43:18.000Z","size":73,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-17T18:19:08.537Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","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/phimage.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":"2015-12-31T12:25:08.000Z","updated_at":"2019-03-22T03:26:25.000Z","dependencies_parsed_at":"2022-08-21T03:20:50.413Z","dependency_job_id":null,"html_url":"https://github.com/phimage/CryptoPrephirences","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/phimage/CryptoPrephirences","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phimage%2FCryptoPrephirences","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phimage%2FCryptoPrephirences/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phimage%2FCryptoPrephirences/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phimage%2FCryptoPrephirences/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phimage","download_url":"https://codeload.github.com/phimage/CryptoPrephirences/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phimage%2FCryptoPrephirences/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260919393,"owners_count":23082752,"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-10-14T13:56:54.160Z","updated_at":"2025-06-20T09:33:57.010Z","avatar_url":"https://github.com/phimage.png","language":"Swift","readme":"# CryptoPrephirences\n\n[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat\n            )](http://mit-license.org)\n[![Platform](http://img.shields.io/badge/platform-ios_osx_tvos-lightgrey.svg?style=flat\n             )](https://developer.apple.com/resources/)\n[![Language](http://img.shields.io/badge/language-swift-orange.svg?style=flat\n             )](https://developer.apple.com/swift)\n[![Issues](https://img.shields.io/github/issues/phimage/CryptoPrephirences.svg?style=flat\n           )](https://github.com/phimage/CryptoPrephirences/issues)\n[![Cocoapod](http://img.shields.io/cocoapods/v/CryptoPrephirences.svg?style=flat)](http://cocoadocs.org/docsets/Prephirences/)\n[![Join the chat at https://gitter.im/phimage/Prephirences](https://img.shields.io/badge/GITTER-join%20chat-00D06F.svg)](https://gitter.im/phimage/Prephirences?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\n[\u003cimg align=\"left\" src=\"logo.png\" hspace=\"20\"\u003e](#logo) CryptoPrephirences allows you to protect your preferences against unauthorized access and modification.\n\n```swift\npreferences[\"aKey\", .cipher(cipher)] = \"myValueToEncrypt\"\n```\nIt's build on top [Prephirences](https://github.com/phimage/Prephirences) and [CryptoSwift](https://github.com/krzyzanowskim/CryptoSwift)\n\n## Installation\n\n### Support CocoaPods\n\n* Podfile\n\n```\nuse_frameworks!\n\npod \"CryptoPrephirences\"\n```\n\n## Usage\n\n To Encrypt and decrypt data, you will need a `CryptoSwift.Cipher`, see CryptoSwift documentation to create one.\n\n### Encrypt/Decryp each key/value independently\n\n#### Store any NSCoding object compliant\nYou can store one preference using\n```swift\nvar preferences = UserDefaults.standard\npreferences[\"aKey\", .cipher(cipher)] = value\npreferences.set(value, forKey: \"aKey\", withCipher: cipher)\n```\n#### Get the decrypted value\n```swift\nlet value = preferences[key, .cipher(cipher)]\nlet value = preferences.object(forKey: key, withCipher: cipher)\n```\n### Encrypted Plist file\nUsing this method key and values will be encrypted.\n\nYou can read and write your preferences to an encrypted file using :\n\n```swift\ntry anyPreferences.saveTo(filePath: \"/path/to/file\", withCipher:cipher)\n\ntry mutablePreferences.loadFrom(filePath: \"/path/to/file\", withCipher: cipher)\n```\nYou can also initialize a `DictionaryPreferences` with `cipher`\n```swift\nlet pref = try DictionaryPreferences(filePath: filePath, withCipher: cipher)\n```\n\n### Encrypted all values\nYou can use the `CryptoPrephirences`, which work as a proxy of another `Prephirences` and encrypt/decrypt using the given `cipher`\n\n```swift\nvar cryptoPreferences = MutableCryptoPrephirences(preferences: mutablePreferences, cipher: cipher)\n// or for read-only CryptoPrephirences(preferences: anyPreferences, cipher: cipher)\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphimage%2Fcryptoprephirences","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphimage%2Fcryptoprephirences","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphimage%2Fcryptoprephirences/lists"}