{"id":14955983,"url":"https://github.com/pcboy/ncypher","last_synced_at":"2025-03-29T11:31:00.218Z","repository":{"id":55173803,"uuid":"68279320","full_name":"pcboy/ncypher","owner":"pcboy","description":"A gem to help you encrypt your credentials in your projects","archived":false,"fork":false,"pushed_at":"2024-02-27T03:46:21.000Z","size":44,"stargazers_count":3,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-19T11:46:44.799Z","etag":null,"topics":["aes","cli","encryption","libsodium","ruby-on-rails","secrets"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pcboy.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":"2016-09-15T08:48:42.000Z","updated_at":"2023-05-04T18:50:48.000Z","dependencies_parsed_at":"2024-09-22T00:02:14.783Z","dependency_job_id":null,"html_url":"https://github.com/pcboy/ncypher","commit_stats":{"total_commits":63,"total_committers":3,"mean_commits":21.0,"dds":"0.25396825396825395","last_synced_commit":"eb1eebb6b396320b2d96610d931fc6730c269e16"},"previous_names":["pcboy/ncipher"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcboy%2Fncypher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcboy%2Fncypher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcboy%2Fncypher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcboy%2Fncypher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pcboy","download_url":"https://codeload.github.com/pcboy/ncypher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246178363,"owners_count":20736134,"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":["aes","cli","encryption","libsodium","ruby-on-rails","secrets"],"created_at":"2024-09-24T13:12:07.592Z","updated_at":"2025-03-29T11:30:59.950Z","avatar_url":"https://github.com/pcboy.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Code Climate](https://codeclimate.com/github/pcboy/ncypher/badges/gpa.svg)](https://codeclimate.com/github/pcboy/ncypher)\n[![Build Status](https://travis-ci.org/pcboy/ncypher.svg)](https://travis-ci.org/pcboy/ncypher)\n\n# Ncypher\n\nNcypher is a gem to help you to encrypt your credentials in your projects in a safe manner.\n\n## DEPRECATED\n\nThis project is now deprecated. I built this in a time were these type of solutions were not common. Now rails has something similar built-in. And today I would just recommend to use [Age](https://github.com/FiloSottile/age) and [Sops](https://github.com/getsops/sops) instead.\n\n\n## Upgrade from versions before 1.0\nVersions before 1.0 were using rbnacl-libsodium gem which is now deprecated.  \nThe big difference is that now you need to have libsodium installed on your host system.  \nThat also means faster gem installation. =)  \nCheck https://github.com/RubyCrypto/rbnacl/wiki/Installing-libsodium for more info.  \nNote: You need Argon2 support. So libsodium \u003e= v1.0.15\n\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'ncypher'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install ncypher\n\n## Basic Usage\n\nFirst generate a new encryption key. Typically this key needs to be in your .gitignore.\nYou don't want it to be pushed to the repository. This file will be used by ncypher each time you need to encrypt/decrypt something. You need to call it `.ncypher_key` and put it in the current folder or any other folder before. (i.e ~/.ncypher_key is fine for instance).\n```\n$\u003e ncypher generate_key \u003e .ncypher_key\n```\nYou can also set the env variable `NCYPHER_KEY` to that generated key (i.e `export NCYPHER_KEY=kSzARCAw9uv/LQ1o75k5ica1oCpZBUCpP99Sy+s6L2c=`) instead of saving it to a file \n\nTo encrypt a new password (or anything else), ncypher supports stdin. So you can do:\n```\n$\u003e ncypher encrypt \u003c secret_file \u003e secret_file.encrypted\n$\u003e ncypher decrypt \u003c secret_file.encrypted \u003e secret_file\n$\u003e ncypher encrypt\nmypassword\n\u003cCTRL+D\u003e\nTAmmvlinPFBmH9bx+IW9L5lKkRdgv3Yv3P4kyyIs0uTTyiTunG7vZ+DNVHMJiuviHOHg\n```\nI highly recommend you to always use that method! As passing the password as parameter will keep it in your shell history (unless you have HISTFILE=/dev/null).\n\nIf you want to do it by passing the pass as parameter:\n\n```\n$\u003e ncypher encrypt 'p4$$w0rd'\ndeB7ba27qR470UetK/HW47dYMN7p9hguuDiVt59U+Bly6cfQcjgbw/ui/2hBhCEa\n```\n\nNote, you can also use the decrypt parameter in the ncypher binary to do the decryption:\n```\n$\u003e ncypher decrypt deB7ba27qR470UetK/HW47dYMN7p9hguuDiVt59U+Bly6cfQcjgbw/ui/2hBhCEa \np4$$w0rd \n```\nSo in the end:\n```\n$\u003e ncypher decrypt `ncypher encrypt 'p4$$w0rd'`\np4$$w0rd\n```\n\n:)\n\nAnd if you are using ruby, Ncypher::Ncypher.decrypt will magically use your key in `.ncypher_key` to decrypt that password at runtime. \nNow you can directy put in your .yaml files:\n```\ndefaults: \u0026defaults\n  my_password: \u003c%= Ncypher::Ncypher.decrypt('lXEwfKv4dEjmK0kojEAnikNsLCsVCtSMiR2aSfM6uUXYn2DzCZ3O7SA9HaGnMp/kEEsI') %\u003e\n```\n\n## Password derived secret key\n\nIn some cases you may want to derive a key from a particular password you have memorized. You can simply do:\n\n```\n$\u003e ncypher derive_key p4$$w0rd\nR9RgHcFnuHr+86/7v3MdDyu3V63jh69VCPMXknA2v6E=\nSALT: 4+d4JTGTxRbtXs1vYScBYg==\n```\n\nYou can see that the salt is randomly generated for security reasons. You should put that salt in a `.ncypher_salt` file in the current directory (this file can be pushed to your repository). So that the next time you do `ncypher derive_key p4$$w0rd` you get the exact same ncyper\\_key generated.  \nNote that the salt is written on STDERR so you can directly do:\n\n```\n$\u003e ncypher derive_key p4$$w0rd \u003e .ncypher_key\nSALT: WKCAkJcS65nx3lA/w1BmBw==\n```\n\nThen you have the ncypher\\_key in .ncypher\\_key. Be sure to save the salt if you want to be able to derive back the exact same key in the future.  \nThe derive_key command also listen to stdin so for safety you can instead do:  \n\n```\n$\u003e ncypher derive_key \u003e .ncypher_key\n```\n\nAnd enter your password then CTRL+D.  \n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/pcboy/ncypher. 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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpcboy%2Fncypher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpcboy%2Fncypher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpcboy%2Fncypher/lists"}