Skip to content

Commit

Permalink
Generate secrets from .properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin AIMONE authored and Benjamin AIMONE committed May 18, 2022
1 parent 28afc20 commit 5edad8a
Show file tree
Hide file tree
Showing 5 changed files with 245 additions and 84 deletions.
13 changes: 11 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# 0.2.0
### Improvements
* Ability to re-generate secrets from .properties file
* Group Gradle tasks and their descriptions to convenience command `tasks`
* Add a blank space after all // in line comments
#### Contributors
@valydia
@marius-m
@michpohl
# 0.1.5
### Fixes
* Fix `UnsatisfiedLinkError` when package name has underscores. Reported in https://github.com/klaxit/hidden-secrets-gradle-plugin/issues/52
Expand All @@ -17,7 +26,7 @@
* Fix call to `customDecode()` in C++ code
### Improvements
* jcenter dependency removed
* Moving up to gradle 6.8.3
* Moving up to gradle 6.8.3
* Various libraries update
# 0.1.1
### Fixes
Expand All @@ -37,4 +46,4 @@
1) Remove files : `secrets.cpp`, `sha256.cpp` and `Secrets.kt` from your project (that will delete all your keys previously added)
2) You need to re-add all your keys with `hideSecret` command (will copy new cpp files and encode your key)
# 0.1.0
* First release
* First release
43 changes: 37 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,23 +119,54 @@ This method is automatically called and will revert the rot13 applied on your ke
Secrets().getYourSecretKeyName(packageName)
```

## Other available commands
# Going further
## Generate secrets from properties file
You can generate secrets from properties file as well.

### Copy files
### Use case
If you are using CI system to provide secrets, that are not hard-coded into the repository itself. It will re-generate those secrets in the app and build it.

This is useful if you want to split production keys from repository itself, thus increasing security in your project repository.

### Setting up
1. Create a new properties file in root project directory.

``` shell
credentials.properties
```

2. Fill in wanted secrets. For ex.:

``` java-properties
keyName1=yourKeyToObfuscate1
keyName2=yourKeyToObfuscate2
```

3. Run

``` shell
./gradlew hideSecretFromPropertiesFile -PpropertiesFileName=credentials.properties
```

It will regenerate all secret files in the project and update all secrets from the properties file.

# Other available commands

## Copy files
Copy required files to your project :
```shell
./gradlew copyCpp
./gradlew copyKotlin [-Ppackage=your.package.name]
```

### Obfuscate
## Obfuscate
Create an obfuscated key and display it :
```shell
./gradlew obfuscate -Pkey=yourKeyToObfuscate [-Ppackage=com.your.package]
```
This command can be useful if you modify your app's package name based on `buildTypes` configuration. With this command you can get the obfuscated key for a different package name and manually integrate it in another function in `secrets.cpp`.

## Development
# Development

Pull Requests are very welcome!

Expand All @@ -146,10 +177,10 @@ Before opening a PR :
- `./gradlew test` must succeed
- `./gradlew detekt` must succeed to avoid any style issue

## Authors
# Authors

See the list of [contributors](https://github.com/klaxit/hidden-secrets-gradle-plugin/contributors) who participated in this project.

## License
# License

Please see [LICENSE](https://github.com/klaxit/hidden-secrets-gradle-plugin/blob/master/LICENSE)
6 changes: 3 additions & 3 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
rootProject.name = "HiddenSecretsPlugin"

gradle.allprojects {
group = "com.klaxit.hiddensecrets"
version = "0.1.5"
}
group = "com.klaxit.hiddensecrets"
version = "0.2.0"
}
Loading

0 comments on commit 5edad8a

Please sign in to comment.