Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/herohtar/credentials_helper
Provides an easy method for loading credentials from a file or JSON in Dart
https://github.com/herohtar/credentials_helper
credentials-helper dartlang json
Last synced: about 1 month ago
JSON representation
Provides an easy method for loading credentials from a file or JSON in Dart
- Host: GitHub
- URL: https://github.com/herohtar/credentials_helper
- Owner: Herohtar
- License: mit
- Created: 2018-07-14T03:08:45.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-09-02T21:36:27.000Z (over 5 years ago)
- Last Synced: 2024-10-27T22:21:32.023Z (2 months ago)
- Topics: credentials-helper, dartlang, json
- Language: Dart
- Homepage: https://pub.dartlang.org/packages/credentials_helper
- Size: 13.7 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# credentials_helper [![Actions Status](https://github.com/Herohtar/credentials_helper/workflows/Dart%20CI/badge.svg)](https://github.com/Herohtar/credentials_helper/actions)
The idea behind this package is to provide a simple way to use various credentials in a project (particularly during development/testing) that is less prone to result in a private API key or the like being commited or published along with your code.
You can store your API keys, usernames, passwords, etc. in a JSON file that is either listed in your `.gitignore` or completely outside the project directory and load them into this class. You could also retrieve them from other JSON sources.
## Example
### credentials.json
```json
{
"api_key": "YOUR-API-KEY",
"username": "yourUsername",
"password": "yourPassword"
}
```### Dart code
```dart
import 'package:credentials_helper/credentials_helper.dart';void main() {
Credentials credentials = Credentials.fromFile('credentials.json');
myApiCall(apiKey: credentials.apiKey);
}
```