File tree Expand file tree Collapse file tree 1 file changed +20
-6
lines changed
Expand file tree Collapse file tree 1 file changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -20,16 +20,32 @@ And then execute:
2020
2121 $ bundle install
2222
23- Or install it yourself as :
23+ Or install it globally (to use the CLI from any project) :
2424
2525 $ gem install diffcrypt
2626
2727
2828
2929## Usage
3030
31+ There are a few ways to use the library, depending on how advanced your use case is.
3132
32- ### Encrypt existing file
33+
34+ ### CLI
35+
36+ The easiest way to get started is to use the CLI.
37+
38+ ``` shell
39+ diffcrypt decrypt -k $( cat test/fixtures/master.key) test/fixtures/example.yml.enc
40+ diffcrypt encrypt -k $( cat test/fixtures/master.key) test/fixtures/example.yml
41+ ```
42+
43+
44+ ### Ruby
45+
46+ A direct API is exposed so ` Diffcrypt::Encryptor ` can be used in any ruby project.
47+
48+ ** NOTE:** This API may change any time until v1.0
3349
3450``` ruby
3551encryptor = Diffcrypt ::Encryptor .new (' 99e1f86b9e61f24c56ff4108dd415091' )
@@ -38,18 +54,16 @@ encrypted = encryptor.encrypt(yaml)
3854File .write(' tmp/example.yml.enc' , encrypted)
3955```
4056
41- ### Decrypt a file
42-
4357``` ruby
4458encryptor = Diffcrypt ::Encryptor .new (' 99e1f86b9e61f24c56ff4108dd415091' )
4559yaml = File .read(' test/fixtures/example.yml.enc' )
4660config = YAML .safe_load(encryptor.decrypt(yaml))
4761```
4862
49- ### Rails
63+ ### Ruby on Rails
5064
5165Currently there is not native support for rails, but ActiveSupport can be monkeypatched to override
52- the built in encrypter.
66+ the built in encrypter. All existing ` rails credentials:edit ` also work with this method.
5367
5468``` ruby
5569require ' diffcrypt/rails/encrypted_configuration'
You can’t perform that action at this time.
0 commit comments