{"id":15801840,"url":"https://github.com/zhandao/secure_storage","last_synced_at":"2025-03-31T21:56:12.753Z","repository":{"id":88488085,"uuid":"147296652","full_name":"zhandao/secure_storage","owner":"zhandao","description":"Transparent Encryption Storage. It helps you automatically decrypt the fields you declared when they are saved and read.","archived":false,"fork":false,"pushed_at":"2019-11-18T07:35:40.000Z","size":15,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-05T01:41:21.762Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/zhandao.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-04T06:12:17.000Z","updated_at":"2020-12-15T06:11:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"67b893b6-b969-45ee-afb9-089a6dba4def","html_url":"https://github.com/zhandao/secure_storage","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhandao%2Fsecure_storage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhandao%2Fsecure_storage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhandao%2Fsecure_storage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhandao%2Fsecure_storage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhandao","download_url":"https://codeload.github.com/zhandao/secure_storage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246547388,"owners_count":20794970,"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-05T01:41:03.135Z","updated_at":"2025-03-31T21:56:12.731Z","avatar_url":"https://github.com/zhandao.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SecureStorage\n\nTransparent Encryption Storage. \nIt helps you automatically decrypt the fields you declared when they are saved and read.\n\nIt use **Base64 encoded, AES256-CBC encrypt** by default (can not change currently).\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'secure_storage', github: 'zhandao/secure_storage'\n```\n\n## Usage\n\n### Config\n\nIn your model:\n\n```ruby\nself.secure_storage_key = Settings.secure_storage.key\n# self.prefix = 'encrypted_' # prefix for the columns name\n# self.suffix = ''           # suffix for the columns name\n```\n\n### Migration\n\nChange the fields' column name, as default:\n\n```ruby\nt.string :encrypted_email\n```\n\n### Declare\n\nIn your model:\n\n```ruby\nhas_secure :email#, :phone, ...\n```\n\n### Old Data Processing\n\n```ruby\nModel.secure_storage\n```\n\nNote: Unencrypted data will be encrypted automatically when read it.\n\n### Try It!\n\n```ruby\nModel.create(email: 'test@test.com')\nModel.first.email           # =\u003e 'test@test.com'\nModel.first.encrypted_email # =\u003e 'ENCRYPTED'\n```\n\n### Querying\n\n```ruby\nModel.find_by_email('test@test.com')         # ok\nModel.find(email: 'test@test.com')           # NO!\nModel.where(encrypted_email: 'ENCRYPTED')    # ok\nModel.with_encrypted(email: 'test@test.com') # ok\nModel.xwhere(email: 'test@test.com')         # ok\n```\n\nSuppose we have another encrypted `phone`:\n\n```ruby\nModel.xfind_by(email: 'test@test.com', phone: '123', not_enc_filed: 'foo')\nModel.xwhere(email: 'test@test.com', phone: '123', not_enc_filed: 'foo')\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/secure_storage. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the SecureStorage project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/secure_storage/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhandao%2Fsecure_storage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhandao%2Fsecure_storage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhandao%2Fsecure_storage/lists"}