File tree 1 file changed +20
-6
lines changed
1 file changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -20,16 +20,32 @@ And then execute:
20
20
21
21
$ bundle install
22
22
23
- Or install it yourself as :
23
+ Or install it globally (to use the CLI from any project) :
24
24
25
25
$ gem install diffcrypt
26
26
27
27
28
28
29
29
## Usage
30
30
31
+ There are a few ways to use the library, depending on how advanced your use case is.
31
32
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
33
49
34
50
``` ruby
35
51
encryptor = Diffcrypt ::Encryptor .new (' 99e1f86b9e61f24c56ff4108dd415091' )
@@ -38,18 +54,16 @@ encrypted = encryptor.encrypt(yaml)
38
54
File .write(' tmp/example.yml.enc' , encrypted)
39
55
```
40
56
41
- ### Decrypt a file
42
-
43
57
``` ruby
44
58
encryptor = Diffcrypt ::Encryptor .new (' 99e1f86b9e61f24c56ff4108dd415091' )
45
59
yaml = File .read(' test/fixtures/example.yml.enc' )
46
60
config = YAML .safe_load(encryptor.decrypt(yaml))
47
61
```
48
62
49
- ### Rails
63
+ ### Ruby on Rails
50
64
51
65
Currently 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.
53
67
54
68
``` ruby
55
69
require ' diffcrypt/rails/encrypted_configuration'
You can’t perform that action at this time.
0 commit comments